diff --git a/.gitattributes b/.gitattributes index 15532825..87cd6547 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,5 +8,4 @@ *.bat text eol=crlf # This allows generated code to be indexed correctly -*.java linguist-generated=false - +*.java linguist-generated=false \ No newline at end of file diff --git a/.gitignore b/.gitignore index df0a9853..dccbac30 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ +**/.speakeasy/temp/ +**/.speakeasy/logs/ +.speakeasy/reports +.env +.env.local # Ignore Gradle project-specific cache directory .gradle # Ignore Gradle build output directory diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 0552d745..49b11fc7 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,745 +1,1496 @@ lockVersion: 2.0.0 id: b4f7f2df-6c4d-4150-a18f-8b74fe44eb22 management: - docChecksum: 59634240879b8bce1b699c21c7f4f276 + docChecksum: d5178fea7af23529e09cd3b74d1d23c1 docVersion: 1.0.0 - speakeasyVersion: 1.377.1 - generationVersion: 2.404.1 - releaseVersion: 0.5.0 - configChecksum: 3b33f25e938c6a67453f8e636f88064a + speakeasyVersion: 1.639.3 + generationVersion: 2.730.5 + releaseVersion: 0.6.0 + configChecksum: 22a1d0e20087258d10a74b54f99a91a1 repoURL: https://github.com/livepeer/livepeer-java.git features: java: additionalDependencies: 0.1.0 + additionalProperties: 0.0.1 constsAndDefaults: 0.1.1 - core: 3.29.4 + core: 3.53.0 deprecations: 2.81.1 flattening: 2.81.1 - globalSecurity: 2.82.7 + globalSecurity: 2.83.1 globalSecurityCallbacks: 0.1.0 globalSecurityFlattening: 0.1.0 - globalServerURLs: 2.82.1 + globalServerURLs: 2.82.2 inputOutputModels: 2.83.0 nameOverrides: 2.81.3 nullables: 0.1.0 - sdkHooks: 0.1.0 - unions: 0.0.5 + sdkHooks: 1.1.0 + unions: 0.0.6 + uploadStreams: 0.1.0 generatedFiles: - - src/main/java/studio/livepeer/livepeer/SecuritySource.java - - src/main/java/studio/livepeer/livepeer/SDKConfiguration.java - - src/main/java/studio/livepeer/livepeer/Stream.java - - src/main/java/studio/livepeer/livepeer/Multistream.java - - src/main/java/studio/livepeer/livepeer/Webhook.java - - src/main/java/studio/livepeer/livepeer/Asset.java - - src/main/java/studio/livepeer/livepeer/Session.java - - src/main/java/studio/livepeer/livepeer/Room.java - - src/main/java/studio/livepeer/livepeer/Metrics.java - - src/main/java/studio/livepeer/livepeer/AccessControl.java - - src/main/java/studio/livepeer/livepeer/Task.java - - src/main/java/studio/livepeer/livepeer/Transcode.java - - src/main/java/studio/livepeer/livepeer/Playback.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateStreamRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetStreamRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateClipRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetClipsRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetsRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateMultistreamTargetRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhooksRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateWebhookRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetAssetsRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetAssetRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionsRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetRoomRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateSigningKeyRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeysRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetTasksRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetTaskRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/TranscodeVideoRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoRequestBuilder.java - - src/main/java/studio/livepeer/livepeer/models/operations/SDKMethodInterfaces.java - - src/main/java/studio/livepeer/livepeer/Livepeer.java - .gitattributes + - USAGE.md - build.gradle - - gradle/wrapper/gradle-wrapper.jar - - gradle/wrapper/gradle-wrapper.properties - - gradlew - - gradlew.bat - - settings.gradle - - src/main/java/studio/livepeer/livepeer/utils/BackoffStrategy.java - - src/main/java/studio/livepeer/livepeer/utils/BigDecimalString.java - - src/main/java/studio/livepeer/livepeer/utils/BigIntegerString.java - - src/main/java/studio/livepeer/livepeer/utils/Deserializers.java - - src/main/java/studio/livepeer/livepeer/utils/EventStream.java - - src/main/java/studio/livepeer/livepeer/utils/EventStreamLineReader.java - - src/main/java/studio/livepeer/livepeer/utils/EventStreamMessage.java - - src/main/java/studio/livepeer/livepeer/utils/EventStreamReader.java - - src/main/java/studio/livepeer/livepeer/utils/FormMetadata.java - - src/main/java/studio/livepeer/livepeer/utils/HTTPClient.java - - src/main/java/studio/livepeer/livepeer/utils/HTTPRequest.java - - src/main/java/studio/livepeer/livepeer/utils/HeaderMetadata.java - - src/main/java/studio/livepeer/livepeer/utils/Helpers.java - - src/main/java/studio/livepeer/livepeer/utils/Hook.java - - src/main/java/studio/livepeer/livepeer/utils/Hooks.java - - src/main/java/studio/livepeer/livepeer/utils/JSON.java - - src/main/java/studio/livepeer/livepeer/utils/LazySingletonValue.java - - src/main/java/studio/livepeer/livepeer/utils/Metadata.java - - src/main/java/studio/livepeer/livepeer/utils/MultipartFormMetadata.java - - src/main/java/studio/livepeer/livepeer/utils/OneOfDeserializer.java - - src/main/java/studio/livepeer/livepeer/utils/Options.java - - src/main/java/studio/livepeer/livepeer/utils/PathParamsMetadata.java - - src/main/java/studio/livepeer/livepeer/utils/QueryParameters.java - - src/main/java/studio/livepeer/livepeer/utils/QueryParamsMetadata.java - - src/main/java/studio/livepeer/livepeer/utils/RequestBody.java - - src/main/java/studio/livepeer/livepeer/utils/RequestMetadata.java - - src/main/java/studio/livepeer/livepeer/utils/Response.java - - src/main/java/studio/livepeer/livepeer/utils/Retries.java - - src/main/java/studio/livepeer/livepeer/utils/RetryConfig.java - - src/main/java/studio/livepeer/livepeer/utils/Security.java - - src/main/java/studio/livepeer/livepeer/utils/SecurityMetadata.java - - src/main/java/studio/livepeer/livepeer/utils/SerializedBody.java - - src/main/java/studio/livepeer/livepeer/utils/SpeakeasyHTTPClient.java - - src/main/java/studio/livepeer/livepeer/utils/SpeakeasyMetadata.java - - src/main/java/studio/livepeer/livepeer/utils/TypedObject.java - - src/main/java/studio/livepeer/livepeer/utils/Types.java - - src/main/java/studio/livepeer/livepeer/utils/Utils.java - - src/main/java/studio/livepeer/livepeer/models/errors/AuthException.java - - src/main/java/studio/livepeer/livepeer/models/errors/SDKError.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateStreamResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetStreamRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetStreamResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateClipTask.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateClipData.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateClipResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetClipsRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetClipsResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetsResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateMultistreamTargetResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhooksResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateWebhookResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetAssetsResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/Task.java - - src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadData.java - - src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetAssetTask.java - - src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetDataOutput.java - - src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetTask.java - - src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetData.java - - src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetAssetRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetAssetResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionsResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/Record.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetRoomRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetRoomResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/BreakdownBy.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/From.java - - src/main/java/studio/livepeer/livepeer/models/operations/To.java - - src/main/java/studio/livepeer/livepeer/models/operations/TimeStep.java - - src/main/java/studio/livepeer/livepeer/models/operations/QueryParamBreakdownBy.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/QueryParamFrom.java - - src/main/java/studio/livepeer/livepeer/models/operations/QueryParamTo.java - - src/main/java/studio/livepeer/livepeer/models/operations/QueryParamTimeStep.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsQueryParamBreakdownBy.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsData.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsQueryParamTimeStep.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsQueryParamBreakdownBy.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/CreateSigningKeyResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeysResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequestBody.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetTasksResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetTaskRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetTaskResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/TranscodeVideoResponse.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoRequest.java - - src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoResponse.java - - src/main/java/studio/livepeer/livepeer/models/errors/Error.java - - src/main/java/studio/livepeer/livepeer/models/components/Three.java - - src/main/java/studio/livepeer/livepeer/models/components/StreamUserTags.java - - src/main/java/studio/livepeer/livepeer/models/components/IsMobile1.java - - src/main/java/studio/livepeer/livepeer/models/components/StreamIsMobile.java - - src/main/java/studio/livepeer/livepeer/models/components/StreamLocation.java - - src/main/java/studio/livepeer/livepeer/models/components/StreamPull.java - - src/main/java/studio/livepeer/livepeer/models/components/StreamRecordingSpec.java - - src/main/java/studio/livepeer/livepeer/models/components/StreamMultistream.java - - src/main/java/studio/livepeer/livepeer/models/components/Renditions.java - - src/main/java/studio/livepeer/livepeer/models/components/Stream.java - - src/main/java/studio/livepeer/livepeer/models/components/TargetOutput.java - - src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfileProfile.java - - src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfileEncoder.java - - src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfile.java - - src/main/java/studio/livepeer/livepeer/models/components/Profile.java - - src/main/java/studio/livepeer/livepeer/models/components/Encoder.java - - src/main/java/studio/livepeer/livepeer/models/components/FfmpegProfile.java - - src/main/java/studio/livepeer/livepeer/models/components/Type.java - - src/main/java/studio/livepeer/livepeer/models/components/PlaybackPolicy.java - - src/main/java/studio/livepeer/livepeer/models/components/CreatorIdType.java - - src/main/java/studio/livepeer/livepeer/models/components/CreatorId1.java - - src/main/java/studio/livepeer/livepeer/models/components/CreatorId.java - - src/main/java/studio/livepeer/livepeer/models/components/NewStreamPayloadRecordingSpec.java - - src/main/java/studio/livepeer/livepeer/models/components/NewStreamPayload.java - - src/main/java/studio/livepeer/livepeer/models/components/UserTags3.java - - src/main/java/studio/livepeer/livepeer/models/components/UserTags.java - - src/main/java/studio/livepeer/livepeer/models/components/Multistream.java - - src/main/java/studio/livepeer/livepeer/models/components/TargetSpec.java - - src/main/java/studio/livepeer/livepeer/models/components/Target.java - - src/main/java/studio/livepeer/livepeer/models/components/InputCreatorIdType.java - - src/main/java/studio/livepeer/livepeer/models/components/InputCreatorId1.java - - src/main/java/studio/livepeer/livepeer/models/components/InputCreatorId.java - - src/main/java/studio/livepeer/livepeer/models/components/One.java - - src/main/java/studio/livepeer/livepeer/models/components/IsMobile.java - - src/main/java/studio/livepeer/livepeer/models/components/Location.java - - src/main/java/studio/livepeer/livepeer/models/components/Pull.java - - src/main/java/studio/livepeer/livepeer/models/components/StreamPatchPayload.java - - src/main/java/studio/livepeer/livepeer/models/components/RecordingSpec.java - - src/main/java/studio/livepeer/livepeer/models/components/AssetType.java - - src/main/java/studio/livepeer/livepeer/models/components/AssetSource3Type.java - - src/main/java/studio/livepeer/livepeer/models/components/Source3.java - - src/main/java/studio/livepeer/livepeer/models/components/AssetSourceType.java - - src/main/java/studio/livepeer/livepeer/models/components/Two.java - - src/main/java/studio/livepeer/livepeer/models/components/SourceType.java - - src/main/java/studio/livepeer/livepeer/models/components/Source1.java - - src/main/java/studio/livepeer/livepeer/models/components/Source.java - - src/main/java/studio/livepeer/livepeer/models/components/AssetNftMetadataTemplate.java - - src/main/java/studio/livepeer/livepeer/models/components/AssetNftMetadata.java - - src/main/java/studio/livepeer/livepeer/models/components/AssetSpec.java - - src/main/java/studio/livepeer/livepeer/models/components/AssetIpfs.java - - src/main/java/studio/livepeer/livepeer/models/components/AssetStorage.java - - src/main/java/studio/livepeer/livepeer/models/components/AssetPhase.java - - src/main/java/studio/livepeer/livepeer/models/components/AssetStatus.java - - src/main/java/studio/livepeer/livepeer/models/components/Hash.java - - src/main/java/studio/livepeer/livepeer/models/components/AssetVideoSpecType.java - - src/main/java/studio/livepeer/livepeer/models/components/Tracks.java - - src/main/java/studio/livepeer/livepeer/models/components/VideoSpec.java - - src/main/java/studio/livepeer/livepeer/models/components/Asset.java - - src/main/java/studio/livepeer/livepeer/models/components/Phase.java - - src/main/java/studio/livepeer/livepeer/models/components/Tasks.java - - src/main/java/studio/livepeer/livepeer/models/components/StorageStatus.java - - src/main/java/studio/livepeer/livepeer/models/components/IpfsFileInfo.java - - src/main/java/studio/livepeer/livepeer/models/components/EncryptionOutput.java - - src/main/java/studio/livepeer/livepeer/models/components/ClipPayload.java - - src/main/java/studio/livepeer/livepeer/models/components/TargetAddPayloadSpec.java - - src/main/java/studio/livepeer/livepeer/models/components/TargetAddPayload.java - - src/main/java/studio/livepeer/livepeer/models/components/MultistreamTarget.java - - src/main/java/studio/livepeer/livepeer/models/components/MultistreamTargetInput.java - - src/main/java/studio/livepeer/livepeer/models/components/MultistreamTargetPatchPayload.java - - src/main/java/studio/livepeer/livepeer/models/components/Events.java - - src/main/java/studio/livepeer/livepeer/models/components/LastFailure.java - - src/main/java/studio/livepeer/livepeer/models/components/Status.java - - src/main/java/studio/livepeer/livepeer/models/components/Webhook.java - - src/main/java/studio/livepeer/livepeer/models/components/WebhookInput.java - - src/main/java/studio/livepeer/livepeer/models/components/Request.java - - src/main/java/studio/livepeer/livepeer/models/components/Response.java - - src/main/java/studio/livepeer/livepeer/models/components/WebhookLog.java - - src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadIpfs1.java - - src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadIpfs.java - - src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadStorage.java - - src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadEncryption.java - - src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayload.java - - src/main/java/studio/livepeer/livepeer/models/components/NftMetadataTemplate.java - - src/main/java/studio/livepeer/livepeer/models/components/NftMetadata.java - - src/main/java/studio/livepeer/livepeer/models/components/Spec.java - - src/main/java/studio/livepeer/livepeer/models/components/NewAssetFromUrlPayload.java - - src/main/java/studio/livepeer/livepeer/models/components/Encryption.java - - src/main/java/studio/livepeer/livepeer/models/components/Ipfs1.java - - src/main/java/studio/livepeer/livepeer/models/components/Ipfs.java - - src/main/java/studio/livepeer/livepeer/models/components/Storage.java - - src/main/java/studio/livepeer/livepeer/models/components/AssetPatchPayload.java - - src/main/java/studio/livepeer/livepeer/models/components/RecordingStatus.java - - src/main/java/studio/livepeer/livepeer/models/components/Session.java - - src/main/java/studio/livepeer/livepeer/models/components/CreateRoomResponse.java - - src/main/java/studio/livepeer/livepeer/models/components/Participants.java - - src/main/java/studio/livepeer/livepeer/models/components/Room.java - - src/main/java/studio/livepeer/livepeer/models/components/RoomEgressPayload.java - - src/main/java/studio/livepeer/livepeer/models/components/RoomUserResponse.java - - src/main/java/studio/livepeer/livepeer/models/components/RoomUserPayload.java - - src/main/java/studio/livepeer/livepeer/models/components/GetRoomUserResponse.java - - src/main/java/studio/livepeer/livepeer/models/components/RoomUserUpdatePayload.java - - src/main/java/studio/livepeer/livepeer/models/components/RealtimeViewershipMetric.java - - src/main/java/studio/livepeer/livepeer/models/components/ViewershipMetric.java - - src/main/java/studio/livepeer/livepeer/models/components/UsageMetric.java - - src/main/java/studio/livepeer/livepeer/models/components/SigningKey.java - - src/main/java/studio/livepeer/livepeer/models/components/TaskType.java - - src/main/java/studio/livepeer/livepeer/models/components/Upload.java - - src/main/java/studio/livepeer/livepeer/models/components/Content.java - - src/main/java/studio/livepeer/livepeer/models/components/TaskExportData.java - - src/main/java/studio/livepeer/livepeer/models/components/TaskInput.java - - src/main/java/studio/livepeer/livepeer/models/components/TaskStorage.java - - src/main/java/studio/livepeer/livepeer/models/components/TaskHls.java - - src/main/java/studio/livepeer/livepeer/models/components/TaskMp4.java - - src/main/java/studio/livepeer/livepeer/models/components/TaskOutputs.java - - src/main/java/studio/livepeer/livepeer/models/components/TranscodeFile.java - - src/main/java/studio/livepeer/livepeer/models/components/ClipStrategy.java - - src/main/java/studio/livepeer/livepeer/models/components/CatalystPipelineStrategy.java - - src/main/java/studio/livepeer/livepeer/models/components/Clip.java - - src/main/java/studio/livepeer/livepeer/models/components/Params.java - - src/main/java/studio/livepeer/livepeer/models/components/TaskPhase.java - - src/main/java/studio/livepeer/livepeer/models/components/TaskStatus.java - - src/main/java/studio/livepeer/livepeer/models/components/TaskIpfs.java - - src/main/java/studio/livepeer/livepeer/models/components/Export.java - - src/main/java/studio/livepeer/livepeer/models/components/TaskOutputIpfs.java - - src/main/java/studio/livepeer/livepeer/models/components/ExportData.java - - src/main/java/studio/livepeer/livepeer/models/components/Output.java - - src/main/java/studio/livepeer/livepeer/models/components/Task.java - - src/main/java/studio/livepeer/livepeer/models/components/Pinata2.java - - src/main/java/studio/livepeer/livepeer/models/components/Pinata1.java - - src/main/java/studio/livepeer/livepeer/models/components/Pinata.java - - src/main/java/studio/livepeer/livepeer/models/components/IpfsExportParams.java - - src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams2.java - - src/main/java/studio/livepeer/livepeer/models/components/Custom.java - - src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams1.java - - src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams.java - - src/main/java/studio/livepeer/livepeer/models/components/InputType.java - - src/main/java/studio/livepeer/livepeer/models/components/Credentials.java - - src/main/java/studio/livepeer/livepeer/models/components/Input2.java - - src/main/java/studio/livepeer/livepeer/models/components/Input1.java - - src/main/java/studio/livepeer/livepeer/models/components/Input.java - - src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorageType.java - - src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorageCredentials.java - - src/main/java/studio/livepeer/livepeer/models/components/Storage2.java - - src/main/java/studio/livepeer/livepeer/models/components/StorageType.java - - src/main/java/studio/livepeer/livepeer/models/components/StorageCredentials.java - - src/main/java/studio/livepeer/livepeer/models/components/Storage1.java - - src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorage.java - - src/main/java/studio/livepeer/livepeer/models/components/Hls.java - - src/main/java/studio/livepeer/livepeer/models/components/Mp4.java - - src/main/java/studio/livepeer/livepeer/models/components/Fmp4.java - - src/main/java/studio/livepeer/livepeer/models/components/Outputs.java - - src/main/java/studio/livepeer/livepeer/models/components/TranscodePayload.java - - src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoType.java - - src/main/java/studio/livepeer/livepeer/models/components/Live.java - - src/main/java/studio/livepeer/livepeer/models/components/Hrn.java - - src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoMetaType.java - - src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoSource.java - - src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoHrn.java - - src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoMetaDvrPlaybackType.java - - src/main/java/studio/livepeer/livepeer/models/components/DvrPlayback.java - - src/main/java/studio/livepeer/livepeer/models/components/Meta.java - - src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfo.java - - src/main/java/studio/livepeer/livepeer/models/components/PrimaryType.java - - src/main/java/studio/livepeer/livepeer/models/components/Name.java - - src/main/java/studio/livepeer/livepeer/models/components/Version.java - - src/main/java/studio/livepeer/livepeer/models/components/Domain.java - - src/main/java/studio/livepeer/livepeer/models/components/Attestations.java - - src/main/java/studio/livepeer/livepeer/models/components/Message.java - - src/main/java/studio/livepeer/livepeer/models/components/SignatureType.java - - src/main/java/studio/livepeer/livepeer/models/components/AttestationIpfs.java - - src/main/java/studio/livepeer/livepeer/models/components/AttestationStorage.java - - src/main/java/studio/livepeer/livepeer/models/components/Attestation.java - - src/main/java/studio/livepeer/livepeer/models/components/Security.java - - docs/models/operations/CreateStreamResponse.md - - docs/models/operations/GetStreamsRequest.md - - docs/models/operations/GetStreamsResponse.md - - docs/models/operations/GetStreamRequest.md - - docs/models/operations/GetStreamResponse.md - - docs/models/operations/UpdateStreamRequest.md - - docs/models/operations/UpdateStreamResponse.md - - docs/models/operations/DeleteStreamRequest.md - - docs/models/operations/DeleteStreamResponse.md - - docs/models/operations/TerminateStreamRequest.md - - docs/models/operations/TerminateStreamResponse.md - - docs/models/operations/StartPullStreamRequest.md - - docs/models/operations/StartPullStreamResponse.md - - docs/models/operations/CreateClipTask.md - - docs/models/operations/CreateClipData.md - - docs/models/operations/CreateClipResponse.md - - docs/models/operations/GetClipsRequest.md - - docs/models/operations/GetClipsResponse.md - - docs/models/operations/AddMultistreamTargetRequest.md - - docs/models/operations/AddMultistreamTargetResponse.md - - docs/models/operations/RemoveMultistreamTargetRequest.md - - docs/models/operations/RemoveMultistreamTargetResponse.md - - docs/models/operations/GetMultistreamTargetsResponse.md - - docs/models/operations/CreateMultistreamTargetResponse.md - - docs/models/operations/GetMultistreamTargetRequest.md - - docs/models/operations/GetMultistreamTargetResponse.md - - docs/models/operations/UpdateMultistreamTargetRequest.md - - docs/models/operations/UpdateMultistreamTargetResponse.md - - docs/models/operations/DeleteMultistreamTargetRequest.md - - docs/models/operations/DeleteMultistreamTargetResponse.md - - docs/models/operations/GetWebhooksResponse.md - - docs/models/operations/CreateWebhookResponse.md - - docs/models/operations/GetWebhookRequest.md - - docs/models/operations/GetWebhookResponse.md - - docs/models/operations/UpdateWebhookRequest.md - - docs/models/operations/UpdateWebhookResponse.md - - docs/models/operations/DeleteWebhookRequest.md - - docs/models/operations/DeleteWebhookResponse.md - - docs/models/operations/GetWebhookLogsRequest.md - - docs/models/operations/GetWebhookLogsResponse.md - - docs/models/operations/GetWebhookLogRequest.md - - docs/models/operations/GetWebhookLogResponse.md - - docs/models/operations/ResendWebhookRequest.md - - docs/models/operations/ResendWebhookResponse.md - - docs/models/operations/GetAssetsResponse.md - - docs/models/operations/Task.md - - docs/models/operations/RequestUploadData.md - - docs/models/operations/RequestUploadResponse.md - - docs/models/operations/UploadAssetAssetTask.md - - docs/models/operations/UploadAssetDataOutput.md - - docs/models/operations/UploadAssetTask.md - - docs/models/operations/UploadAssetData.md - - docs/models/operations/UploadAssetResponse.md - - docs/models/operations/GetAssetRequest.md - - docs/models/operations/GetAssetResponse.md - - docs/models/operations/UpdateAssetRequest.md - - docs/models/operations/UpdateAssetResponse.md - - docs/models/operations/DeleteAssetRequest.md - - docs/models/operations/DeleteAssetResponse.md - - docs/models/operations/GetSessionClipsRequest.md - - docs/models/operations/GetSessionClipsResponse.md - - docs/models/operations/GetSessionsResponse.md - - docs/models/operations/GetSessionRequest.md - - docs/models/operations/GetSessionResponse.md - - docs/models/operations/Record.md - - docs/models/operations/GetRecordedSessionsRequest.md - - docs/models/operations/GetRecordedSessionsResponse.md - - docs/models/operations/CreateRoomResponse.md - - docs/models/operations/GetRoomRequest.md - - docs/models/operations/GetRoomResponse.md - - docs/models/operations/DeleteRoomRequest.md - - docs/models/operations/DeleteRoomResponse.md - - docs/models/operations/StartRoomEgressRequest.md - - docs/models/operations/StartRoomEgressResponse.md - - docs/models/operations/StopRoomEgressRequest.md - - docs/models/operations/StopRoomEgressResponse.md - - docs/models/operations/CreateRoomUserRequest.md - - docs/models/operations/CreateRoomUserResponse.md - - docs/models/operations/GetRoomUserRequest.md - - docs/models/operations/GetRoomUserResponse.md - - docs/models/operations/UpdateRoomUserRequest.md - - docs/models/operations/UpdateRoomUserResponse.md - - docs/models/operations/DeleteRoomUserRequest.md - - docs/models/operations/DeleteRoomUserResponse.md - - docs/models/operations/BreakdownBy.md - - docs/models/operations/GetRealtimeViewershipNowRequest.md - - docs/models/operations/GetRealtimeViewershipNowResponse.md - - docs/models/operations/From.md - - docs/models/operations/To.md - - docs/models/operations/TimeStep.md - - docs/models/operations/QueryParamBreakdownBy.md - - docs/models/operations/GetViewershipMetricsRequest.md - - docs/models/operations/GetViewershipMetricsResponse.md - - docs/models/operations/QueryParamFrom.md - - docs/models/operations/QueryParamTo.md - - docs/models/operations/QueryParamTimeStep.md - - docs/models/operations/GetCreatorViewershipMetricsQueryParamBreakdownBy.md - - docs/models/operations/GetCreatorViewershipMetricsRequest.md - - docs/models/operations/GetCreatorViewershipMetricsResponse.md - - docs/models/operations/GetPublicViewershipMetricsRequest.md - - docs/models/operations/GetPublicViewershipMetricsData.md - - docs/models/operations/GetPublicViewershipMetricsResponse.md - - docs/models/operations/GetUsageMetricsQueryParamTimeStep.md - - docs/models/operations/GetUsageMetricsQueryParamBreakdownBy.md - - docs/models/operations/GetUsageMetricsRequest.md - - docs/models/operations/GetUsageMetricsResponse.md - - docs/models/operations/CreateSigningKeyResponse.md - - docs/models/operations/GetSigningKeysResponse.md - - docs/models/operations/DeleteSigningKeyRequest.md - - docs/models/operations/DeleteSigningKeyResponse.md - - docs/models/operations/GetSigningKeyRequest.md - - docs/models/operations/GetSigningKeyResponse.md - - docs/models/operations/UpdateSigningKeyRequestBody.md - - docs/models/operations/UpdateSigningKeyRequest.md - - docs/models/operations/UpdateSigningKeyResponse.md - - docs/models/operations/GetTasksResponse.md - - docs/models/operations/GetTaskRequest.md - - docs/models/operations/GetTaskResponse.md - - docs/models/operations/TranscodeVideoResponse.md - - docs/models/operations/GetPlaybackInfoRequest.md - - docs/models/operations/GetPlaybackInfoResponse.md - - docs/models/errors/Error.md - - docs/models/components/Three.md - - docs/models/components/StreamUserTags.md - - docs/models/components/IsMobile1.md - - docs/models/components/StreamIsMobile.md - - docs/models/components/StreamLocation.md - - docs/models/components/StreamPull.md - - docs/models/components/StreamRecordingSpec.md - - docs/models/components/StreamMultistream.md - - docs/models/components/Renditions.md - - docs/models/components/Stream.md - - docs/models/components/TargetOutput.md - - docs/models/components/TranscodeProfileProfile.md - - docs/models/components/TranscodeProfileEncoder.md - - docs/models/components/TranscodeProfile.md - - docs/models/components/Profile.md + - docs/models/components/Asset.md + - docs/models/components/AssetIpfs.md + - docs/models/components/AssetNftMetadata.md + - docs/models/components/AssetNftMetadataTemplate.md + - docs/models/components/AssetPatchPayload.md + - docs/models/components/AssetPhase.md + - docs/models/components/AssetSource3Type.md + - docs/models/components/AssetSourceType.md + - docs/models/components/AssetSpec.md + - docs/models/components/AssetStatus.md + - docs/models/components/AssetStorage.md + - docs/models/components/AssetType.md + - docs/models/components/AssetVideoSpecType.md + - docs/models/components/Attestation.md + - docs/models/components/AttestationIpfs.md + - docs/models/components/AttestationStorage.md + - docs/models/components/Attestations.md + - docs/models/components/CatalystPipelineStrategy.md + - docs/models/components/Clip.md + - docs/models/components/ClipPayload.md + - docs/models/components/ClipStrategy.md + - docs/models/components/Content.md + - docs/models/components/CreateRoomResponse.md + - docs/models/components/CreatorId.md + - docs/models/components/CreatorId1.md + - docs/models/components/CreatorIdType.md + - docs/models/components/Credentials.md + - docs/models/components/Custom.md + - 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 + - docs/models/components/ExportTaskParams.md + - docs/models/components/ExportTaskParams1.md + - docs/models/components/ExportTaskParams2.md - docs/models/components/FfmpegProfile.md - - docs/models/components/Type.md - - docs/models/components/PlaybackPolicy.md - - docs/models/components/CreatorIdType.md - - docs/models/components/CreatorId1.md - - docs/models/components/CreatorId.md - - docs/models/components/NewStreamPayloadRecordingSpec.md - - docs/models/components/NewStreamPayload.md - - docs/models/components/UserTags3.md - - docs/models/components/UserTags.md - - docs/models/components/Multistream.md - - docs/models/components/TargetSpec.md - - docs/models/components/InputCreatorIdType.md - - docs/models/components/InputCreatorId1.md + - docs/models/components/Fmp4.md + - docs/models/components/GetRoomUserResponse.md + - docs/models/components/Hash.md + - docs/models/components/Hls.md + - docs/models/components/Hrn.md + - docs/models/components/Input.md + - docs/models/components/Input1.md + - docs/models/components/Input2.md - docs/models/components/InputCreatorId.md - - docs/models/components/One.md + - docs/models/components/InputCreatorId1.md + - docs/models/components/InputCreatorIdType.md + - docs/models/components/InputType.md + - docs/models/components/Ipfs.md + - docs/models/components/Ipfs1.md + - docs/models/components/IpfsExportParams.md + - docs/models/components/IpfsFileInfo.md - docs/models/components/IsMobile.md + - docs/models/components/IsMobile1.md + - docs/models/components/LastFailure.md + - docs/models/components/Live.md - docs/models/components/Location.md - - docs/models/components/Pull.md - - docs/models/components/StreamPatchPayload.md - - docs/models/components/RecordingSpec.md - - docs/models/components/AssetType.md - - docs/models/components/AssetSource3Type.md - - docs/models/components/Source3.md - - docs/models/components/AssetSourceType.md - - docs/models/components/Two.md - - docs/models/components/SourceType.md - - docs/models/components/Source1.md - - docs/models/components/Source.md - - docs/models/components/AssetNftMetadataTemplate.md - - docs/models/components/AssetNftMetadata.md - - docs/models/components/AssetSpec.md - - docs/models/components/AssetIpfs.md - - docs/models/components/AssetStorage.md - - docs/models/components/AssetPhase.md - - docs/models/components/AssetStatus.md - - docs/models/components/Hash.md - - docs/models/components/AssetVideoSpecType.md - - docs/models/components/Tracks.md - - docs/models/components/VideoSpec.md - - docs/models/components/Asset.md - - docs/models/components/Phase.md - - docs/models/components/Tasks.md - - docs/models/components/StorageStatus.md - - docs/models/components/IpfsFileInfo.md - - docs/models/components/EncryptionOutput.md - - docs/models/components/ClipPayload.md - - docs/models/components/TargetAddPayloadSpec.md - - docs/models/components/TargetAddPayload.md + - docs/models/components/Message.md + - docs/models/components/Meta.md + - docs/models/components/Mp4.md + - docs/models/components/Multistream.md - docs/models/components/MultistreamTarget.md - - docs/models/components/MultistreamTargetPatchPayload.md - - docs/models/components/Events.md - - docs/models/components/LastFailure.md - - docs/models/components/Status.md - - docs/models/components/Webhook.md - - docs/models/components/Request.md - - docs/models/components/Response.md - - docs/models/components/WebhookLog.md - - docs/models/components/NewAssetPayloadIpfs1.md + - docs/models/components/MultistreamTargetInput.md + - docs/models/components/Name.md + - docs/models/components/NewAssetFromUrlPayload.md + - docs/models/components/NewAssetPayload.md + - docs/models/components/NewAssetPayloadEncryption.md - docs/models/components/NewAssetPayloadIpfs.md + - docs/models/components/NewAssetPayloadIpfs1.md - docs/models/components/NewAssetPayloadStorage.md - - docs/models/components/NewAssetPayloadEncryption.md - - docs/models/components/NewAssetPayload.md - - docs/models/components/NftMetadataTemplate.md + - docs/models/components/NewStreamPayload.md + - docs/models/components/NewStreamPayloadRecordingSpec.md - docs/models/components/NftMetadata.md - - docs/models/components/Spec.md - - docs/models/components/NewAssetFromUrlPayload.md - - docs/models/components/Ipfs1.md - - docs/models/components/Ipfs.md - - docs/models/components/Storage.md - - docs/models/components/AssetPatchPayload.md - - docs/models/components/RecordingStatus.md - - docs/models/components/Session.md - - docs/models/components/CreateRoomResponse.md + - docs/models/components/NftMetadataTemplate.md + - docs/models/components/One.md + - docs/models/components/Output.md + - docs/models/components/Outputs.md + - docs/models/components/Params.md - docs/models/components/Participants.md + - docs/models/components/Phase.md + - docs/models/components/Pinata.md + - docs/models/components/Pinata1.md + - docs/models/components/Pinata2.md + - docs/models/components/PlaybackInfo.md + - docs/models/components/PlaybackInfoHrn.md + - docs/models/components/PlaybackInfoMetaDvrPlaybackType.md + - docs/models/components/PlaybackInfoMetaType.md + - docs/models/components/PlaybackInfoSource.md + - docs/models/components/PlaybackInfoType.md + - docs/models/components/PlaybackPolicy.md + - docs/models/components/PrimaryType.md + - docs/models/components/Profile.md + - docs/models/components/Pull.md + - docs/models/components/RealtimeViewershipMetric.md + - docs/models/components/RecordingSpec.md + - docs/models/components/RecordingStatus.md + - docs/models/components/Renditions.md + - docs/models/components/Request.md + - docs/models/components/Response.md - docs/models/components/Room.md - docs/models/components/RoomEgressPayload.md - - docs/models/components/RoomUserResponse.md - docs/models/components/RoomUserPayload.md - - docs/models/components/GetRoomUserResponse.md + - docs/models/components/RoomUserResponse.md - docs/models/components/RoomUserUpdatePayload.md - - docs/models/components/RealtimeViewershipMetric.md - - docs/models/components/ViewershipMetric.md - - docs/models/components/UsageMetric.md + - docs/models/components/Security.md + - docs/models/components/Session.md + - docs/models/components/SignatureType.md - docs/models/components/SigningKey.md - - docs/models/components/TaskType.md - - docs/models/components/Upload.md - - docs/models/components/Content.md + - docs/models/components/Source.md + - docs/models/components/Source1.md + - docs/models/components/Source3.md + - docs/models/components/SourceType.md + - docs/models/components/Spec.md + - docs/models/components/Status.md + - docs/models/components/Storage.md + - docs/models/components/Storage1.md + - docs/models/components/Storage2.md + - docs/models/components/StorageCredentials.md + - docs/models/components/StorageStatus.md + - docs/models/components/StorageType.md + - docs/models/components/Stream.md + - docs/models/components/StreamIsMobile.md + - docs/models/components/StreamLocation.md + - docs/models/components/StreamMultistream.md + - docs/models/components/StreamPatchPayload.md + - docs/models/components/StreamPull.md + - docs/models/components/StreamRecordingSpec.md + - docs/models/components/StreamUserTags.md + - docs/models/components/Target.md + - docs/models/components/TargetAddPayload.md + - docs/models/components/TargetAddPayloadSpec.md + - docs/models/components/TargetOutput.md + - docs/models/components/TargetSpec.md + - docs/models/components/Task.md - docs/models/components/TaskExportData.md - - docs/models/components/TaskInput.md - - docs/models/components/TaskStorage.md - docs/models/components/TaskHls.md + - docs/models/components/TaskInput.md + - docs/models/components/TaskIpfs.md - docs/models/components/TaskMp4.md + - docs/models/components/TaskOutputIpfs.md - docs/models/components/TaskOutputs.md - - docs/models/components/TranscodeFile.md - - docs/models/components/ClipStrategy.md - - docs/models/components/CatalystPipelineStrategy.md - - docs/models/components/Clip.md - - docs/models/components/Params.md - docs/models/components/TaskPhase.md - docs/models/components/TaskStatus.md - - docs/models/components/TaskIpfs.md - - docs/models/components/Export.md - - docs/models/components/TaskOutputIpfs.md - - docs/models/components/ExportData.md - - docs/models/components/Output.md - - docs/models/components/Task.md - - docs/models/components/Pinata2.md - - docs/models/components/Pinata1.md - - docs/models/components/Pinata.md - - docs/models/components/IpfsExportParams.md - - docs/models/components/ExportTaskParams2.md - - docs/models/components/Custom.md - - docs/models/components/ExportTaskParams1.md - - docs/models/components/ExportTaskParams.md - - docs/models/components/InputType.md - - docs/models/components/Credentials.md - - docs/models/components/Input2.md - - docs/models/components/Input1.md - - docs/models/components/Input.md - - docs/models/components/TranscodePayloadStorageType.md - - docs/models/components/TranscodePayloadStorageCredentials.md - - docs/models/components/Storage2.md - - docs/models/components/StorageType.md - - docs/models/components/StorageCredentials.md - - docs/models/components/Storage1.md - - docs/models/components/TranscodePayloadStorage.md - - docs/models/components/Hls.md - - docs/models/components/Mp4.md - - docs/models/components/Fmp4.md - - docs/models/components/Outputs.md + - docs/models/components/TaskStorage.md + - docs/models/components/TaskType.md + - docs/models/components/TaskUpload.md + - docs/models/components/Tasks.md + - docs/models/components/Three.md + - docs/models/components/Tracks.md + - docs/models/components/TranscodeFile.md - docs/models/components/TranscodePayload.md - - docs/models/components/PlaybackInfoType.md - - docs/models/components/Live.md - - docs/models/components/Hrn.md - - docs/models/components/PlaybackInfoMetaType.md - - docs/models/components/PlaybackInfoSource.md - - docs/models/components/PlaybackInfoHrn.md - - docs/models/components/PlaybackInfoMetaDvrPlaybackType.md - - docs/models/components/DvrPlayback.md - - docs/models/components/Meta.md - - docs/models/components/PlaybackInfo.md - - docs/models/components/PrimaryType.md - - docs/models/components/Name.md + - docs/models/components/TranscodePayloadStorage.md + - docs/models/components/TranscodePayloadStorageCredentials.md + - docs/models/components/TranscodePayloadStorageType.md + - docs/models/components/TranscodeProfile.md + - docs/models/components/TranscodeProfileEncoder.md + - docs/models/components/TranscodeProfileProfile.md + - docs/models/components/Two.md + - docs/models/components/Type.md + - docs/models/components/Upload.md + - docs/models/components/UsageMetric.md + - docs/models/components/UserTags.md + - docs/models/components/UserTags3.md - docs/models/components/Version.md - - docs/models/components/Domain.md - - docs/models/components/Attestations.md - - docs/models/components/Message.md - - docs/models/components/SignatureType.md - - docs/models/components/AttestationIpfs.md - - docs/models/components/AttestationStorage.md - - docs/models/components/Attestation.md - - docs/models/components/Security.md - - docs/sdks/livepeer/README.md - - docs/sdks/stream/README.md - - docs/sdks/multistream/README.md - - docs/sdks/webhook/README.md + - 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/errors/Error.md + - docs/models/operations/AddMultistreamTargetRequest.md + - docs/models/operations/AddMultistreamTargetResponse.md + - docs/models/operations/BreakdownBy.md + - docs/models/operations/CreateClipData.md + - docs/models/operations/CreateClipResponse.md + - docs/models/operations/CreateClipTask.md + - docs/models/operations/CreateMultistreamTargetResponse.md + - docs/models/operations/CreateRoomResponse.md + - docs/models/operations/CreateRoomUserRequest.md + - docs/models/operations/CreateRoomUserResponse.md + - docs/models/operations/CreateSigningKeyResponse.md + - docs/models/operations/CreateStreamResponse.md + - docs/models/operations/CreateWebhookResponse.md + - docs/models/operations/DeleteAssetRequest.md + - docs/models/operations/DeleteAssetResponse.md + - docs/models/operations/DeleteMultistreamTargetRequest.md + - docs/models/operations/DeleteMultistreamTargetResponse.md + - docs/models/operations/DeleteRoomRequest.md + - docs/models/operations/DeleteRoomResponse.md + - docs/models/operations/DeleteRoomUserRequest.md + - docs/models/operations/DeleteRoomUserResponse.md + - docs/models/operations/DeleteSigningKeyRequest.md + - docs/models/operations/DeleteSigningKeyResponse.md + - docs/models/operations/DeleteStreamRequest.md + - docs/models/operations/DeleteStreamResponse.md + - docs/models/operations/DeleteWebhookRequest.md + - docs/models/operations/DeleteWebhookResponse.md + - docs/models/operations/From.md + - docs/models/operations/GetAssetRequest.md + - docs/models/operations/GetAssetResponse.md + - docs/models/operations/GetAssetsResponse.md + - docs/models/operations/GetClipsRequest.md + - docs/models/operations/GetClipsResponse.md + - docs/models/operations/GetCreatorViewershipMetricsQueryParamBreakdownBy.md + - docs/models/operations/GetCreatorViewershipMetricsRequest.md + - docs/models/operations/GetCreatorViewershipMetricsResponse.md + - docs/models/operations/GetMultistreamTargetRequest.md + - docs/models/operations/GetMultistreamTargetResponse.md + - docs/models/operations/GetMultistreamTargetsResponse.md + - docs/models/operations/GetPlaybackInfoRequest.md + - docs/models/operations/GetPlaybackInfoResponse.md + - docs/models/operations/GetPublicViewershipMetricsData.md + - docs/models/operations/GetPublicViewershipMetricsRequest.md + - docs/models/operations/GetPublicViewershipMetricsResponse.md + - docs/models/operations/GetRealtimeViewershipNowRequest.md + - docs/models/operations/GetRealtimeViewershipNowResponse.md + - docs/models/operations/GetRecordedSessionsRequest.md + - docs/models/operations/GetRecordedSessionsResponse.md + - docs/models/operations/GetRoomRequest.md + - docs/models/operations/GetRoomResponse.md + - docs/models/operations/GetRoomUserRequest.md + - docs/models/operations/GetRoomUserResponse.md + - docs/models/operations/GetSessionClipsRequest.md + - docs/models/operations/GetSessionClipsResponse.md + - docs/models/operations/GetSessionRequest.md + - docs/models/operations/GetSessionResponse.md + - docs/models/operations/GetSessionsResponse.md + - docs/models/operations/GetSigningKeyRequest.md + - docs/models/operations/GetSigningKeyResponse.md + - docs/models/operations/GetSigningKeysResponse.md + - docs/models/operations/GetStreamRequest.md + - docs/models/operations/GetStreamResponse.md + - docs/models/operations/GetStreamsRequest.md + - docs/models/operations/GetStreamsResponse.md + - docs/models/operations/GetTaskRequest.md + - docs/models/operations/GetTaskResponse.md + - docs/models/operations/GetTasksResponse.md + - docs/models/operations/GetUsageMetricsQueryParamBreakdownBy.md + - docs/models/operations/GetUsageMetricsQueryParamTimeStep.md + - docs/models/operations/GetUsageMetricsRequest.md + - docs/models/operations/GetUsageMetricsResponse.md + - docs/models/operations/GetViewershipMetricsRequest.md + - docs/models/operations/GetViewershipMetricsResponse.md + - docs/models/operations/GetWebhookLogRequest.md + - docs/models/operations/GetWebhookLogResponse.md + - docs/models/operations/GetWebhookLogsRequest.md + - docs/models/operations/GetWebhookLogsResponse.md + - docs/models/operations/GetWebhookRequest.md + - docs/models/operations/GetWebhookResponse.md + - docs/models/operations/GetWebhooksResponse.md + - docs/models/operations/QueryParamBreakdownBy.md + - docs/models/operations/QueryParamFrom.md + - docs/models/operations/QueryParamTimeStep.md + - docs/models/operations/QueryParamTo.md + - docs/models/operations/Record.md + - docs/models/operations/RemoveMultistreamTargetRequest.md + - docs/models/operations/RemoveMultistreamTargetResponse.md + - docs/models/operations/RequestUploadData.md + - docs/models/operations/RequestUploadResponse.md + - docs/models/operations/ResendWebhookRequest.md + - docs/models/operations/ResendWebhookResponse.md + - docs/models/operations/StartPullStreamRequest.md + - docs/models/operations/StartPullStreamResponse.md + - docs/models/operations/StartRoomEgressRequest.md + - docs/models/operations/StartRoomEgressResponse.md + - docs/models/operations/StopRoomEgressRequest.md + - docs/models/operations/StopRoomEgressResponse.md + - docs/models/operations/Task.md + - docs/models/operations/TerminateStreamRequest.md + - docs/models/operations/TerminateStreamResponse.md + - docs/models/operations/TimeStep.md + - docs/models/operations/To.md + - docs/models/operations/TranscodeVideoResponse.md + - docs/models/operations/UpdateAssetRequest.md + - docs/models/operations/UpdateAssetResponse.md + - docs/models/operations/UpdateMultistreamTargetRequest.md + - docs/models/operations/UpdateMultistreamTargetResponse.md + - docs/models/operations/UpdateRoomUserRequest.md + - docs/models/operations/UpdateRoomUserResponse.md + - docs/models/operations/UpdateSigningKeyRequest.md + - docs/models/operations/UpdateSigningKeyRequestBody.md + - docs/models/operations/UpdateSigningKeyResponse.md + - docs/models/operations/UpdateStreamRequest.md + - docs/models/operations/UpdateStreamResponse.md + - docs/models/operations/UpdateWebhookRequest.md + - docs/models/operations/UpdateWebhookResponse.md + - docs/models/operations/UploadAssetAssetTask.md + - docs/models/operations/UploadAssetData.md + - docs/models/operations/UploadAssetDataOutput.md + - docs/models/operations/UploadAssetResponse.md + - docs/models/operations/UploadAssetTask.md + - docs/sdks/accesscontrol/README.md - docs/sdks/asset/README.md - - docs/sdks/session/README.md - - docs/sdks/room/README.md - docs/sdks/metrics/README.md - - docs/sdks/accesscontrol/README.md + - docs/sdks/multistream/README.md + - docs/sdks/playback/README.md + - docs/sdks/room/README.md + - docs/sdks/session/README.md + - docs/sdks/stream/README.md - docs/sdks/task/README.md - docs/sdks/transcode/README.md - - docs/sdks/playback/README.md - - USAGE.md - - CONTRIBUTING.md + - docs/sdks/webhook/README.md + - docs/utils/Blob.md + - gradle.properties + - gradle/wrapper/gradle-wrapper.jar + - gradle/wrapper/gradle-wrapper.properties + - gradlew + - gradlew.bat + - publishing.gradle + - settings.gradle + - spring/openapi-spring-boot-autoconfigure/build.gradle + - spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/ConditionalOnPropertyPrefix.java + - spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/OnPropertyPrefixCondition.java + - spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/OpenapiAutoConfig.java + - spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/OpenapiAutoConfigProperties.java + - spring/openapi-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports + - spring/openapi-spring-boot-starter/build.gradle + - src/main/java/studio/livepeer/livepeer/AccessControl.java + - src/main/java/studio/livepeer/livepeer/Asset.java + - src/main/java/studio/livepeer/livepeer/AsyncAccessControl.java + - src/main/java/studio/livepeer/livepeer/AsyncAsset.java + - src/main/java/studio/livepeer/livepeer/AsyncLivepeer.java + - src/main/java/studio/livepeer/livepeer/AsyncMetrics.java + - src/main/java/studio/livepeer/livepeer/AsyncMultistream.java + - src/main/java/studio/livepeer/livepeer/AsyncPlayback.java + - src/main/java/studio/livepeer/livepeer/AsyncRoom.java + - src/main/java/studio/livepeer/livepeer/AsyncSession.java + - src/main/java/studio/livepeer/livepeer/AsyncStream.java + - src/main/java/studio/livepeer/livepeer/AsyncTask.java + - src/main/java/studio/livepeer/livepeer/AsyncTranscode.java + - src/main/java/studio/livepeer/livepeer/AsyncWebhook.java + - src/main/java/studio/livepeer/livepeer/Livepeer.java + - src/main/java/studio/livepeer/livepeer/Metrics.java + - src/main/java/studio/livepeer/livepeer/Multistream.java + - src/main/java/studio/livepeer/livepeer/Playback.java + - src/main/java/studio/livepeer/livepeer/Room.java + - src/main/java/studio/livepeer/livepeer/SDKConfiguration.java + - src/main/java/studio/livepeer/livepeer/SecuritySource.java + - src/main/java/studio/livepeer/livepeer/Session.java + - src/main/java/studio/livepeer/livepeer/Stream.java + - src/main/java/studio/livepeer/livepeer/Task.java + - src/main/java/studio/livepeer/livepeer/Transcode.java + - src/main/java/studio/livepeer/livepeer/Webhook.java + - src/main/java/studio/livepeer/livepeer/models/components/Asset.java + - src/main/java/studio/livepeer/livepeer/models/components/AssetIpfs.java + - src/main/java/studio/livepeer/livepeer/models/components/AssetNftMetadata.java + - src/main/java/studio/livepeer/livepeer/models/components/AssetNftMetadataTemplate.java + - src/main/java/studio/livepeer/livepeer/models/components/AssetPatchPayload.java + - src/main/java/studio/livepeer/livepeer/models/components/AssetPhase.java + - src/main/java/studio/livepeer/livepeer/models/components/AssetSource3Type.java + - src/main/java/studio/livepeer/livepeer/models/components/AssetSourceType.java + - src/main/java/studio/livepeer/livepeer/models/components/AssetSpec.java + - src/main/java/studio/livepeer/livepeer/models/components/AssetStatus.java + - src/main/java/studio/livepeer/livepeer/models/components/AssetStorage.java + - src/main/java/studio/livepeer/livepeer/models/components/AssetType.java + - src/main/java/studio/livepeer/livepeer/models/components/AssetVideoSpecType.java + - src/main/java/studio/livepeer/livepeer/models/components/Attestation.java + - src/main/java/studio/livepeer/livepeer/models/components/AttestationIpfs.java + - src/main/java/studio/livepeer/livepeer/models/components/AttestationStorage.java + - src/main/java/studio/livepeer/livepeer/models/components/Attestations.java + - src/main/java/studio/livepeer/livepeer/models/components/CatalystPipelineStrategy.java + - src/main/java/studio/livepeer/livepeer/models/components/Clip.java + - src/main/java/studio/livepeer/livepeer/models/components/ClipPayload.java + - src/main/java/studio/livepeer/livepeer/models/components/ClipStrategy.java + - src/main/java/studio/livepeer/livepeer/models/components/Content.java + - src/main/java/studio/livepeer/livepeer/models/components/CreateRoomResponse.java + - src/main/java/studio/livepeer/livepeer/models/components/CreatorId.java + - src/main/java/studio/livepeer/livepeer/models/components/CreatorId1.java + - src/main/java/studio/livepeer/livepeer/models/components/CreatorIdType.java + - src/main/java/studio/livepeer/livepeer/models/components/Credentials.java + - src/main/java/studio/livepeer/livepeer/models/components/Custom.java + - src/main/java/studio/livepeer/livepeer/models/components/Domain.java + - src/main/java/studio/livepeer/livepeer/models/components/DvrPlayback.java + - src/main/java/studio/livepeer/livepeer/models/components/Encoder.java + - src/main/java/studio/livepeer/livepeer/models/components/Encryption.java + - src/main/java/studio/livepeer/livepeer/models/components/EncryptionOutput.java + - src/main/java/studio/livepeer/livepeer/models/components/Error.java + - src/main/java/studio/livepeer/livepeer/models/components/Events.java + - src/main/java/studio/livepeer/livepeer/models/components/Export.java + - src/main/java/studio/livepeer/livepeer/models/components/ExportData.java + - src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams.java + - src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams1.java + - src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams2.java + - src/main/java/studio/livepeer/livepeer/models/components/FfmpegProfile.java + - src/main/java/studio/livepeer/livepeer/models/components/Fmp4.java + - src/main/java/studio/livepeer/livepeer/models/components/GetRoomUserResponse.java + - src/main/java/studio/livepeer/livepeer/models/components/Hash.java + - src/main/java/studio/livepeer/livepeer/models/components/Hls.java + - src/main/java/studio/livepeer/livepeer/models/components/Hrn.java + - src/main/java/studio/livepeer/livepeer/models/components/Input.java + - src/main/java/studio/livepeer/livepeer/models/components/Input1.java + - src/main/java/studio/livepeer/livepeer/models/components/Input2.java + - src/main/java/studio/livepeer/livepeer/models/components/InputCreatorId.java + - src/main/java/studio/livepeer/livepeer/models/components/InputCreatorId1.java + - src/main/java/studio/livepeer/livepeer/models/components/InputCreatorIdType.java + - src/main/java/studio/livepeer/livepeer/models/components/InputType.java + - src/main/java/studio/livepeer/livepeer/models/components/Ipfs.java + - src/main/java/studio/livepeer/livepeer/models/components/Ipfs1.java + - src/main/java/studio/livepeer/livepeer/models/components/IpfsExportParams.java + - src/main/java/studio/livepeer/livepeer/models/components/IpfsFileInfo.java + - src/main/java/studio/livepeer/livepeer/models/components/IsMobile.java + - src/main/java/studio/livepeer/livepeer/models/components/IsMobile1.java + - src/main/java/studio/livepeer/livepeer/models/components/LastFailure.java + - src/main/java/studio/livepeer/livepeer/models/components/Live.java + - src/main/java/studio/livepeer/livepeer/models/components/Location.java + - src/main/java/studio/livepeer/livepeer/models/components/Message.java + - src/main/java/studio/livepeer/livepeer/models/components/Meta.java + - src/main/java/studio/livepeer/livepeer/models/components/Mp4.java + - src/main/java/studio/livepeer/livepeer/models/components/Multistream.java + - src/main/java/studio/livepeer/livepeer/models/components/MultistreamTarget.java + - src/main/java/studio/livepeer/livepeer/models/components/MultistreamTargetInput.java + - src/main/java/studio/livepeer/livepeer/models/components/Name.java + - src/main/java/studio/livepeer/livepeer/models/components/NewAssetFromUrlPayload.java + - src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayload.java + - src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadEncryption.java + - src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadIpfs.java + - src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadIpfs1.java + - src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadStorage.java + - src/main/java/studio/livepeer/livepeer/models/components/NewStreamPayload.java + - src/main/java/studio/livepeer/livepeer/models/components/NewStreamPayloadRecordingSpec.java + - src/main/java/studio/livepeer/livepeer/models/components/NftMetadata.java + - src/main/java/studio/livepeer/livepeer/models/components/NftMetadataTemplate.java + - src/main/java/studio/livepeer/livepeer/models/components/One.java + - src/main/java/studio/livepeer/livepeer/models/components/Output.java + - src/main/java/studio/livepeer/livepeer/models/components/Outputs.java + - src/main/java/studio/livepeer/livepeer/models/components/Params.java + - src/main/java/studio/livepeer/livepeer/models/components/Participants.java + - src/main/java/studio/livepeer/livepeer/models/components/Phase.java + - src/main/java/studio/livepeer/livepeer/models/components/Pinata.java + - src/main/java/studio/livepeer/livepeer/models/components/Pinata1.java + - src/main/java/studio/livepeer/livepeer/models/components/Pinata2.java + - src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfo.java + - src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoHrn.java + - src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoMetaDvrPlaybackType.java + - src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoMetaType.java + - src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoSource.java + - src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoType.java + - src/main/java/studio/livepeer/livepeer/models/components/PlaybackPolicy.java + - src/main/java/studio/livepeer/livepeer/models/components/PrimaryType.java + - src/main/java/studio/livepeer/livepeer/models/components/Profile.java + - src/main/java/studio/livepeer/livepeer/models/components/Pull.java + - src/main/java/studio/livepeer/livepeer/models/components/RealtimeViewershipMetric.java + - src/main/java/studio/livepeer/livepeer/models/components/RecordingSpec.java + - src/main/java/studio/livepeer/livepeer/models/components/RecordingStatus.java + - src/main/java/studio/livepeer/livepeer/models/components/Renditions.java + - src/main/java/studio/livepeer/livepeer/models/components/Request.java + - src/main/java/studio/livepeer/livepeer/models/components/Response.java + - src/main/java/studio/livepeer/livepeer/models/components/Room.java + - src/main/java/studio/livepeer/livepeer/models/components/RoomEgressPayload.java + - src/main/java/studio/livepeer/livepeer/models/components/RoomUserPayload.java + - src/main/java/studio/livepeer/livepeer/models/components/RoomUserResponse.java + - src/main/java/studio/livepeer/livepeer/models/components/RoomUserUpdatePayload.java + - src/main/java/studio/livepeer/livepeer/models/components/Security.java + - src/main/java/studio/livepeer/livepeer/models/components/Session.java + - src/main/java/studio/livepeer/livepeer/models/components/SignatureType.java + - src/main/java/studio/livepeer/livepeer/models/components/SigningKey.java + - src/main/java/studio/livepeer/livepeer/models/components/Source.java + - src/main/java/studio/livepeer/livepeer/models/components/Source1.java + - src/main/java/studio/livepeer/livepeer/models/components/Source3.java + - src/main/java/studio/livepeer/livepeer/models/components/SourceType.java + - src/main/java/studio/livepeer/livepeer/models/components/Spec.java + - src/main/java/studio/livepeer/livepeer/models/components/Status.java + - src/main/java/studio/livepeer/livepeer/models/components/Storage.java + - src/main/java/studio/livepeer/livepeer/models/components/Storage1.java + - src/main/java/studio/livepeer/livepeer/models/components/Storage2.java + - src/main/java/studio/livepeer/livepeer/models/components/StorageCredentials.java + - src/main/java/studio/livepeer/livepeer/models/components/StorageStatus.java + - src/main/java/studio/livepeer/livepeer/models/components/StorageType.java + - src/main/java/studio/livepeer/livepeer/models/components/Stream.java + - src/main/java/studio/livepeer/livepeer/models/components/StreamIsMobile.java + - src/main/java/studio/livepeer/livepeer/models/components/StreamLocation.java + - src/main/java/studio/livepeer/livepeer/models/components/StreamMultistream.java + - src/main/java/studio/livepeer/livepeer/models/components/StreamPatchPayload.java + - src/main/java/studio/livepeer/livepeer/models/components/StreamPull.java + - src/main/java/studio/livepeer/livepeer/models/components/StreamRecordingSpec.java + - src/main/java/studio/livepeer/livepeer/models/components/StreamUserTags.java + - src/main/java/studio/livepeer/livepeer/models/components/Target.java + - src/main/java/studio/livepeer/livepeer/models/components/TargetAddPayload.java + - src/main/java/studio/livepeer/livepeer/models/components/TargetAddPayloadSpec.java + - src/main/java/studio/livepeer/livepeer/models/components/TargetOutput.java + - src/main/java/studio/livepeer/livepeer/models/components/TargetSpec.java + - src/main/java/studio/livepeer/livepeer/models/components/Task.java + - src/main/java/studio/livepeer/livepeer/models/components/TaskExportData.java + - src/main/java/studio/livepeer/livepeer/models/components/TaskHls.java + - src/main/java/studio/livepeer/livepeer/models/components/TaskInput.java + - src/main/java/studio/livepeer/livepeer/models/components/TaskIpfs.java + - src/main/java/studio/livepeer/livepeer/models/components/TaskMp4.java + - src/main/java/studio/livepeer/livepeer/models/components/TaskOutputIpfs.java + - src/main/java/studio/livepeer/livepeer/models/components/TaskOutputs.java + - src/main/java/studio/livepeer/livepeer/models/components/TaskPhase.java + - src/main/java/studio/livepeer/livepeer/models/components/TaskStatus.java + - src/main/java/studio/livepeer/livepeer/models/components/TaskStorage.java + - src/main/java/studio/livepeer/livepeer/models/components/TaskType.java + - src/main/java/studio/livepeer/livepeer/models/components/TaskUpload.java + - src/main/java/studio/livepeer/livepeer/models/components/Tasks.java + - src/main/java/studio/livepeer/livepeer/models/components/Three.java + - src/main/java/studio/livepeer/livepeer/models/components/Tracks.java + - src/main/java/studio/livepeer/livepeer/models/components/TranscodeFile.java + - src/main/java/studio/livepeer/livepeer/models/components/TranscodePayload.java + - src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorage.java + - src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorageCredentials.java + - src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorageType.java + - src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfile.java + - src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfileEncoder.java + - src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfileProfile.java + - src/main/java/studio/livepeer/livepeer/models/components/Two.java + - src/main/java/studio/livepeer/livepeer/models/components/Type.java + - src/main/java/studio/livepeer/livepeer/models/components/Upload.java + - src/main/java/studio/livepeer/livepeer/models/components/UsageMetric.java + - src/main/java/studio/livepeer/livepeer/models/components/UserTags.java + - src/main/java/studio/livepeer/livepeer/models/components/UserTags3.java + - src/main/java/studio/livepeer/livepeer/models/components/Version.java + - src/main/java/studio/livepeer/livepeer/models/components/VideoSpec.java + - src/main/java/studio/livepeer/livepeer/models/components/ViewershipMetric.java + - src/main/java/studio/livepeer/livepeer/models/components/Webhook.java + - src/main/java/studio/livepeer/livepeer/models/components/WebhookInput.java + - src/main/java/studio/livepeer/livepeer/models/components/WebhookLog.java + - src/main/java/studio/livepeer/livepeer/models/errors/AsyncSDKException.java + - src/main/java/studio/livepeer/livepeer/models/errors/AuthException.java + - src/main/java/studio/livepeer/livepeer/models/errors/Error.java + - src/main/java/studio/livepeer/livepeer/models/errors/LivepeerException.java + - src/main/java/studio/livepeer/livepeer/models/errors/SDKException.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/AddMultistreamTargetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/CreateClipRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/CreateMultistreamTargetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/CreateRoomRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/CreateRoomUserRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/CreateSigningKeyRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/CreateStreamRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/CreateWebhookRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/DeleteAssetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/DeleteMultistreamTargetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/DeleteRoomRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/DeleteRoomUserRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/DeleteSigningKeyRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/DeleteStreamRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/DeleteWebhookRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetAssetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetAssetsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetClipsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetCreatorViewershipMetricsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetMultistreamTargetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetMultistreamTargetsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetPlaybackInfoRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetPublicViewershipMetricsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetRealtimeViewershipNowRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetRecordedSessionsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetRoomRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetRoomUserRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetSessionClipsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetSessionRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetSessionsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetSigningKeyRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetSigningKeysRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetStreamRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetStreamsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetTaskRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetTasksRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetUsageMetricsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetViewershipMetricsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetWebhookLogRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetWebhookLogsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetWebhookRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/GetWebhooksRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/RemoveMultistreamTargetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/RequestUploadRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/ResendWebhookRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/StartPullStreamRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/StartRoomEgressRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/StopRoomEgressRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/TerminateStreamRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/TranscodeVideoRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/UpdateAssetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/UpdateMultistreamTargetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/UpdateRoomUserRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/UpdateSigningKeyRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/UpdateStreamRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/UpdateWebhookRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations//async/UploadAssetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/BreakdownBy.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateClipData.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateClipRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateClipResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateClipTask.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateMultistreamTargetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateMultistreamTargetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateSigningKeyRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateSigningKeyResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateStreamRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateStreamResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateWebhookRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/CreateWebhookResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/From.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetAssetRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetAssetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetAssetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetAssetsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetAssetsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetClipsRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetClipsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetClipsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsQueryParamBreakdownBy.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsData.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetRoomRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetRoomRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetRoomResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSessionsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeysRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeysResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetStreamRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetStreamRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetStreamResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetTaskRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetTaskRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetTaskResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetTasksRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetTasksResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsQueryParamBreakdownBy.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsQueryParamTimeStep.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhooksRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/GetWebhooksResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/QueryParamBreakdownBy.java + - src/main/java/studio/livepeer/livepeer/models/operations/QueryParamFrom.java + - src/main/java/studio/livepeer/livepeer/models/operations/QueryParamTimeStep.java + - src/main/java/studio/livepeer/livepeer/models/operations/QueryParamTo.java + - src/main/java/studio/livepeer/livepeer/models/operations/Record.java + - src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadData.java + - src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/Task.java + - src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/TimeStep.java + - src/main/java/studio/livepeer/livepeer/models/operations/To.java + - src/main/java/studio/livepeer/livepeer/models/operations/TranscodeVideoRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/TranscodeVideoResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequestBody.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookRequest.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetAssetTask.java + - src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetData.java + - src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetDataOutput.java + - src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetRequestBuilder.java + - src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetTask.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/AddMultistreamTargetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/CreateClipResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/CreateMultistreamTargetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomUserResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/CreateSigningKeyResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/CreateStreamResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/CreateWebhookResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteAssetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteMultistreamTargetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomUserResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteSigningKeyResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteStreamResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteWebhookResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetClipsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetCreatorViewershipMetricsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetPlaybackInfoResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetPublicViewershipMetricsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetRealtimeViewershipNowResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetRecordedSessionsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomUserResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionClipsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeyResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeysResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetTaskResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetTasksResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetUsageMetricsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetViewershipMetricsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogsResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhooksResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/RemoveMultistreamTargetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/RequestUploadResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/ResendWebhookResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/StartPullStreamResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/StartRoomEgressResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/StopRoomEgressResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/TerminateStreamResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/TranscodeVideoResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateAssetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateMultistreamTargetResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateRoomUserResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateSigningKeyResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateStreamResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateWebhookResponse.java + - src/main/java/studio/livepeer/livepeer/models/operations/async/UploadAssetResponse.java + - src/main/java/studio/livepeer/livepeer/operations/AddMultistreamTarget.java + - src/main/java/studio/livepeer/livepeer/operations/CreateClip.java + - src/main/java/studio/livepeer/livepeer/operations/CreateMultistreamTarget.java + - src/main/java/studio/livepeer/livepeer/operations/CreateRoom.java + - src/main/java/studio/livepeer/livepeer/operations/CreateRoomUser.java + - src/main/java/studio/livepeer/livepeer/operations/CreateSigningKey.java + - src/main/java/studio/livepeer/livepeer/operations/CreateStream.java + - src/main/java/studio/livepeer/livepeer/operations/CreateWebhook.java + - src/main/java/studio/livepeer/livepeer/operations/DeleteAsset.java + - src/main/java/studio/livepeer/livepeer/operations/DeleteMultistreamTarget.java + - src/main/java/studio/livepeer/livepeer/operations/DeleteRoom.java + - src/main/java/studio/livepeer/livepeer/operations/DeleteRoomUser.java + - src/main/java/studio/livepeer/livepeer/operations/DeleteSigningKey.java + - src/main/java/studio/livepeer/livepeer/operations/DeleteStream.java + - src/main/java/studio/livepeer/livepeer/operations/DeleteWebhook.java + - src/main/java/studio/livepeer/livepeer/operations/GetAsset.java + - src/main/java/studio/livepeer/livepeer/operations/GetAssets.java + - src/main/java/studio/livepeer/livepeer/operations/GetClips.java + - src/main/java/studio/livepeer/livepeer/operations/GetCreatorViewershipMetrics.java + - src/main/java/studio/livepeer/livepeer/operations/GetMultistreamTarget.java + - src/main/java/studio/livepeer/livepeer/operations/GetMultistreamTargets.java + - src/main/java/studio/livepeer/livepeer/operations/GetPlaybackInfo.java + - src/main/java/studio/livepeer/livepeer/operations/GetPublicViewershipMetrics.java + - src/main/java/studio/livepeer/livepeer/operations/GetRealtimeViewershipNow.java + - src/main/java/studio/livepeer/livepeer/operations/GetRecordedSessions.java + - src/main/java/studio/livepeer/livepeer/operations/GetRoom.java + - src/main/java/studio/livepeer/livepeer/operations/GetRoomUser.java + - src/main/java/studio/livepeer/livepeer/operations/GetSession.java + - src/main/java/studio/livepeer/livepeer/operations/GetSessionClips.java + - src/main/java/studio/livepeer/livepeer/operations/GetSessions.java + - src/main/java/studio/livepeer/livepeer/operations/GetSigningKey.java + - src/main/java/studio/livepeer/livepeer/operations/GetSigningKeys.java + - src/main/java/studio/livepeer/livepeer/operations/GetStream.java + - src/main/java/studio/livepeer/livepeer/operations/GetStreams.java + - src/main/java/studio/livepeer/livepeer/operations/GetTask.java + - src/main/java/studio/livepeer/livepeer/operations/GetTasks.java + - src/main/java/studio/livepeer/livepeer/operations/GetUsageMetrics.java + - src/main/java/studio/livepeer/livepeer/operations/GetViewershipMetrics.java + - src/main/java/studio/livepeer/livepeer/operations/GetWebhook.java + - src/main/java/studio/livepeer/livepeer/operations/GetWebhookLog.java + - src/main/java/studio/livepeer/livepeer/operations/GetWebhookLogs.java + - src/main/java/studio/livepeer/livepeer/operations/GetWebhooks.java + - src/main/java/studio/livepeer/livepeer/operations/Operations.java + - src/main/java/studio/livepeer/livepeer/operations/RemoveMultistreamTarget.java + - src/main/java/studio/livepeer/livepeer/operations/RequestUpload.java + - src/main/java/studio/livepeer/livepeer/operations/ResendWebhook.java + - src/main/java/studio/livepeer/livepeer/operations/StartPullStream.java + - src/main/java/studio/livepeer/livepeer/operations/StartRoomEgress.java + - src/main/java/studio/livepeer/livepeer/operations/StopRoomEgress.java + - src/main/java/studio/livepeer/livepeer/operations/TerminateStream.java + - src/main/java/studio/livepeer/livepeer/operations/TranscodeVideo.java + - src/main/java/studio/livepeer/livepeer/operations/UpdateAsset.java + - src/main/java/studio/livepeer/livepeer/operations/UpdateMultistreamTarget.java + - src/main/java/studio/livepeer/livepeer/operations/UpdateRoomUser.java + - src/main/java/studio/livepeer/livepeer/operations/UpdateSigningKey.java + - src/main/java/studio/livepeer/livepeer/operations/UpdateStream.java + - src/main/java/studio/livepeer/livepeer/operations/UpdateWebhook.java + - src/main/java/studio/livepeer/livepeer/operations/UploadAsset.java + - src/main/java/studio/livepeer/livepeer/utils/AsyncHook.java + - src/main/java/studio/livepeer/livepeer/utils/AsyncHooks.java + - src/main/java/studio/livepeer/livepeer/utils/AsyncResponse.java + - src/main/java/studio/livepeer/livepeer/utils/AsyncRetries.java + - src/main/java/studio/livepeer/livepeer/utils/AsyncRetryableException.java + - src/main/java/studio/livepeer/livepeer/utils/BackoffStrategy.java + - src/main/java/studio/livepeer/livepeer/utils/BigDecimalString.java + - src/main/java/studio/livepeer/livepeer/utils/BigIntegerString.java + - src/main/java/studio/livepeer/livepeer/utils/Blob.java + - src/main/java/studio/livepeer/livepeer/utils/BlockingParser.java + - src/main/java/studio/livepeer/livepeer/utils/Constants.java + - src/main/java/studio/livepeer/livepeer/utils/CopiableInputStream.java + - src/main/java/studio/livepeer/livepeer/utils/Deserializers.java + - src/main/java/studio/livepeer/livepeer/utils/EventStream.java + - src/main/java/studio/livepeer/livepeer/utils/EventStreamMessage.java + - src/main/java/studio/livepeer/livepeer/utils/Exceptions.java + - src/main/java/studio/livepeer/livepeer/utils/FormMetadata.java + - src/main/java/studio/livepeer/livepeer/utils/Globals.java + - src/main/java/studio/livepeer/livepeer/utils/HTTPClient.java + - src/main/java/studio/livepeer/livepeer/utils/HTTPRequest.java + - src/main/java/studio/livepeer/livepeer/utils/HasSecurity.java + - src/main/java/studio/livepeer/livepeer/utils/HeaderMetadata.java + - src/main/java/studio/livepeer/livepeer/utils/Headers.java + - src/main/java/studio/livepeer/livepeer/utils/Helpers.java + - src/main/java/studio/livepeer/livepeer/utils/Hook.java + - src/main/java/studio/livepeer/livepeer/utils/HookAdapters.java + - src/main/java/studio/livepeer/livepeer/utils/Hooks.java + - src/main/java/studio/livepeer/livepeer/utils/JSON.java + - src/main/java/studio/livepeer/livepeer/utils/LazySingletonValue.java + - src/main/java/studio/livepeer/livepeer/utils/Metadata.java + - src/main/java/studio/livepeer/livepeer/utils/Multipart.java + - src/main/java/studio/livepeer/livepeer/utils/MultipartFormMetadata.java + - src/main/java/studio/livepeer/livepeer/utils/NameValue.java + - src/main/java/studio/livepeer/livepeer/utils/NonRetryableException.java + - src/main/java/studio/livepeer/livepeer/utils/OneOfDeserializer.java + - src/main/java/studio/livepeer/livepeer/utils/Options.java + - src/main/java/studio/livepeer/livepeer/utils/PathParamsMetadata.java + - src/main/java/studio/livepeer/livepeer/utils/QueryEncoding.java + - src/main/java/studio/livepeer/livepeer/utils/QueryParameter.java + - src/main/java/studio/livepeer/livepeer/utils/QueryParameters.java + - src/main/java/studio/livepeer/livepeer/utils/QueryParamsMetadata.java + - src/main/java/studio/livepeer/livepeer/utils/RecordingClient.java + - src/main/java/studio/livepeer/livepeer/utils/Reflections.java + - src/main/java/studio/livepeer/livepeer/utils/RequestBody.java + - src/main/java/studio/livepeer/livepeer/utils/RequestMetadata.java + - src/main/java/studio/livepeer/livepeer/utils/Response.java + - src/main/java/studio/livepeer/livepeer/utils/ResponseWithBody.java + - src/main/java/studio/livepeer/livepeer/utils/Retries.java + - src/main/java/studio/livepeer/livepeer/utils/RetryConfig.java + - src/main/java/studio/livepeer/livepeer/utils/RetryableException.java + - src/main/java/studio/livepeer/livepeer/utils/Security.java + - src/main/java/studio/livepeer/livepeer/utils/SecurityMetadata.java + - src/main/java/studio/livepeer/livepeer/utils/SerializedBody.java + - src/main/java/studio/livepeer/livepeer/utils/SessionManager.java + - src/main/java/studio/livepeer/livepeer/utils/SpeakeasyHTTPClient.java + - src/main/java/studio/livepeer/livepeer/utils/SpeakeasyMetadata.java + - src/main/java/studio/livepeer/livepeer/utils/StreamingParser.java + - src/main/java/studio/livepeer/livepeer/utils/TypedObject.java + - src/main/java/studio/livepeer/livepeer/utils/Types.java + - src/main/java/studio/livepeer/livepeer/utils/Utf8UrlEncoder.java + - src/main/java/studio/livepeer/livepeer/utils/Utils.java + - src/main/java/studio/livepeer/livepeer/utils/reactive/EventStream.java + - src/main/java/studio/livepeer/livepeer/utils/reactive/ReactiveUtils.java +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": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "fps": 30, "fpsDen": 1, "quality": 23, "gop": "2", "profile": "H264Baseline"}], "record": false, "recordingSpec": {"profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}]}, "multistream": {"targets": [{"profile": "720p", "videoOnly": false, "id": "PUSH123"}]}} + 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": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "fps": 30, "fpsDen": 1, "quality": 23, "gop": "2", "profile": "H264Baseline"}], "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "record": false, "recordingSpec": {"profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}]}, "multistream": {"targets": [{"profile": "720p", "videoOnly": false, "id": "PUSH123"}]}, "lastTerminatedAt": 1713281212993} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getStreams: + speakeasy-default-get-streams: + 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": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "fps": 30, "fpsDen": 1, "quality": 23, "gop": "2", "profile": "H264Baseline"}], "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "record": false, "recordingSpec": {"profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}]}, "multistream": {"targets": [{"profile": "720p", "videoOnly": false, "id": "PUSH123"}]}, "lastTerminatedAt": 1713281212993}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getStream: + speakeasy-default-get-stream: + parameters: + path: + 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": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "fps": 30, "fpsDen": 1, "quality": 23, "gop": "2", "profile": "H264Baseline"}], "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "record": false, "recordingSpec": {"profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}]}, "multistream": {"targets": [{"profile": "720p", "videoOnly": false, "id": "PUSH123"}]}, "lastTerminatedAt": 1713281212993} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + updateStream: + speakeasy-default-update-stream: + parameters: + path: + id: "" + requestBody: + application/json: {"record": false, "multistream": {"targets": [{"profile": "720p", "videoOnly": false, "id": "PUSH123"}]}, "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "profiles": null, "recordingSpec": {"profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}]}, "name": "test_stream"} + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + deleteStream: + speakeasy-default-delete-stream: + parameters: + path: + id: "" + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + terminateStream: + speakeasy-default-terminate-stream: + parameters: + path: + id: "" + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + startPullStream: + speakeasy-default-start-pull-stream: + parameters: + path: + id: "" + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + createClip: + speakeasy-default-create-clip: + requestBody: + 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/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "url", "url": "https://hateful-wriggler.org/"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": [{"hash": "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57", "algorithm": "sha256"}], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": [{"type": "video", "codec": "aac", "startTime": 23.8238, "duration": 23.8238, "bitrate": 1000000, "width": 1920, "height": 1080, "pixelFormat": "yuv420p", "fps": 30, "channels": 2, "sampleRate": 44100, "bitDepth": 16}]}}, "task": {"id": "34d7618e-fd42-4798-acf5-19504616a11e"}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getClips: + speakeasy-default-get-clips: + parameters: + path: + id: "" + 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/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "url", "url": "https://greedy-fraudster.com/"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": null, "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": [{"type": "video", "codec": "aac", "startTime": 23.8238, "duration": 23.8238, "bitrate": 1000000, "width": 1920, "height": 1080, "pixelFormat": "yuv420p", "fps": 30, "channels": 2, "sampleRate": 44100, "bitDepth": 16}]}}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + addMultistreamTarget: + speakeasy-default-add-multistream-target: + parameters: + path: + id: "" + requestBody: + application/json: {"profile": "720p0", "videoOnly": false, "id": "PUSH123", "spec": {"name": "My target", "url": "rtmps://live.my-service.tv/channel/secretKey"}} + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + removeMultistreamTarget: + speakeasy-default-remove-multistream-target: + parameters: + path: + id: "" + targetId: "" + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getMultistreamTargets: + speakeasy-default-get-multistream-targets: + responses: + "200": + application/json: [{"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "createdAt": 1587667174725}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + createMultistreamTarget: + speakeasy-default-create-multistream-target: + requestBody: + application/json: {"url": "rtmps://live.my-service.tv/channel/secretKey"} + responses: + "201": + application/json: {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "createdAt": 1587667174725} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getMultistreamTarget: + speakeasy-default-get-multistream-target: + parameters: + path: + id: "" + responses: + "200": + application/json: {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "createdAt": 1587667174725} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + updateMultistreamTarget: + speakeasy-default-update-multistream-target: + parameters: + path: + id: "" + requestBody: + application/json: {"url": "rtmps://live.my-service.tv/channel/secretKey"} + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + deleteMultistreamTarget: + speakeasy-default-delete-multistream-target: + parameters: + path: + id: "" + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getWebhooks: + speakeasy-default-get-webhooks: + responses: + "200": + application/json: [{"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "name": "test_webhook", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "events": ["stream.started", "stream.idle"], "url": "https://my-service.com/webhook", "streamId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "status": {"lastFailure": {"timestamp": 1587667174725, "error": "Error message", "response": "Response body", "statusCode": 500}, "lastTriggeredAt": 1587667174725}}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + createWebhook: + speakeasy-default-create-webhook: + requestBody: + application/json: {"name": "test_webhook", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "events": ["stream.started", "stream.idle"], "url": "https://my-service.com/webhook", "sharedSecret": "my-secret", "streamId": "de7818e7-610a-4057-8f6f-b785dc1e6f88"} + responses: + "200": + application/json: {"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "name": "test_webhook", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "events": ["stream.started", "stream.idle"], "url": "https://my-service.com/webhook", "streamId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "status": {"lastFailure": {"timestamp": 1587667174725, "error": "Error message", "response": "Response body", "statusCode": 500}, "lastTriggeredAt": 1587667174725}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getWebhook: + speakeasy-default-get-webhook: + parameters: + path: + id: "" + responses: + "200": + application/json: {"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "name": "test_webhook", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "events": ["stream.started", "stream.idle"], "url": "https://my-service.com/webhook", "streamId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "status": {"lastFailure": {"timestamp": 1587667174725, "error": "Error message", "response": "Response body", "statusCode": 500}, "lastTriggeredAt": 1587667174725}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + updateWebhook: + speakeasy-default-update-webhook: + parameters: + path: + id: "" + requestBody: + application/json: {"name": "test_webhook", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "events": ["stream.started", "stream.idle"], "url": "https://my-service.com/webhook", "sharedSecret": "my-secret", "streamId": "de7818e7-610a-4057-8f6f-b785dc1e6f88"} + responses: + "200": + application/json: {"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "name": "test_webhook", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "events": ["stream.started", "stream.idle"], "url": "https://my-service.com/webhook", "streamId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "status": {"lastFailure": {"timestamp": 1587667174725, "error": "Error message", "response": "Response body", "statusCode": 500}, "lastTriggeredAt": 1587667174725}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + deleteWebhook: + speakeasy-default-delete-webhook: + parameters: + path: + id: "" + responses: + "200": + application/json: {"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "name": "test_webhook", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "events": ["stream.started", "stream.idle"], "url": "https://my-service.com/webhook", "streamId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "status": {"lastFailure": {"timestamp": 1587667174725, "error": "Error message", "response": "Response body", "statusCode": 500}, "lastTriggeredAt": 1587667174725}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getWebhookLogs: + speakeasy-default-get-webhook-logs: + parameters: + path: + id: "" + responses: + "200": + application/json: [{"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "webhookId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "event": "stream.started", "createdAt": 1587667174725, "duration": 0.5, "success": true, "request": {"url": "https://my-service.com/webhook", "method": "POST", "headers": {"User-Agent": "livepeer.studio"}, "body": "{\"event\": \"stream.started\"}"}}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getWebhookLog: + speakeasy-default-get-webhook-log: + parameters: + path: + id: "" + logId: "" + responses: + "200": + application/json: {"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "webhookId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "event": "stream.started", "createdAt": 1587667174725, "duration": 0.5, "success": true, "request": {"url": "https://my-service.com/webhook", "method": "POST", "headers": {"User-Agent": "livepeer.studio"}, "body": "{\"event\": \"stream.started\"}"}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + resendWebhook: + speakeasy-default-resend-webhook: + parameters: + path: + id: "" + logId: "" + responses: + "200": + application/json: {"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "webhookId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "event": "stream.started", "createdAt": 1587667174725, "duration": 0.5, "success": true, "request": {"url": "https://my-service.com/webhook", "method": "POST", "headers": {"User-Agent": "livepeer.studio"}, "body": "{\"event\": \"stream.started\"}"}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getAssets: + speakeasy-default-get-assets: + 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/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "directUpload"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": [{"hash": "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57", "algorithm": "sha256"}], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": [{"type": "video", "codec": "aac", "startTime": 23.8238, "duration": 23.8238, "bitrate": 1000000, "width": 1920, "height": 1080, "pixelFormat": "yuv420p", "fps": 30, "channels": 2, "sampleRate": 44100, "bitDepth": 16}]}}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + requestUpload: + speakeasy-default-request-upload: + requestBody: + application/json: {"name": "filename.mp4", "staticMp4": true, "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}]} + 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/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "url", "url": "https://prudent-lotion.name/"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": [{"hash": "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57", "algorithm": "sha256"}], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": [{"type": "video", "codec": "aac", "startTime": 23.8238, "duration": 23.8238, "bitrate": 1000000, "width": 1920, "height": 1080, "pixelFormat": "yuv420p", "fps": 30, "channels": 2, "sampleRate": 44100, "bitDepth": 16}]}}, "task": {"id": "34d7618e-fd42-4798-acf5-19504616a11e"}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + uploadAsset: + speakeasy-default-upload-asset: + requestBody: + application/json: {"name": "filename.mp4", "staticMp4": true, "playbackPolicy": null, "url": "https://s3.amazonaws.com/my-bucket/path/filename.mp4", "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}]} + 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/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "url", "url": "https://uncommon-casket.name"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": [{"hash": "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57", "algorithm": "sha256"}], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": [{"type": "video", "codec": "aac", "startTime": 23.8238, "duration": 23.8238, "bitrate": 1000000, "width": 1920, "height": 1080, "pixelFormat": "yuv420p", "fps": 30, "channels": 2, "sampleRate": 44100, "bitDepth": 16}]}}, "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/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "url", "url": "https://uncommon-casket.name"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": [{"hash": "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57", "algorithm": "sha256"}], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": [{"type": "video", "codec": "aac", "startTime": 23.8238, "duration": 23.8238, "bitrate": 1000000, "width": 1920, "height": 1080, "pixelFormat": "yuv420p", "fps": 30, "channels": 2, "sampleRate": 44100, "bitDepth": 16}]}}, "task": {"id": "34d7618e-fd42-4798-acf5-19504616a11e"}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getAsset: + speakeasy-default-get-asset: + parameters: + path: + 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/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "url", "url": "https://any-puppet.com"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": [{"hash": "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57", "algorithm": "sha256"}], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": [{"type": "video", "codec": "aac", "startTime": 23.8238, "duration": 23.8238, "bitrate": 1000000, "width": 1920, "height": 1080, "pixelFormat": "yuv420p", "fps": 30, "channels": 2, "sampleRate": 44100, "bitDepth": 16}]}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + updateAsset: + speakeasy-default-update-asset: + parameters: + path: + assetId: "" + requestBody: + 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/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "url", "url": "https://second-maintainer.info/"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": [{"hash": "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57", "algorithm": "sha256"}], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": [{"type": "video", "codec": "aac", "startTime": 23.8238, "duration": 23.8238, "bitrate": 1000000, "width": 1920, "height": 1080, "pixelFormat": "yuv420p", "fps": 30, "channels": 2, "sampleRate": 44100, "bitDepth": 16}]}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + deleteAsset: + speakeasy-default-delete-asset: + parameters: + path: + assetId: "" + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getSessionClips: + speakeasy-default-get-session-clips: + parameters: + path: + id: "" + 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/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "url", "url": "https://dim-publication.name"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": null, "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": [{"type": "video", "codec": "aac", "startTime": 23.8238, "duration": 23.8238, "bitrate": 1000000, "width": 1920, "height": 1080, "pixelFormat": "yuv420p", "fps": 30, "channels": 2, "sampleRate": 44100, "bitDepth": 16}]}}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getSessions: + speakeasy-default-get-sessions: + responses: + "200": + application/json: [{"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "name": "test_session", "lastSeen": 1587667174725, "sourceSegments": 1, "transcodedSegments": 2, "sourceSegmentsDuration": 1, "transcodedSegmentsDuration": 2, "sourceBytes": 1, "transcodedBytes": 2, "ingestRate": 1, "outgoingRate": 2, "createdAt": 1587667174725, "parentId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "record": false, "playbackId": "eaw4nk06ts2d0mzb", "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "fps": 30, "fpsDen": 1, "quality": 23, "gop": "2", "profile": "H264Baseline"}], "recordingSpec": {"profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}]}}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getSession: + speakeasy-default-get-session: + parameters: + path: + id: "" + responses: + "200": + application/json: {"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "name": "test_session", "lastSeen": 1587667174725, "sourceSegments": 1, "transcodedSegments": 2, "sourceSegmentsDuration": 1, "transcodedSegmentsDuration": 2, "sourceBytes": 1, "transcodedBytes": 2, "ingestRate": 1, "outgoingRate": 2, "createdAt": 1587667174725, "parentId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "record": false, "playbackId": "eaw4nk06ts2d0mzb", "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "fps": 30, "fpsDen": 1, "quality": 23, "gop": "2", "profile": "H264Baseline"}], "recordingSpec": {"profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}]}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getRecordedSessions: + speakeasy-default-get-recorded-sessions: + parameters: + path: + parentId: "" + query: + record: true + responses: + "200": + application/json: [{"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "name": "test_session", "lastSeen": 1587667174725, "sourceSegments": 1, "transcodedSegments": 2, "sourceSegmentsDuration": 1, "transcodedSegmentsDuration": 2, "sourceBytes": 1, "transcodedBytes": 2, "ingestRate": 1, "outgoingRate": 2, "createdAt": 1587667174725, "parentId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "record": false, "playbackId": "eaw4nk06ts2d0mzb", "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "fps": 30, "fpsDen": 1, "quality": 23, "gop": "2", "profile": "H264Baseline"}], "recordingSpec": {"profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}]}}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + createRoom: + speakeasy-default-create-room: + responses: + "200": + application/json: {"id": "d32ae9e6-c459-4931-9898-e86e2f5e7e16"} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getRoom: + speakeasy-default-get-room: + parameters: + path: + id: "" + responses: + "200": + application/json: {"id": "d32ae9e6-c459-4931-9898-e86e2f5e7e16", "createdAt": 1587667174725, "updatedAt": 1587667174725, "participants": {}} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + deleteRoom: + speakeasy-default-delete-room: + parameters: + path: + id: "" + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + startRoomEgress: + speakeasy-default-start-room-egress: + parameters: + path: + id: "" + requestBody: + application/json: {"streamId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9"} + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + stopRoomEgress: + speakeasy-default-stop-room-egress: + parameters: + path: + id: "" + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + createRoomUser: + speakeasy-default-create-room-user: + parameters: + path: + id: "" + requestBody: + application/json: {"name": "name", "canPublish": true, "canPublishData": true} + responses: + "201": + application/json: {"id": "d32ae9e6-c459-4931-9898-e86e2f5e7e16", "joinUrl": "https://meet.livepeer.chat", "token": "token"} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getRoomUser: + speakeasy-default-get-room-user: + parameters: + path: + id: "" + userId: "" + responses: + "200": + application/json: {"id": "d32ae9e6-c459-4931-9898-e86e2f5e7e16", "joinedAt": 1687517025261, "name": "name", "isPublisher": true} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + updateRoomUser: + speakeasy-default-update-room-user: + parameters: + path: + id: "" + userId: "" + requestBody: + application/json: {"canPublish": true, "canPublishData": true} + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + deleteRoomUser: + speakeasy-default-delete-room-user: + parameters: + path: + id: "" + userId: "" + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getRealtimeViewershipNow: + speakeasy-default-get-realtime-viewership-now: + responses: + "200": + application/json: [{"playbackId": "1bde4o2i6xycudoy", "device": "iPhone", "browser": "Safari", "country": "United States", "viewCount": 100, "errorRate": 0.1}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getViewershipMetrics: + speakeasy-default-get-viewership-metrics: + responses: + "200": + application/json: [{"playbackId": "1bde4o2i6xycudoy", "creatorId": "john@doe.com", "viewerId": "1bde4o2i6xycudoy", "dStorageUrl": "ipfs://QmZ4", "timestamp": 1587667174725, "device": "iPhone", "deviceType": "mobile", "cpu": "ARM", "os": "iOS", "browser": "Safari", "browserEngine": "WebKit", "continent": "North America", "country": "United States", "subdivision": "California", "timezone": "America/Los_Angeles", "geohash": "123", "viewCount": 100, "playtimeMins": 10, "ttffMs": 100, "rebufferRatio": 0.1, "errorRate": 0.1, "exitsBeforeStart": 0.5}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getCreatorViewershipMetrics: + speakeasy-default-get-creator-viewership-metrics: + responses: + "200": + application/json: [{"playbackId": "1bde4o2i6xycudoy", "creatorId": "john@doe.com", "viewerId": "1bde4o2i6xycudoy", "dStorageUrl": "ipfs://QmZ4", "timestamp": 1587667174725, "device": "iPhone", "deviceType": "mobile", "cpu": "ARM", "os": "iOS", "browser": "Safari", "browserEngine": "WebKit", "continent": "North America", "country": "United States", "subdivision": "California", "timezone": "America/Los_Angeles", "geohash": "123", "viewCount": 100, "playtimeMins": 10, "ttffMs": 100, "rebufferRatio": 0.1, "errorRate": 0.1, "exitsBeforeStart": 0.5}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getPublicViewershipMetrics: + speakeasy-default-get-public-viewership-metrics: + parameters: + path: + playbackId: "" + responses: + "200": + application/json: {"playbackId": "1bde4o2i6xycudoy", "dStorageUrl": "ipfs://QmZ4", "viewCount": 100, "playtimeMins": 10} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getUsageMetrics: + speakeasy-default-get-usage-metrics: + responses: + "200": + application/json: {"UserID": "1bde4o2i6xycudoy", "CreatorID": "john@doe.com", "DeliveryUsageMins": 100, "TotalUsageMins": 100, "StorageUsageMins": 100} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + createSigningKey: + speakeasy-default-create-signing-key: + responses: + "200": + application/json: {"id": "78df0075-b5f3-4683-a618-1086faca35dc", "name": "key1", "createdAt": 1587667174725, "lastSeen": 1587667174725, "publicKey": "", "disabled": false, "projectId": "aac12556-4d65-4d34-9fb"} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getSigningKeys: + speakeasy-default-get-signing-keys: + responses: + "200": + application/json: [{"id": "78df0075-b5f3-4683-a618-1086faca35dc", "name": "key1", "createdAt": 1587667174725, "lastSeen": 1587667174725, "publicKey": "", "disabled": false, "projectId": "aac12556-4d65-4d34-9fb"}] + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + deleteSigningKey: + speakeasy-default-delete-signing-key: + parameters: + path: + keyId: "" + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getSigningKey: + speakeasy-default-get-signing-key: + parameters: + path: + keyId: "" + responses: + "200": + application/json: {"id": "78df0075-b5f3-4683-a618-1086faca35dc", "name": "key1", "createdAt": 1587667174725, "lastSeen": 1587667174725, "publicKey": "", "disabled": false, "projectId": "aac12556-4d65-4d34-9fb"} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + updateSigningKey: + speakeasy-default-update-signing-key: + parameters: + path: + keyId: "" + requestBody: + application/json: {} + responses: + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + getTasks: + speakeasy-default-get-tasks: + 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": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "targetSegmentSizeSecs": 6}, "export": {"ipfs": {"pinata": {"apiKey": "1234567890"}}}, "exportData": {"content": {}, "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": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": "https://other-electronics.com"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": "processing", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [{"hash": "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57", "algorithm": "sha256"}], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": [{"type": "video", "codec": "aac", "startTime": 23.8238, "duration": 23.8238, "bitrate": 1000000, "width": 1920, "height": 1080, "pixelFormat": "yuv420p", "fps": 30, "channels": 2, "sampleRate": 44100, "bitDepth": 16}]}}}, "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\"]"]} + getTask: + speakeasy-default-get-task: + parameters: + path: + 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": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "targetSegmentSizeSecs": 6}, "export": {"ipfs": {"pinata": {"apiKey": "1234567890"}}}, "exportData": {"content": {}, "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": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": "directUpload"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": [{"hash": "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57", "algorithm": "sha256"}], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": [{"type": "video", "codec": "aac", "startTime": 23.8238, "duration": 23.8238, "bitrate": 1000000, "width": 1920, "height": 1080, "pixelFormat": "yuv420p", "fps": 30, "channels": 2, "sampleRate": 44100, "bitDepth": 16}]}}}, "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": {"type": "s3", "endpoint": "https://gateway.storjshare.io", "bucket": "inputbucket", "path": "/path/file.mp4", "credentials": {"accessKeyId": "AKIAIOSFODNN7EXAMPLE", "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}}, "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": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}]} + 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": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "targetSegmentSizeSecs": 6}, "export": {"ipfs": {"pinata": {}}}, "exportData": {"content": {}, "ipfs": {"pinata": {}}, "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": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": "directUpload"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [{"width": 1280, "name": "720p", "height": 720, "bitrate": 3000000, "quality": 23, "fps": 30, "fpsDen": 1, "gop": "2", "profile": "H264Baseline", "encoder": "H.264"}], "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": [{"hash": "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57", "algorithm": "sha256"}], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": [{"type": "video", "codec": "aac", "startTime": 23.8238, "duration": 23.8238, "bitrate": 1000000, "width": 1920, "height": 1080, "pixelFormat": "yuv420p", "fps": 30, "channels": 2, "sampleRate": 44100, "bitDepth": 16}]}}}, "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: + speakeasy-default-get-playback-info: + parameters: + path: + id: "" + responses: + "200": + application/json: {"type": "vod", "meta": {"live": 0, "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": [{"hrn": "MP4", "type": "html5/video/mp4", "url": "https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4", "size": 494778, "width": 204, "height": 360, "bitrate": 449890}], "dvrPlayback": [{"hrn": "HLS (TS)", "type": "html5/application/vnd.apple.mpegurl", "url": "https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4"}], "attestation": {"id": "5b9e63bb-6fd0-4bea-aff2-cc5d4eb9cad0", "primaryType": "VideoAttestation", "domain": {"name": "Verifiable Video", "version": "1"}, "message": {"video": "5b9e63bb-6fd0-4bea-aff2-cc5d4eb9cad0", "attestations": [{"role": "creator", "address": "1311768467294899700"}], "signer": "1311768467294899700", "timestamp": 1587667174725}, "signature": "1311768467294899700", "createdAt": 1587667174725, "signatureType": "eip712", "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"}}}}}} + "404": + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} + default: + application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} +examplesVersion: 1.0.2 +generatedTests: {} +releaseNotes: "## Java SDK Changes Detected:\n* `livepeer.playback.get()`: `response.status[default]` **Added** **Breaking** :warning:\n* `livepeer.stream.update()`: \n * `request.stream-patch-payload.name` **Added**\n* `livepeer.task.getAll()`: `response.[].projectId` **Added**\n* `livepeer.task.get()`: `response.projectid` **Added**\n* `livepeer.transcode.create()`: `response.projectid` **Added**\n" diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 4d8f487a..158f89a5 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -4,23 +4,41 @@ generation: maintainOpenAPIOrder: true usageSnippets: optionalPropertyRendering: withExample + sdkInitStyle: constructor useClassNamesForArrayFields: true fixes: nameResolutionDec2023: true + nameResolutionFeb2025: false parameterOrderingFeb2024: true requestResponseComponentNamesFeb2024: true + securityFeb2025: false + sharedErrorComponentsApr2025: false auth: oAuth2ClientCredentialsEnabled: true + oAuth2PasswordEnabled: false + hoistGlobalSecurity: true + schemas: + allOfMergeStrategy: shallowMerge + tests: + generateTests: true + generateNewTests: false + skipResponseBodyAssertions: false java: - version: 0.5.0 + version: 0.6.0 additionalDependencies: [] additionalPlugins: [] artifactID: livepeer + asyncMode: enabled + baseErrorName: LivepeerException clientServerStatusCodesAsErrors: true companyEmail: info@mycompany.com companyName: My Company companyURL: www.mycompany.com + defaultErrorName: SDKException + enableCustomCodeRegions: false + enableStreamingUploads: false flattenGlobalSecurity: true + generateSpringBootStarter: true githubURL: github.com/owner/repo groupID: studio.livepeer imports: @@ -32,11 +50,13 @@ java: shared: models/components webhooks: models/webhooks inputModelSuffix: input + languageVersion: 11 license: name: The MIT License (MIT) shortName: MIT url: https://mit-license.org/ maxMethodParams: 4 + nullFriendlyParameters: false outputModelSuffix: output projectName: openapi templateVersion: v2 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 647effc7..ea70629f 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.377.1 +speakeasyVersion: 1.639.3 sources: Livepeer: sourceNamespace: livepeer @@ -8,24 +8,25 @@ sources: - latest livepeer-studio-api: sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:9333277669bf8fb46063579d611518570aff37c2bfb20e0a90fd3b0c030ca2ad - sourceBlobDigest: sha256:1705d75b1de89f7c2e60643ed2c2aaced22b577da6f2935b1c2e09d533bb7182 + sourceRevisionDigest: sha256:5a7c56047bc8767b259a799f2fc3bb7c7aadbf4cb59d4080041f0402ef793655 + sourceBlobDigest: sha256:8f6298548c21f0dccf2d39100dcba5b8691de90eb7ec0d54d33c401365935a37 tags: - latest - - main + - speakeasy-sdk-regen-1758759114 + - 1.0.0 targets: livepeer-java: source: livepeer-studio-api sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:9333277669bf8fb46063579d611518570aff37c2bfb20e0a90fd3b0c030ca2ad - sourceBlobDigest: sha256:1705d75b1de89f7c2e60643ed2c2aaced22b577da6f2935b1c2e09d533bb7182 - outLocation: /github/workspace/repo + sourceRevisionDigest: sha256:5a7c56047bc8767b259a799f2fc3bb7c7aadbf4cb59d4080041f0402ef793655 + sourceBlobDigest: sha256:8f6298548c21f0dccf2d39100dcba5b8691de90eb7ec0d54d33c401365935a37 + codeSamplesNamespace: livepeer-studio-api-java-code-samples + codeSamplesRevisionDigest: sha256:44751c756d085002c3efe5dbaf4bbbf6a927752404e65ae3f27fb72bf5682177 my-first-target: source: Livepeer sourceNamespace: livepeer sourceRevisionDigest: sha256:a27b08eda9895afa45560e8255cc722036759a56c7c16bf09d002f2f5a4e2dea sourceBlobDigest: sha256:856a4f7c8547bd06b13cb376f3b89f51fe7f6578c4fa6284a1877fc99cc46766 - outLocation: /Users/chase/git/livepeer/livepeer-java workflow: workflowVersion: 1.0.0 speakeasyVersion: latest @@ -33,6 +34,7 @@ workflow: livepeer-studio-api: inputs: - location: https://raw.githubusercontent.com/livepeer/studio/master/packages/api/src/schema/api-schema.yaml + - location: https://raw.githubusercontent.com/livepeer/studio/master/packages/api/src/schema/ai-api-schema.yaml registry: location: registry.speakeasyapi.dev/livepeer/livepeer-studio/livepeer-studio-api targets: @@ -41,3 +43,5 @@ workflow: source: livepeer-studio-api codeSamples: output: codeSamples.yaml + registry: + location: registry.speakeasyapi.dev/livepeer/livepeer-studio/livepeer-studio-api-java-code-samples diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index dabdf101..368b07f6 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -13,3 +13,5 @@ targets: source: livepeer-studio-api codeSamples: output: codeSamples.yaml + registry: + location: registry.speakeasyapi.dev/livepeer/livepeer-studio/livepeer-studio-api-java-code-samples diff --git a/README.md b/README.md index cb7a2f09..a9db602e 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,34 @@ applications written in Java. For full documentation and examples, please visit [docs.livepeer.org](https://docs.livepeer.org/sdks/javascript/). + +## Summary + +Livepeer API Reference: Welcome to the Livepeer API reference docs. Here you will find all the +endpoints exposed on the standard Livepeer API, learn how to use them and +what they return. + + + +## Table of Contents + +* [Livepeer Java SDK](#livepeer-java-sdk) + * [Documentation](#documentation) + * [SDK Installation](#sdk-installation) + * [SDK Example Usage](#sdk-example-usage) + * [Available Resources and Operations](#available-resources-and-operations) + * [Error Handling](#error-handling) + * [Server Selection](#server-selection) + * [Asynchronous Support](#asynchronous-support) + * [Authentication](#authentication) + * [Custom HTTP Client](#custom-http-client) + * [Debugging](#debugging) +* [Development](#development) + * [Maturity](#maturity) + * [Contributions](#contributions) + + + ## SDK Installation @@ -18,7 +46,7 @@ The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'studio.livepeer:livepeer:0.5.0' +implementation 'studio.livepeer:livepeer:0.6.0' ``` Maven: @@ -26,7 +54,7 @@ Maven: studio.livepeer livepeer - 0.5.0 + 0.6.0 ``` @@ -57,40 +85,113 @@ import java.lang.Exception; import java.util.List; import java.util.Map; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.components.FfmpegProfile; -import studio.livepeer.livepeer.models.components.Location; -import studio.livepeer.livepeer.models.components.Multistream; -import studio.livepeer.livepeer.models.components.NewStreamPayload; -import studio.livepeer.livepeer.models.components.NewStreamPayloadRecordingSpec; -import studio.livepeer.livepeer.models.components.PlaybackPolicy; -import studio.livepeer.livepeer.models.components.Profile; -import studio.livepeer.livepeer.models.components.Pull; -import studio.livepeer.livepeer.models.components.Target; -import studio.livepeer.livepeer.models.components.TargetSpec; -import studio.livepeer.livepeer.models.components.TranscodeProfile; -import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; -import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; -import studio.livepeer.livepeer.models.components.Type; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.components.*; import studio.livepeer.livepeer.models.operations.CreateStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") + + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + NewStreamPayload req = NewStreamPayload.builder() + .name("test_stream") + .pull(Pull.builder() + .source("https://myservice.com/live/stream.flv") + .headers(Map.ofEntries( + Map.entry("Authorization", "Bearer 123"))) + .location(Location.builder() + .lat(39.739) + .lon(-104.988) + .build()) + .build()) + .playbackPolicy(PlaybackPolicy.builder() + .type(Type.WEBHOOK) + .webhookId("1bde4o2i6xycudoy") + .webhookContext(Map.ofEntries( + Map.entry("streamerId", "my-custom-id"))) + .refreshInterval(600d) + .build()) + .profiles(List.of( + FfmpegProfile.builder() + .width(1280L) + .name("720p") + .height(720L) + .bitrate(3000000L) + .fps(30L) + .fpsDen(1L) + .quality(23L) + .gop("2") + .profile(Profile.H264_BASELINE) + .build())) + .record(false) + .recordingSpec(NewStreamPayloadRecordingSpec.builder() + .profiles(List.of( + TranscodeProfile.builder() + .bitrate(3000000L) + .width(1280L) + .name("720p") + .height(720L) + .quality(23L) + .fps(30L) + .fpsDen(1L) + .gop("2") + .profile(TranscodeProfileProfile.H264_BASELINE) + .encoder(TranscodeProfileEncoder.H264) + .build())) + .build()) + .multistream(Multistream.builder() + .targets(List.of( + Target.builder() + .profile("720p") + .id("PUSH123") + .build())) + .build()) .build(); - NewStreamPayload req = NewStreamPayload.builder() + CreateStreamResponse res = sdk.stream().create() + .request(req) + .call(); + + if (res.stream().isPresent()) { + // handle response + } + } +} +``` +#### Asynchronous Call +An asynchronous SDK client is also available that returns a [`CompletableFuture`][comp-fut]. See [Asynchronous Support](#asynchronous-support) for more details on async benefits and reactive library integration. +```java +package hello.world; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.AsyncLivepeer; +import studio.livepeer.livepeer.Livepeer; +import studio.livepeer.livepeer.models.components.*; +import studio.livepeer.livepeer.models.operations.async.CreateStreamResponse; + +public class Application { + + public static void main(String[] args) { + + AsyncLivepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build() + .async(); + + NewStreamPayload req = NewStreamPayload.builder() .name("test_stream") .pull(Pull.builder() .source("https://myservice.com/live/stream.flv") .headers(Map.ofEntries( Map.entry("Authorization", "Bearer 123"))) .location(Location.builder() - .lat(39.739d) - .lon(-104.988d) + .lat(39.739) + .lon(-104.988) .build()) .build()) .playbackPolicy(PlaybackPolicy.builder() @@ -131,72 +232,41 @@ public class Application { .multistream(Multistream.builder() .targets(List.of( Target.builder() - .profile("720p0") - .videoOnly(false) + .profile("720p") .id("PUSH123") - .spec(TargetSpec.builder() - .url("rtmps://live.my-service.tv/channel/secretKey") - .name("My target") - .build()) .build())) .build()) .build(); - CreateStreamResponse res = sdk.stream().create() + CompletableFuture resFut = sdk.stream().create() .request(req) .call(); + resFut.thenAccept(res -> { if (res.stream().isPresent()) { - // handle response + // handle response } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; - } - + }); } } ``` + +[comp-fut]: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html ## Available Resources and Operations -### [stream()](docs/sdks/stream/README.md) +
+Available methods -* [create](docs/sdks/stream/README.md#create) - Create a stream -* [getAll](docs/sdks/stream/README.md#getall) - Retrieve streams -* [get](docs/sdks/stream/README.md#get) - Retrieve a stream -* [update](docs/sdks/stream/README.md#update) - Update a stream -* [delete](docs/sdks/stream/README.md#delete) - Delete a stream -* [terminate](docs/sdks/stream/README.md#terminate) - Terminates a live stream -* [startPull](docs/sdks/stream/README.md#startpull) - Start ingest for a pull stream -* [createClip](docs/sdks/stream/README.md#createclip) - Create a clip -* [getClips](docs/sdks/stream/README.md#getclips) - Retrieve clips of a livestream -* [addMultistreamTarget](docs/sdks/stream/README.md#addmultistreamtarget) - Add a multistream target -* [removeMultistreamTarget](docs/sdks/stream/README.md#removemultistreamtarget) - Remove a multistream target - -### [multistream()](docs/sdks/multistream/README.md) - -* [getAll](docs/sdks/multistream/README.md#getall) - Retrieve Multistream Targets -* [create](docs/sdks/multistream/README.md#create) - Create a multistream target -* [get](docs/sdks/multistream/README.md#get) - Retrieve a multistream target -* [update](docs/sdks/multistream/README.md#update) - Update Multistream Target -* [delete](docs/sdks/multistream/README.md#delete) - Delete a multistream target - -### [webhook()](docs/sdks/webhook/README.md) +### [accessControl()](docs/sdks/accesscontrol/README.md) -* [getAll](docs/sdks/webhook/README.md#getall) - Retrieve a Webhook -* [create](docs/sdks/webhook/README.md#create) - Create a webhook -* [get](docs/sdks/webhook/README.md#get) - Retrieve a webhook -* [update](docs/sdks/webhook/README.md#update) - Update a webhook -* [delete](docs/sdks/webhook/README.md#delete) - Delete a webhook -* [getLogs](docs/sdks/webhook/README.md#getlogs) - Retrieve webhook logs -* [getLog](docs/sdks/webhook/README.md#getlog) - Retrieve a webhook log -* [resendLog](docs/sdks/webhook/README.md#resendlog) - Resend a webhook +* [create](docs/sdks/accesscontrol/README.md#create) - Create a signing key +* [getAll](docs/sdks/accesscontrol/README.md#getall) - Retrieves signing keys +* [delete](docs/sdks/accesscontrol/README.md#delete) - Delete Signing Key +* [get](docs/sdks/accesscontrol/README.md#get) - Retrieves a signing key +* [update](docs/sdks/accesscontrol/README.md#update) - Update a signing key ### [asset()](docs/sdks/asset/README.md) @@ -207,14 +277,27 @@ public class Application { * [update](docs/sdks/asset/README.md#update) - Patch an asset * [delete](docs/sdks/asset/README.md#delete) - Delete an asset -### [session()](docs/sdks/session/README.md) +### [metrics()](docs/sdks/metrics/README.md) -* [getClips](docs/sdks/session/README.md#getclips) - Retrieve clips of a session -* [getAll](docs/sdks/session/README.md#getall) - Retrieve sessions -* [get](docs/sdks/session/README.md#get) - Retrieve a session -* [getRecorded](docs/sdks/session/README.md#getrecorded) - Retrieve Recorded Sessions +* [getRealtimeViewership](docs/sdks/metrics/README.md#getrealtimeviewership) - Query realtime viewership +* [getViewership](docs/sdks/metrics/README.md#getviewership) - Query viewership metrics +* [getCreatorViewership](docs/sdks/metrics/README.md#getcreatorviewership) - Query creator viewership metrics +* [getPublicViewership](docs/sdks/metrics/README.md#getpublicviewership) - Query public total views metrics +* [getUsage](docs/sdks/metrics/README.md#getusage) - Query usage metrics + +### [multistream()](docs/sdks/multistream/README.md) + +* [getAll](docs/sdks/multistream/README.md#getall) - Retrieve Multistream Targets +* [create](docs/sdks/multistream/README.md#create) - Create a multistream target +* [get](docs/sdks/multistream/README.md#get) - Retrieve a multistream target +* [update](docs/sdks/multistream/README.md#update) - Update Multistream Target +* [delete](docs/sdks/multistream/README.md#delete) - Delete a multistream target + +### [playback()](docs/sdks/playback/README.md) -### [room()](docs/sdks/room/README.md) +* [get](docs/sdks/playback/README.md#get) - Retrieve Playback Info + +### [~~room()~~](docs/sdks/room/README.md) * [~~create~~](docs/sdks/room/README.md#create) - Create a room :warning: **Deprecated** * [~~get~~](docs/sdks/room/README.md#get) - Retrieve a room :warning: **Deprecated** @@ -226,21 +309,26 @@ public class Application { * [~~updateUser~~](docs/sdks/room/README.md#updateuser) - Update a room user :warning: **Deprecated** * [~~deleteUser~~](docs/sdks/room/README.md#deleteuser) - Remove a user from the room :warning: **Deprecated** -### [metrics()](docs/sdks/metrics/README.md) +### [session()](docs/sdks/session/README.md) -* [getRealtimeViewership](docs/sdks/metrics/README.md#getrealtimeviewership) - Query realtime viewership -* [getViewership](docs/sdks/metrics/README.md#getviewership) - Query viewership metrics -* [getCreatorViewership](docs/sdks/metrics/README.md#getcreatorviewership) - Query creator viewership metrics -* [getPublicViewership](docs/sdks/metrics/README.md#getpublicviewership) - Query public total views metrics -* [getUsage](docs/sdks/metrics/README.md#getusage) - Query usage metrics +* [getClips](docs/sdks/session/README.md#getclips) - Retrieve clips of a session +* [getAll](docs/sdks/session/README.md#getall) - Retrieve sessions +* [get](docs/sdks/session/README.md#get) - Retrieve a session +* [getRecorded](docs/sdks/session/README.md#getrecorded) - Retrieve Recorded Sessions -### [accessControl()](docs/sdks/accesscontrol/README.md) +### [stream()](docs/sdks/stream/README.md) -* [create](docs/sdks/accesscontrol/README.md#create) - Create a signing key -* [getAll](docs/sdks/accesscontrol/README.md#getall) - Retrieves signing keys -* [delete](docs/sdks/accesscontrol/README.md#delete) - Delete Signing Key -* [get](docs/sdks/accesscontrol/README.md#get) - Retrieves a signing key -* [update](docs/sdks/accesscontrol/README.md#update) - Update a signing key +* [create](docs/sdks/stream/README.md#create) - Create a stream +* [getAll](docs/sdks/stream/README.md#getall) - Retrieve streams +* [get](docs/sdks/stream/README.md#get) - Retrieve a stream +* [update](docs/sdks/stream/README.md#update) - Update a stream +* [delete](docs/sdks/stream/README.md#delete) - Delete a stream +* [terminate](docs/sdks/stream/README.md#terminate) - Terminates a live stream +* [startPull](docs/sdks/stream/README.md#startpull) - Start ingest for a pull stream +* [createClip](docs/sdks/stream/README.md#createclip) - Create a clip +* [getClips](docs/sdks/stream/README.md#getclips) - Retrieve clips of a livestream +* [addMultistreamTarget](docs/sdks/stream/README.md#addmultistreamtarget) - Add a multistream target +* [removeMultistreamTarget](docs/sdks/stream/README.md#removemultistreamtarget) - Remove a multistream target ### [task()](docs/sdks/task/README.md) @@ -251,75 +339,93 @@ public class Application { * [create](docs/sdks/transcode/README.md#create) - Transcode a video -### [playback()](docs/sdks/playback/README.md) +### [webhook()](docs/sdks/webhook/README.md) -* [get](docs/sdks/playback/README.md#get) - Retrieve Playback Info +* [getAll](docs/sdks/webhook/README.md#getall) - Retrieve a Webhook +* [create](docs/sdks/webhook/README.md#create) - Create a webhook +* [get](docs/sdks/webhook/README.md#get) - Retrieve a webhook +* [update](docs/sdks/webhook/README.md#update) - Update a webhook +* [delete](docs/sdks/webhook/README.md#delete) - Delete a webhook +* [getLogs](docs/sdks/webhook/README.md#getlogs) - Retrieve webhook logs +* [getLog](docs/sdks/webhook/README.md#getlog) - Retrieve a webhook log +* [resendLog](docs/sdks/webhook/README.md#resendlog) - Resend a webhook + +
## Error Handling -Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Exception type. +Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception. -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/Error | 404 | application/json | -| models/errors/SDKError | 4xx-5xx | \*\/* | -### Example +[`LivepeerException`](./src/main/java/models/errors/LivepeerException.java) is the base class for all HTTP error responses. It has the following properties: + +| Method | Type | Description | +| ---------------- | --------------------------- | ------------------------------------------------------------------------ | +| `message()` | `String` | Error message | +| `code()` | `int` | HTTP response status code eg `404` | +| `headers` | `Map>` | HTTP response headers | +| `body()` | `byte[]` | HTTP body as a byte array. Can be empty array if no body is returned. | +| `bodyAsString()` | `String` | HTTP body as a UTF-8 string. Can be empty string if no body is returned. | +| `rawResponse()` | `HttpResponse` | Raw HTTP response (body already read and not available for re-read) | +### Example ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.models.operations.GetPlaybackInfoResponse; public class Application { - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); + public static void main(String[] args) throws Error, Exception { - GetPlaybackInfoResponse res = sdk.playback().get() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetPlaybackInfoResponse res = sdk.playback().get() + .id("") .call(); - if (res.playbackInfo().isPresent()) { - // handle response - } - } catch (studio.livepeer.livepeer.models.errors.Error e) { - // handle exception - throw e; - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.playbackInfo().isPresent()) { + // handle response } - } } ``` - - -## Server Selection +### Error Classes +**Primary error:** +* [`LivepeerException`](./src/main/java/models/errors/LivepeerException.java): The base class for HTTP error responses. + +
Less common errors (7) + +
-### Select Server by Index +**Network errors:** +* `java.io.IOException` (always wrapped by `java.io.UncheckedIOException`). Commonly encountered subclasses of +`IOException` include `java.net.ConnectException`, `java.net.SocketTimeoutException`, `EOFException` (there are +many more subclasses in the JDK platform). -You can override the default server globally by passing a server index to the `serverIndex` builder method when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers: +**Inherit from [`LivepeerException`](./src/main/java/models/errors/LivepeerException.java)**: +* [`studio.livepeer.livepeer.models.errors.Error`](./src/main/java/models/errors/studio.livepeer.livepeer.models.errors.Error.java): Playback not found. Status code `404`. Applicable to 1 of 57 methods.* -| # | Server | Variables | -| - | ------ | --------- | -| 0 | `https://livepeer.studio/api` | None | -#### Example +
+ +\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable. + + + +## Server Selection +### Override Server URL Per-Client + +The default server can be overridden globally using the `.serverURL(String serverUrl)` builder method when initializing the SDK client instance. For example: ```java package hello.world; @@ -327,41 +433,27 @@ import java.lang.Exception; import java.util.List; import java.util.Map; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.components.FfmpegProfile; -import studio.livepeer.livepeer.models.components.Location; -import studio.livepeer.livepeer.models.components.Multistream; -import studio.livepeer.livepeer.models.components.NewStreamPayload; -import studio.livepeer.livepeer.models.components.NewStreamPayloadRecordingSpec; -import studio.livepeer.livepeer.models.components.PlaybackPolicy; -import studio.livepeer.livepeer.models.components.Profile; -import studio.livepeer.livepeer.models.components.Pull; -import studio.livepeer.livepeer.models.components.Target; -import studio.livepeer.livepeer.models.components.TargetSpec; -import studio.livepeer.livepeer.models.components.TranscodeProfile; -import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; -import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; -import studio.livepeer.livepeer.models.components.Type; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.components.*; import studio.livepeer.livepeer.models.operations.CreateStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .serverIndex(0) - .apiKey("") - .build(); - NewStreamPayload req = NewStreamPayload.builder() + Livepeer sdk = Livepeer.builder() + .serverURL("https://livepeer.studio/api") + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + NewStreamPayload req = NewStreamPayload.builder() .name("test_stream") .pull(Pull.builder() .source("https://myservice.com/live/stream.flv") .headers(Map.ofEntries( Map.entry("Authorization", "Bearer 123"))) .location(Location.builder() - .lat(39.739d) - .lon(-104.988d) + .lat(39.739) + .lon(-104.988) .build()) .build()) .playbackPolicy(PlaybackPolicy.builder() @@ -402,152 +494,89 @@ public class Application { .multistream(Multistream.builder() .targets(List.of( Target.builder() - .profile("720p0") - .videoOnly(false) + .profile("720p") .id("PUSH123") - .spec(TargetSpec.builder() - .url("rtmps://live.my-service.tv/channel/secretKey") - .name("My target") - .build()) .build())) .build()) .build(); - CreateStreamResponse res = sdk.stream().create() + CreateStreamResponse res = sdk.stream().create() .request(req) .call(); - if (res.stream().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.stream().isPresent()) { + // handle response } - } } ``` + + +## Asynchronous Support -### Override Server URL Per-Client +The SDK provides comprehensive asynchronous support using Java's [`CompletableFuture`][comp-fut] and [Reactive Streams `Publisher`][reactive-streams] APIs. This design makes no assumptions about your choice of reactive toolkit, allowing seamless integration with any reactive library. -The default server can also be overridden globally by passing a URL to the `serverURL` builder method when initializing the SDK client instance. For example: -```java -package hello.world; +
+Why Use Async? -import java.lang.Exception; -import java.util.List; -import java.util.Map; -import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.components.FfmpegProfile; -import studio.livepeer.livepeer.models.components.Location; -import studio.livepeer.livepeer.models.components.Multistream; -import studio.livepeer.livepeer.models.components.NewStreamPayload; -import studio.livepeer.livepeer.models.components.NewStreamPayloadRecordingSpec; -import studio.livepeer.livepeer.models.components.PlaybackPolicy; -import studio.livepeer.livepeer.models.components.Profile; -import studio.livepeer.livepeer.models.components.Pull; -import studio.livepeer.livepeer.models.components.Target; -import studio.livepeer.livepeer.models.components.TargetSpec; -import studio.livepeer.livepeer.models.components.TranscodeProfile; -import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; -import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; -import studio.livepeer.livepeer.models.components.Type; -import studio.livepeer.livepeer.models.errors.SDKError; -import studio.livepeer.livepeer.models.operations.CreateStreamResponse; +Asynchronous operations provide several key benefits: -public class Application { +- **Non-blocking I/O**: Your threads stay free for other work while operations are in flight +- **Better resource utilization**: Handle more concurrent operations with fewer threads +- **Improved scalability**: Build highly responsive applications that can handle thousands of concurrent requests +- **Reactive integration**: Works seamlessly with reactive streams and backpressure handling - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .serverURL("https://livepeer.studio/api") - .apiKey("") - .build(); +
- NewStreamPayload req = NewStreamPayload.builder() - .name("test_stream") - .pull(Pull.builder() - .source("https://myservice.com/live/stream.flv") - .headers(Map.ofEntries( - Map.entry("Authorization", "Bearer 123"))) - .location(Location.builder() - .lat(39.739d) - .lon(-104.988d) - .build()) - .build()) - .playbackPolicy(PlaybackPolicy.builder() - .type(Type.WEBHOOK) - .webhookId("1bde4o2i6xycudoy") - .webhookContext(Map.ofEntries( - Map.entry("streamerId", "my-custom-id"))) - .refreshInterval(600d) - .build()) - .profiles(List.of( - FfmpegProfile.builder() - .width(1280L) - .name("720p") - .height(720L) - .bitrate(3000000L) - .fps(30L) - .fpsDen(1L) - .quality(23L) - .gop("2") - .profile(Profile.H264_BASELINE) - .build())) - .record(false) - .recordingSpec(NewStreamPayloadRecordingSpec.builder() - .profiles(List.of( - TranscodeProfile.builder() - .bitrate(3000000L) - .width(1280L) - .name("720p") - .height(720L) - .quality(23L) - .fps(30L) - .fpsDen(1L) - .gop("2") - .profile(TranscodeProfileProfile.H264_BASELINE) - .encoder(TranscodeProfileEncoder.H264) - .build())) - .build()) - .multistream(Multistream.builder() - .targets(List.of( - Target.builder() - .profile("720p0") - .videoOnly(false) - .id("PUSH123") - .spec(TargetSpec.builder() - .url("rtmps://live.my-service.tv/channel/secretKey") - .name("My target") - .build()) - .build())) - .build()) - .build(); +
+Reactive Library Integration - CreateStreamResponse res = sdk.stream().create() - .request(req) - .call(); +The SDK returns [Reactive Streams `Publisher`][reactive-streams] instances for operations dealing with streams involving multiple I/O interactions. We use Reactive Streams instead of JDK Flow API to provide broader compatibility with the reactive ecosystem, as most reactive libraries natively support Reactive Streams. - if (res.stream().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; - } +**Why Reactive Streams over JDK Flow?** +- **Broader ecosystem compatibility**: Most reactive libraries (Project Reactor, RxJava, Akka Streams, etc.) natively support Reactive Streams +- **Industry standard**: Reactive Streams is the de facto standard for reactive programming in Java +- **Better interoperability**: Seamless integration without additional adapters for most use cases - } -} +**Integration with Popular Libraries:** +- **Project Reactor**: Use `Flux.from(publisher)` to convert to Reactor types +- **RxJava**: Use `Flowable.fromPublisher(publisher)` for RxJava integration +- **Akka Streams**: Use `Source.fromPublisher(publisher)` for Akka Streams integration +- **Vert.x**: Use `ReadStream.fromPublisher(vertx, publisher)` for Vert.x reactive streams +- **Mutiny**: Use `Multi.createFrom().publisher(publisher)` for Quarkus Mutiny integration + +**For JDK Flow API Integration:** +If you need JDK Flow API compatibility (e.g., for Quarkus/Mutiny 2), you can use adapters: +```java +// Convert Reactive Streams Publisher to Flow Publisher +Flow.Publisher flowPublisher = FlowAdapters.toFlowPublisher(reactiveStreamsPublisher); + +// Convert Flow Publisher to Reactive Streams Publisher +Publisher reactiveStreamsPublisher = FlowAdapters.toPublisher(flowPublisher); ``` - + +For standard single-response operations, the SDK returns `CompletableFuture` for straightforward async execution. + +
+ +
+Supported Operations + +Async support is available for: + +- **[Server-sent Events](#server-sent-event-streaming)**: Stream real-time events with Reactive Streams `Publisher` +- **[JSONL Streaming](#jsonl-streaming)**: Process streaming JSON lines asynchronously +- **[Pagination](#pagination)**: Iterate through paginated results using `callAsPublisher()` and `callAsPublisherUnwrapped()` +- **[File Uploads](#file-uploads)**: Upload files asynchronously with progress tracking +- **[File Downloads](#file-downloads)**: Download files asynchronously with streaming support +- **[Standard Operations](#example)**: All regular API calls return `CompletableFuture` for async execution + +
+ +[comp-fut]: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html +[reactive-streams]: https://www.reactive-streams.org/ + ## Authentication @@ -556,9 +585,9 @@ public class Application { This SDK supports the following security scheme globally: -| Name | Type | Scheme | -| ----------- | ----------- | ----------- | -| `apiKey` | http | HTTP Bearer | +| Name | Type | Scheme | +| -------- | ---- | ----------- | +| `apiKey` | http | HTTP Bearer | To authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example: ```java @@ -568,40 +597,26 @@ import java.lang.Exception; import java.util.List; import java.util.Map; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.components.FfmpegProfile; -import studio.livepeer.livepeer.models.components.Location; -import studio.livepeer.livepeer.models.components.Multistream; -import studio.livepeer.livepeer.models.components.NewStreamPayload; -import studio.livepeer.livepeer.models.components.NewStreamPayloadRecordingSpec; -import studio.livepeer.livepeer.models.components.PlaybackPolicy; -import studio.livepeer.livepeer.models.components.Profile; -import studio.livepeer.livepeer.models.components.Pull; -import studio.livepeer.livepeer.models.components.Target; -import studio.livepeer.livepeer.models.components.TargetSpec; -import studio.livepeer.livepeer.models.components.TranscodeProfile; -import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; -import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; -import studio.livepeer.livepeer.models.components.Type; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.components.*; import studio.livepeer.livepeer.models.operations.CreateStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - NewStreamPayload req = NewStreamPayload.builder() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + NewStreamPayload req = NewStreamPayload.builder() .name("test_stream") .pull(Pull.builder() .source("https://myservice.com/live/stream.flv") .headers(Map.ofEntries( Map.entry("Authorization", "Bearer 123"))) .location(Location.builder() - .lat(39.739d) - .lon(-104.988d) + .lat(39.739) + .lon(-104.988) .build()) .build()) .playbackPolicy(PlaybackPolicy.builder() @@ -642,37 +657,191 @@ public class Application { .multistream(Multistream.builder() .targets(List.of( Target.builder() - .profile("720p0") - .videoOnly(false) + .profile("720p") .id("PUSH123") - .spec(TargetSpec.builder() - .url("rtmps://live.my-service.tv/channel/secretKey") - .name("My target") - .build()) .build())) .build()) .build(); - CreateStreamResponse res = sdk.stream().create() + CreateStreamResponse res = sdk.stream().create() .request(req) .call(); - if (res.stream().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.stream().isPresent()) { + // handle response } - } } ``` + +## Custom HTTP Client + +The Java SDK makes API calls using an `HTTPClient` that wraps the native +[HttpClient](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html). This +client provides the ability to attach hooks around the request lifecycle that can be used to modify the request or handle +errors and response. + +The `HTTPClient` interface allows you to either use the default `SpeakeasyHTTPClient` that comes with the SDK, +or provide your own custom implementation with customized configuration such as custom executors, SSL context, +connection pools, and other HTTP client settings. + +The interface provides synchronous (`send`) methods and asynchronous (`sendAsync`) methods. The `sendAsync` method +is used to power the async SDK methods and returns a `CompletableFuture>` for non-blocking operations. + +The following example shows how to add a custom header and handle errors: + +```java +import studio.livepeer.livepeer.Livepeer; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.SpeakeasyHTTPClient; +import studio.livepeer.livepeer.utils.Utils; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.io.InputStream; +import java.time.Duration; + +public class Application { + public static void main(String[] args) { + // Create a custom HTTP client with hooks + HTTPClient httpClient = new HTTPClient() { + private final HTTPClient defaultClient = new SpeakeasyHTTPClient(); + + @Override + public HttpResponse send(HttpRequest request) throws IOException, URISyntaxException, InterruptedException { + // Add custom header and timeout using Utils.copy() + HttpRequest modifiedRequest = Utils.copy(request) + .header("x-custom-header", "custom value") + .timeout(Duration.ofSeconds(30)) + .build(); + + try { + HttpResponse response = defaultClient.send(modifiedRequest); + // Log successful response + System.out.println("Request successful: " + response.statusCode()); + return response; + } catch (Exception error) { + // Log error + System.err.println("Request failed: " + error.getMessage()); + throw error; + } + } + }; + + Livepeer sdk = Livepeer.builder() + .client(httpClient) + .build(); + } +} +``` + +
+Custom HTTP Client Configuration + +You can also provide a completely custom HTTP client with your own configuration: + +```java +import studio.livepeer.livepeer.Livepeer; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.ResponseWithBody; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.io.InputStream; +import java.time.Duration; +import java.util.concurrent.Executors; +import java.util.concurrent.CompletableFuture; + +public class Application { + public static void main(String[] args) { + // Custom HTTP client with custom configuration + HTTPClient customHttpClient = new HTTPClient() { + private final HttpClient client = HttpClient.newBuilder() + .executor(Executors.newFixedThreadPool(10)) + .connectTimeout(Duration.ofSeconds(30)) + // .sslContext(customSslContext) // Add custom SSL context if needed + .build(); + + @Override + public HttpResponse send(HttpRequest request) throws IOException, URISyntaxException, InterruptedException { + return client.send(request, HttpResponse.BodyHandlers.ofInputStream()); + } + + @Override + public CompletableFuture> sendAsync(HttpRequest request) { + // Convert response to HttpResponse for async operations + return client.sendAsync(request, HttpResponse.BodyHandlers.ofPublisher()) + .thenApply(resp -> new ResponseWithBody<>(resp, Blob::from)); + } + }; + + Livepeer sdk = Livepeer.builder() + .client(customHttpClient) + .build(); + } +} +``` + +
+ +You can also enable debug logging on the default `SpeakeasyHTTPClient`: + +```java +import studio.livepeer.livepeer.Livepeer; +import studio.livepeer.livepeer.utils.SpeakeasyHTTPClient; + +public class Application { + public static void main(String[] args) { + SpeakeasyHTTPClient httpClient = new SpeakeasyHTTPClient(); + httpClient.enableDebugLogging(true); + + Livepeer sdk = Livepeer.builder() + .client(httpClient) + .build(); + } +} +``` + + + +## Debugging + +### Debug +You can setup your SDK to emit debug logs for SDK requests and responses. + +For request and response logging (especially json bodies), call `enableHTTPDebugLogging(boolean)` on the SDK builder like so: +```java +SDK.builder() + .enableHTTPDebugLogging(true) + .build(); +``` +Example output: +``` +Sending request: http://localhost:35123/bearer#global GET +Request headers: {Accept=[application/json], Authorization=[******], Client-Level-Header=[added by client], Idempotency-Key=[some-key], x-speakeasy-user-agent=[speakeasy-sdk/java 0.0.1 internal 0.1.0 org.openapis.openapi]} +Received response: (GET http://localhost:35123/bearer#global) 200 +Response headers: {access-control-allow-credentials=[true], access-control-allow-origin=[*], connection=[keep-alive], content-length=[50], content-type=[application/json], date=[Wed, 09 Apr 2025 01:43:29 GMT], server=[gunicorn/19.9.0]} +Response body: +{ + "authenticated": true, + "token": "global" +} +``` +__WARNING__: This should only used for temporary debugging purposes. Leaving this option on in a production system could expose credentials/secrets in logs. Authorization headers are redacted by default and there is the ability to specify redacted header names via `SpeakeasyHTTPClient.setRedactedHeaders`. + +__NOTE__: This is a convenience method that calls `HTTPClient.enableDebugLogging()`. The `SpeakeasyHTTPClient` honors this setting. If you are using a custom HTTP client, it is up to the custom client to honor this setting. + +Another option is to set the System property `-Djdk.httpclient.HttpClient.log=all`. However, this second option does not log bodies. + + # Development diff --git a/RELEASES.md b/RELEASES.md index b1002f15..61170249 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -46,4 +46,12 @@ Based on: - OpenAPI Doc - Speakeasy CLI 1.377.1 (2.404.1) https://github.com/speakeasy-api/speakeasy ### Generated -- [java v0.5.0] . \ No newline at end of file +- [java v0.5.0] . + +## 2025-10-27 00:13:07 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.639.3 (2.730.5) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v0.6.0] . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 76779275..ba24ecda 100644 --- a/USAGE.md +++ b/USAGE.md @@ -6,40 +6,26 @@ import java.lang.Exception; import java.util.List; import java.util.Map; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.components.FfmpegProfile; -import studio.livepeer.livepeer.models.components.Location; -import studio.livepeer.livepeer.models.components.Multistream; -import studio.livepeer.livepeer.models.components.NewStreamPayload; -import studio.livepeer.livepeer.models.components.NewStreamPayloadRecordingSpec; -import studio.livepeer.livepeer.models.components.PlaybackPolicy; -import studio.livepeer.livepeer.models.components.Profile; -import studio.livepeer.livepeer.models.components.Pull; -import studio.livepeer.livepeer.models.components.Target; -import studio.livepeer.livepeer.models.components.TargetSpec; -import studio.livepeer.livepeer.models.components.TranscodeProfile; -import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; -import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; -import studio.livepeer.livepeer.models.components.Type; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.components.*; import studio.livepeer.livepeer.models.operations.CreateStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - NewStreamPayload req = NewStreamPayload.builder() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + NewStreamPayload req = NewStreamPayload.builder() .name("test_stream") .pull(Pull.builder() .source("https://myservice.com/live/stream.flv") .headers(Map.ofEntries( Map.entry("Authorization", "Bearer 123"))) .location(Location.builder() - .lat(39.739d) - .lon(-104.988d) + .lat(39.739) + .lon(-104.988) .build()) .build()) .playbackPolicy(PlaybackPolicy.builder() @@ -80,32 +66,19 @@ public class Application { .multistream(Multistream.builder() .targets(List.of( Target.builder() - .profile("720p0") - .videoOnly(false) + .profile("720p") .id("PUSH123") - .spec(TargetSpec.builder() - .url("rtmps://live.my-service.tv/channel/secretKey") - .name("My target") - .build()) .build())) .build()) .build(); - CreateStreamResponse res = sdk.stream().create() + CreateStreamResponse res = sdk.stream().create() .request(req) .call(); - if (res.stream().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.stream().isPresent()) { + // handle response } - } } ``` diff --git a/build.gradle b/build.gradle index 630190a3..b9679e66 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,3 @@ - //////////////////////////////////////////////////////////////////////////////////////////// // This file is generated by Speakeasy and any edits will be lost in generation updates. // @@ -9,11 +8,13 @@ // of string where each string value is an additional line in the block) in gen.yaml. //////////////////////////////////////////////////////////////////////////////////////////// + plugins { // Apply the java-library plugin for API and implementation separation. id 'java-library' id 'maven-publish' id 'signing' + id "io.spring.dependency-management" version "1.1.6" apply false } compileJava.options.encoding = "UTF-8" @@ -26,23 +27,21 @@ repositories { } java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 withSourcesJar() withJavadocJar() } -model { - tasks.generatePomFileForMavenPublication { - destination = file("$buildDir/pom.xml") - } -} +version = "${version}" +group = "${groupId}" jar { - dependsOn(":generatePomFileForMavenPublication") + dependsOn 'generatePomFileForMavenPublication' into("META-INF/maven/studio.livepeer/livepeer") { - from("$buildDir/pom.xml") + from(layout.buildDirectory.file("pom.xml")) { + // Only include if it exists to avoid build ordering issues + duplicatesStrategy = DuplicatesStrategy.INCLUDE + } } } @@ -55,82 +54,85 @@ javadoc { options.addStringOption('Xdoclint:none', '-quiet') } -tasks.withType(Javadoc) { - failOnError false +tasks.withType(Javadoc).configureEach { + failOnError = false options.addStringOption('Xdoclint:none', '-quiet') } -group = "studio.livepeer" -version = "0.5.0" +tasks.withType(JavaCompile).configureEach { + options.release = 11 +} sourcesJar { - archiveBaseName = "livepeer" + archiveBaseName = "${artifactId}" } javadocJar { - archiveBaseName = "livepeer" + archiveBaseName = "${artifactId}" +} + +dependencies { + api 'com.fasterxml.jackson.core:jackson-annotations:2.18.2' + implementation 'com.fasterxml.jackson.core:jackson-databind:2.18.2' + implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2' + implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.2' + api('org.openapitools:jackson-databind-nullable:0.2.6') {exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'} + implementation 'commons-io:commons-io:2.18.0' + implementation 'jakarta.annotation:jakarta.annotation-api:3.0.0' + api 'org.reactivestreams:reactive-streams:1.0.4' } +ext { + springBootVersion = '2.7.18' +} -publishing { - - publications { - maven(MavenPublication) { - groupId = 'studio.livepeer' - artifactId = 'livepeer' - version = '0.5.0' - - from components.java - - pom { - name = 'My Company Java SDK' - description = 'SDK enabling Java developers to easily integrate with the My Company API.' - url = 'https://github.com/owner/repo' - scm { - url = 'github.com/owner/repo' - connection = 'scm:git:ssh://git@github.com/owner/repo.git' - } - licenses { - license { - name = 'The MIT License (MIT)' - url = 'https://mit-license.org/' - } - } - developers { - developer { - name = 'My Company' - organization = 'My Company' - email = 'info@mycompany.com' - } - } - organization { - name = 'My Company' - url = 'www.mycompany.com' - } +subprojects { + if (name in [ + 'openapi-spring-boot-autoconfigure', + 'openapi-spring-boot-starter' + ]) { + // Ensure subprojects use the same group and version as root project + group = rootProject.group + version = rootProject.version + + apply { + plugin "java-library" + plugin "io.spring.dependency-management" + plugin "maven-publish" + plugin "signing" + } + dependencyManagement { + imports { + mavenBom "org.springframework.boot:spring-boot-dependencies:${rootProject.springBootVersion}" } } - } -} + repositories { + mavenCentral() + } + java { + withSourcesJar() + withJavadocJar() + } + tasks.withType(JavaCompile).configureEach { + options.release = 11 + } -if (!project.hasProperty('skip.signing')) { - signing { - def signingKey = findProperty("signingKey") - def signingPassphrase = findProperty("signingPassphrase") - useInMemoryPgpKeys(signingKey, signingPassphrase) - sign publishing.publications.maven + // Apply publishing configuration to all subprojects - they'll check for publishingConfig internally + apply from: rootProject.file('publishing.gradle') } } -dependencies { - implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.2' - implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2' - implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2' - implementation 'org.openapitools:jackson-databind-nullable:0.2.6' - implementation 'org.apache.httpcomponents:httpclient:4.5.14' - implementation 'org.apache.httpcomponents:httpmime:4.5.14' - implementation 'commons-io:commons-io:2.15.1' +ext { + publishingConfig = [ + groupId: group, + artifactId: artifactId, + version: version, + name: "My Company Java SDK", + description: "SDK enabling Java developers to easily integrate with the My Company API.", + publicationName: "maven" + ] } +apply from: 'publishing.gradle' - -apply from: 'build-extras.gradle' +apply from: 'build-extras.gradle' \ No newline at end of file diff --git a/codeSamples.yaml b/codeSamples.yaml index cde5191e..03fc2a32 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -3,208 +3,150 @@ info: title: CodeSamples overlay for java target version: 0.0.0 actions: - - target: $["paths"]["/access-control/signing-key"]["post"] + - target: $["paths"]["/access-control/signing-key"]["get"] update: x-codeSamples: - lang: java - label: createSigningKey + label: getSigningKeys source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.CreateSigningKeyResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetSigningKeysResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - CreateSigningKeyResponse res = sdk.accessControl().create() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetSigningKeysResponse res = sdk.accessControl().getAll() .call(); - if (res.signingKey().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } - - target: $["paths"]["/playback/{id}"]["get"] + - target: $["paths"]["/access-control/signing-key"]["post"] update: x-codeSamples: - lang: java - label: getPlaybackInfo + label: createSigningKey source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetPlaybackInfoResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.CreateSigningKeyResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetPlaybackInfoResponse res = sdk.playback().get() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + CreateSigningKeyResponse res = sdk.accessControl().create() .call(); - if (res.playbackInfo().isPresent()) { - // handle response - } - } catch (studio.livepeer.livepeer.models.errors.Error e) { - // handle exception - throw e; - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.signingKey().isPresent()) { + // handle response } - } } - - target: $["paths"]["/stream/{id}"]["delete"] + - target: $["paths"]["/access-control/signing-key/{keyId}"]["delete"] update: x-codeSamples: - lang: java - label: deleteStream + label: deleteSigningKey source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.DeleteStreamResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.DeleteSigningKeyResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - DeleteStreamResponse res = sdk.stream().delete() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + DeleteSigningKeyResponse res = sdk.accessControl().delete() + .keyId("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/multistream/target/{id}"]["get"] + - target: $["paths"]["/access-control/signing-key/{keyId}"]["get"] update: x-codeSamples: - lang: java - label: getMultistreamTarget + label: getSigningKey source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetMultistreamTargetResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetSigningKeyResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetMultistreamTargetResponse res = sdk.multistream().get() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetSigningKeyResponse res = sdk.accessControl().get() + .keyId("") .call(); - if (res.multistreamTarget().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.signingKey().isPresent()) { + // handle response } - } } - - target: $["paths"]["/webhook"]["post"] + - target: $["paths"]["/access-control/signing-key/{keyId}"]["patch"] update: x-codeSamples: - lang: java - label: createWebhook + label: updateSigningKey source: |- package hello.world; import java.lang.Exception; - import java.util.List; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.Events; - import studio.livepeer.livepeer.models.components.WebhookInput; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.CreateWebhookResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.UpdateSigningKeyRequestBody; + import org.openapis.openapi.models.operations.UpdateSigningKeyResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - WebhookInput req = WebhookInput.builder() - .name("test_webhook") - .url("https://my-service.com/webhook") - .projectId("aac12556-4d65-4d34-9fb6-d1f0985eb0a9") - .events(List.of( - Events.STREAM_STARTED, - Events.STREAM_IDLE)) - .sharedSecret("my-secret") - .streamId("de7818e7-610a-4057-8f6f-b785dc1e6f88") - .build(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - CreateWebhookResponse res = sdk.webhook().create() - .request(req) + UpdateSigningKeyResponse res = sdk.accessControl().update() + .keyId("") + .requestBody(UpdateSigningKeyRequestBody.builder() + .build()) .call(); - if (res.webhook().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.error().isPresent()) { + // handle response } - } } - target: $["paths"]["/asset"]["get"] @@ -216,1229 +158,743 @@ actions: package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetAssetsResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetAssetsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetAssetsResponse res = sdk.asset().getAll() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetAssetsResponse res = sdk.asset().getAll() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } - - target: $["paths"]["/session/{id}/clips"]["get"] + - target: $["paths"]["/asset/request-upload"]["post"] update: x-codeSamples: - lang: java - label: getSessionClips + label: requestUpload source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetSessionClipsResponse; + import java.util.List; + import java.util.Map; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.components.*; + import org.openapis.openapi.models.operations.RequestUploadResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") + + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + NewAssetPayload req = NewAssetPayload.builder() + .name("filename.mp4") + .staticMp4(true) + .playbackPolicy(PlaybackPolicy.builder() + .type(Type.WEBHOOK) + .webhookId("1bde4o2i6xycudoy") + .webhookContext(Map.ofEntries( + Map.entry("streamerId", "my-custom-id"))) + .refreshInterval(600d) + .build()) + .profiles(List.of( + TranscodeProfile.builder() + .bitrate(3000000L) + .width(1280L) + .name("720p") + .height(720L) + .quality(23L) + .fps(30L) + .fpsDen(1L) + .gop("2") + .profile(TranscodeProfileProfile.H264_BASELINE) + .encoder(TranscodeProfileEncoder.H264) + .build())) .build(); - GetSessionClipsResponse res = sdk.session().getClips() - .id("") + RequestUploadResponse res = sdk.asset().create() + .request(req) .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } - - target: $["paths"]["/stream/{id}/clips"]["get"] + - target: $["paths"]["/asset/upload/url"]["post"] update: x-codeSamples: - lang: java - label: getClips + label: uploadAsset source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetClipsResponse; + import java.util.List; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.components.*; + import org.openapis.openapi.models.operations.UploadAssetResponse; + import org.openapitools.jackson.nullable.JsonNullable; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") + + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + NewAssetFromUrlPayload req = NewAssetFromUrlPayload.builder() + .name("filename.mp4") + .url("https://s3.amazonaws.com/my-bucket/path/filename.mp4") + .staticMp4(true) + .playbackPolicy(JsonNullable.of(null)) + .profiles(List.of( + TranscodeProfile.builder() + .bitrate(3000000L) + .width(1280L) + .name("720p") + .height(720L) + .quality(23L) + .fps(30L) + .fpsDen(1L) + .gop("2") + .profile(TranscodeProfileProfile.H264_BASELINE) + .encoder(TranscodeProfileEncoder.H264) + .build())) .build(); - GetClipsResponse res = sdk.stream().getClips() - .id("") + UploadAssetResponse res = sdk.asset().createViaUrl() + .request(req) .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.twoHundredApplicationJsonData().isPresent()) { + // handle response } - } } - - target: $["paths"]["/task/{taskId}"]["get"] + - target: $["paths"]["/asset/{assetId}"]["delete"] update: x-codeSamples: - lang: java - label: getTask + label: deleteAsset source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetTaskResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.DeleteAssetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetTaskResponse res = sdk.task().get() - .taskId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + DeleteAssetResponse res = sdk.asset().delete() + .assetId("") .call(); - if (res.task().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.error().isPresent()) { + // handle response } - } } - - target: $["paths"]["/clip"]["post"] + - target: $["paths"]["/asset/{assetId}"]["get"] update: x-codeSamples: - lang: java - label: createClip + label: getAsset source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.ClipPayload; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.CreateClipResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetAssetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - ClipPayload req = ClipPayload.builder() - .playbackId("eaw4nk06ts2d0mzb") - .startTime(1587667174725d) - .endTime(1587667174725d) - .name("My Clip") - .sessionId("de7818e7-610a-4057-8f6f-b785dc1e6f88") - .build(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - CreateClipResponse res = sdk.stream().createClip() - .request(req) + GetAssetResponse res = sdk.asset().get() + .assetId("") .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.asset().isPresent()) { + // handle response } - } } - - target: $["paths"]["/webhook/{id}"]["put"] + - target: $["paths"]["/asset/{assetId}"]["patch"] update: x-codeSamples: - lang: java - label: updateWebhook + label: updateAsset source: |- package hello.world; import java.lang.Exception; - import java.util.List; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.Events; - import studio.livepeer.livepeer.models.components.WebhookInput; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.UpdateWebhookResponse; + import java.util.Map; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.components.*; + import org.openapis.openapi.models.operations.UpdateAssetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - UpdateWebhookResponse res = sdk.webhook().update() - .id("") - .webhook(WebhookInput.builder() - .name("test_webhook") - .url("https://my-service.com/webhook") - .projectId("aac12556-4d65-4d34-9fb6-d1f0985eb0a9") - .events(List.of( - Events.STREAM_STARTED, - Events.STREAM_IDLE)) - .sharedSecret("my-secret") - .streamId("de7818e7-610a-4057-8f6f-b785dc1e6f88") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + UpdateAssetResponse res = sdk.asset().update() + .assetId("") + .assetPatchPayload(AssetPatchPayload.builder() + .name("filename.mp4") + .playbackPolicy(PlaybackPolicy.builder() + .type(Type.WEBHOOK) + .webhookId("1bde4o2i6xycudoy") + .webhookContext(Map.ofEntries( + Map.entry("streamerId", "my-custom-id"))) + .refreshInterval(600d) + .build()) .build()) .call(); - if (res.webhook().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.asset().isPresent()) { + // handle response } - } } - - target: $["paths"]["/room/{id}/egress"]["delete"] + - target: $["paths"]["/clip"]["post"] update: x-codeSamples: - lang: java - label: stopRoomEgress + label: createClip source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.StopRoomEgressResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.components.ClipPayload; + import org.openapis.openapi.models.operations.CreateClipResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") + + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + ClipPayload req = ClipPayload.builder() + .playbackId("eaw4nk06ts2d0mzb") + .startTime(1587667174725d) + .endTime(1587667174725d) + .name("My Clip") + .sessionId("de7818e7-610a-4057-8f6f-b785dc1e6f88") .build(); - StopRoomEgressResponse res = sdk.room().stopEgress() - .id("") + CreateClipResponse res = sdk.stream().createClip() + .request(req) .call(); + if (res.data().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/data/views/query"]["get"] + - target: $["paths"]["/data/usage/query"]["get"] update: x-codeSamples: - lang: java - label: getViewershipMetrics + label: getUsageMetrics source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetViewershipMetricsRequest; - import studio.livepeer.livepeer.models.operations.GetViewershipMetricsResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetUsageMetricsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetViewershipMetricsRequest req = GetViewershipMetricsRequest.builder() - .build(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - GetViewershipMetricsResponse res = sdk.metrics().getViewership() - .request(req) + GetUsageMetricsResponse res = sdk.metrics().getUsage() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.usageMetric().isPresent()) { + // handle response } - } } - - target: $["paths"]["/access-control/signing-key"]["get"] + - target: $["paths"]["/data/views/now"]["get"] update: x-codeSamples: - lang: java - label: getSigningKeys + label: getRealtimeViewershipNow source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetSigningKeysResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetRealtimeViewershipNowResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetSigningKeysResponse res = sdk.accessControl().getAll() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetRealtimeViewershipNowResponse res = sdk.metrics().getRealtimeViewership() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } - - target: $["paths"]["/stream/{id}/create-multistream-target"]["post"] + - target: $["paths"]["/data/views/query"]["get"] update: x-codeSamples: - lang: java - label: addMultistreamTarget + label: getViewershipMetrics source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.TargetAddPayload; - import studio.livepeer.livepeer.models.components.TargetAddPayloadSpec; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.AddMultistreamTargetResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetViewershipMetricsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - AddMultistreamTargetResponse res = sdk.stream().addMultistreamTarget() - .id("") - .targetAddPayload(TargetAddPayload.builder() - .profile("720p0") - .videoOnly(false) - .id("PUSH123") - .spec(TargetAddPayloadSpec.builder() - .url("rtmps://live.my-service.tv/channel/secretKey") - .name("My target") - .build()) - .build()) + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetViewershipMetricsResponse res = sdk.metrics().getViewership() .call(); + if (res.data().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/room"]["post"] + - target: $["paths"]["/data/views/query/creator"]["get"] update: x-codeSamples: - lang: java - label: createRoom + label: getCreatorViewershipMetrics source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.CreateRoomResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetCreatorViewershipMetricsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - CreateRoomResponse res = sdk.room().create() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetCreatorViewershipMetricsResponse res = sdk.metrics().getCreatorViewership() .call(); - if (res.createRoomResponse().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } - - target: $["paths"]["/room/{id}"]["get"] + - target: $["paths"]["/data/views/query/total/{playbackId}"]["get"] update: x-codeSamples: - lang: java - label: getRoom + label: getPublicViewershipMetrics source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetRoomResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetPublicViewershipMetricsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetRoomResponse res = sdk.room().get() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetPublicViewershipMetricsResponse res = sdk.metrics().getPublicViewership() + .playbackId("") .call(); - if (res.room().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } - - target: $["paths"]["/room/{id}"]["delete"] + - target: $["paths"]["/multistream/target"]["get"] update: x-codeSamples: - lang: java - label: deleteRoom + label: getMultistreamTargets source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.DeleteRoomResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetMultistreamTargetsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - DeleteRoomResponse res = sdk.room().delete() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetMultistreamTargetsResponse res = sdk.multistream().getAll() .call(); + if (res.data().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/room/{id}/user/{userId}"]["get"] + - target: $["paths"]["/multistream/target"]["post"] update: x-codeSamples: - lang: java - label: getRoomUser + label: createMultistreamTarget source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetRoomUserResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.components.MultistreamTargetInput; + import org.openapis.openapi.models.operations.CreateMultistreamTargetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") + + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + MultistreamTargetInput req = MultistreamTargetInput.builder() + .url("rtmps://live.my-service.tv/channel/secretKey") .build(); - GetRoomUserResponse res = sdk.room().getUser() - .id("") - .userId("") + CreateMultistreamTargetResponse res = sdk.multistream().create() + .request(req) .call(); - if (res.getRoomUserResponse().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.multistreamTarget().isPresent()) { + // handle response } - } } - - target: $["paths"]["/webhook"]["get"] + - target: $["paths"]["/multistream/target/{id}"]["delete"] update: x-codeSamples: - lang: java - label: getWebhooks + label: deleteMultistreamTarget source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetWebhooksResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.DeleteMultistreamTargetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetWebhooksResponse res = sdk.webhook().getAll() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + DeleteMultistreamTargetResponse res = sdk.multistream().delete() + .id("") .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.error().isPresent()) { + // handle response } - } } - - target: $["paths"]["/webhook/{id}"]["get"] + - target: $["paths"]["/multistream/target/{id}"]["get"] update: x-codeSamples: - lang: java - label: getWebhook + label: getMultistreamTarget source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetWebhookResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetMultistreamTargetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetWebhookResponse res = sdk.webhook().get() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetMultistreamTargetResponse res = sdk.multistream().get() + .id("") .call(); - if (res.webhook().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.multistreamTarget().isPresent()) { + // handle response } - } } - - target: $["paths"]["/room/{id}/user"]["post"] + - target: $["paths"]["/multistream/target/{id}"]["patch"] update: x-codeSamples: - lang: java - label: createRoomUser + label: updateMultistreamTarget source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.RoomUserPayload; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.CreateRoomUserResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.components.MultistreamTargetInput; + import org.openapis.openapi.models.operations.UpdateMultistreamTargetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - CreateRoomUserResponse res = sdk.room().createUser() - .id("") - .roomUserPayload(RoomUserPayload.builder() - .name("name") - .canPublish(true) - .canPublishData(true) + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + UpdateMultistreamTargetResponse res = sdk.multistream().update() + .id("") + .multistreamTarget(MultistreamTargetInput.builder() + .url("rtmps://live.my-service.tv/channel/secretKey") .build()) .call(); - if (res.roomUserResponse().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.error().isPresent()) { + // handle response } - } } - - target: $["paths"]["/multistream/target"]["post"] + - target: $["paths"]["/playback/{id}"]["get"] update: x-codeSamples: - lang: java - label: createMultistreamTarget + label: getPlaybackInfo source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.MultistreamTargetInput; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.CreateMultistreamTargetResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.errors.Error; + import org.openapis.openapi.models.operations.GetPlaybackInfoResponse; public class Application { - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); + public static void main(String[] args) throws Error, Exception { - MultistreamTargetInput req = MultistreamTargetInput.builder() - .url("rtmps://live.my-service.tv/channel/secretKey") - .build(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - CreateMultistreamTargetResponse res = sdk.multistream().create() - .request(req) - .call(); - - if (res.multistreamTarget().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; - } - - } - } - - target: $["paths"]["/multistream/target/{id}"]["patch"] - update: - x-codeSamples: - - lang: java - label: updateMultistreamTarget - source: |- - package hello.world; - - import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.MultistreamTargetPatchPayload; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.UpdateMultistreamTargetResponse; - - public class Application { - - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - UpdateMultistreamTargetResponse res = sdk.multistream().update() - .id("") - .multistreamTargetPatchPayload(MultistreamTargetPatchPayload.builder() - .url("rtmps://live.my-service.tv/channel/secretKey") - .build()) + GetPlaybackInfoResponse res = sdk.playback().get() + .id("") .call(); + if (res.playbackInfo().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/asset/request-upload"]["post"] + - target: $["paths"]["/session"]["get"] update: x-codeSamples: - lang: java - label: requestUpload + label: getSessions source: |- package hello.world; import java.lang.Exception; - import java.util.List; - import java.util.Map; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.NewAssetPayload; - import studio.livepeer.livepeer.models.components.PlaybackPolicy; - import studio.livepeer.livepeer.models.components.TranscodeProfile; - import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; - import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; - import studio.livepeer.livepeer.models.components.Type; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.RequestUploadResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetSessionsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - NewAssetPayload req = NewAssetPayload.builder() - .name("filename.mp4") - .staticMp4(true) - .playbackPolicy(PlaybackPolicy.builder() - .type(Type.WEBHOOK) - .webhookId("1bde4o2i6xycudoy") - .webhookContext(Map.ofEntries( - Map.entry("streamerId", "my-custom-id"))) - .refreshInterval(600d) - .build()) - .profiles(List.of( - TranscodeProfile.builder() - .bitrate(3000000L) - .width(1280L) - .name("720p") - .height(720L) - .quality(23L) - .fps(30L) - .fpsDen(1L) - .gop("2") - .profile(TranscodeProfileProfile.H264_BASELINE) - .encoder(TranscodeProfileEncoder.H264) - .build())) - .build(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - RequestUploadResponse res = sdk.asset().create() - .request(req) - .call(); - - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; - } - - } - } - - target: $["paths"]["/room/{id}/user/{userId}"]["put"] - update: - x-codeSamples: - - lang: java - label: updateRoomUser - source: |- - package hello.world; - - import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.RoomUserUpdatePayload; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.UpdateRoomUserResponse; - - public class Application { - - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - UpdateRoomUserResponse res = sdk.room().updateUser() - .id("") - .userId("") - .roomUserUpdatePayload(RoomUserUpdatePayload.builder() - .canPublish(true) - .canPublishData(true) - .build()) + GetSessionsResponse res = sdk.session().getAll() .call(); + if (res.data().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/data/views/query/total/{playbackId}"]["get"] + - target: $["paths"]["/session/{id}"]["get"] update: x-codeSamples: - lang: java - label: getPublicViewershipMetrics + label: getSession source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetSessionResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetPublicViewershipMetricsResponse res = sdk.metrics().getPublicViewership() - .playbackId("") - .call(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; - } - - } - } - - target: $["paths"]["/stream/{id}/multistream/{targetId}"]["delete"] - update: - x-codeSamples: - - lang: java - label: removeMultistreamTarget - source: |- - package hello.world; - - import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.RemoveMultistreamTargetResponse; - - public class Application { - - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - RemoveMultistreamTargetResponse res = sdk.stream().removeMultistreamTarget() - .id("") - .targetId("") + GetSessionResponse res = sdk.session().get() + .id("") .call(); + if (res.session().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/webhook/{id}"]["delete"] + - target: $["paths"]["/session/{id}/clips"]["get"] update: x-codeSamples: - lang: java - label: deleteWebhook + label: getSessionClips source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.DeleteWebhookResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetSessionClipsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - DeleteWebhookResponse res = sdk.webhook().delete() - .id("") - .call(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - if (res.webhook().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; - } - - } - } - - target: $["paths"]["/room/{id}/user/{userId}"]["delete"] - update: - x-codeSamples: - - lang: java - label: deleteRoomUser - source: |- - package hello.world; - - import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.DeleteRoomUserResponse; - - public class Application { - - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - DeleteRoomUserResponse res = sdk.room().deleteUser() - .id("") - .userId("") + GetSessionClipsResponse res = sdk.session().getClips() + .id("") .call(); + if (res.data().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/data/views/now"]["get"] - update: - x-codeSamples: - - lang: java - label: getRealtimeViewershipNow - source: |- - package hello.world; - - import java.lang.Exception; - import java.util.List; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.BreakdownBy; - import studio.livepeer.livepeer.models.operations.GetRealtimeViewershipNowResponse; - - public class Application { - - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - GetRealtimeViewershipNowResponse res = sdk.metrics().getRealtimeViewership() - .playbackId("") - .creatorId("") - .breakdownBy(List.of( - BreakdownBy.PLAYBACK_ID)) - .call(); - - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; - } - - } - } - - target: $["paths"]["/transcode"]["post"] + - target: $["paths"]["/stream"]["get"] update: x-codeSamples: - lang: java - label: transcodeVideo + label: getStreams source: |- package hello.world; import java.lang.Exception; - import java.util.List; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.Fmp4; - import studio.livepeer.livepeer.models.components.Hls; - import studio.livepeer.livepeer.models.components.Input1; - import studio.livepeer.livepeer.models.components.Input; - import studio.livepeer.livepeer.models.components.Mp4; - import studio.livepeer.livepeer.models.components.Outputs; - import studio.livepeer.livepeer.models.components.Storage1; - import studio.livepeer.livepeer.models.components.StorageCredentials; - import studio.livepeer.livepeer.models.components.StorageType; - import studio.livepeer.livepeer.models.components.TranscodePayload; - import studio.livepeer.livepeer.models.components.TranscodePayloadStorage; - import studio.livepeer.livepeer.models.components.TranscodeProfile; - import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; - import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.TranscodeVideoResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetStreamsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - TranscodePayload req = TranscodePayload.builder() - .input(Input.of(Input1.builder() - .url("https://s3.amazonaws.com/bucket/file.mp4") - .build())) - .storage(TranscodePayloadStorage.of(Storage1.builder() - .type(StorageType.S3) - .endpoint("https://gateway.storjshare.io") - .bucket("outputbucket") - .credentials(StorageCredentials.builder() - .accessKeyId("AKIAIOSFODNN7EXAMPLE") - .secretAccessKey("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY") - .build()) - .build())) - .outputs(Outputs.builder() - .hls(Hls.builder() - .path("/samplevideo/hls") - .build()) - .mp4(Mp4.builder() - .path("/samplevideo/mp4") - .build()) - .fmp4(Fmp4.builder() - .path("/samplevideo/fmp4") - .build()) - .build()) - .profiles(List.of( - TranscodeProfile.builder() - .bitrate(3000000L) - .width(1280L) - .name("720p") - .height(720L) - .quality(23L) - .fps(30L) - .fpsDen(1L) - .gop("2") - .profile(TranscodeProfileProfile.H264_BASELINE) - .encoder(TranscodeProfileEncoder.H264) - .build())) - .build(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - TranscodeVideoResponse res = sdk.transcode().create() - .request(req) + GetStreamsResponse res = sdk.stream().getAll() .call(); - if (res.task().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; - } - - } - } - - target: $["paths"]["/webhook/{id}/log"]["get"] - update: - x-codeSamples: - - lang: java - label: getWebhookLogs - source: |- - package hello.world; - - import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetWebhookLogsResponse; - - public class Application { - - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - GetWebhookLogsResponse res = sdk.webhook().getLogs() - .id("") - .call(); - - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } - - target: $["paths"]["/asset/upload/url"]["post"] + - target: $["paths"]["/stream"]["post"] update: x-codeSamples: - lang: java - label: uploadAsset + label: createStream source: |- package hello.world; import java.lang.Exception; import java.util.List; import java.util.Map; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.NewAssetFromUrlPayload; - import studio.livepeer.livepeer.models.components.PlaybackPolicy; - import studio.livepeer.livepeer.models.components.TranscodeProfile; - import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; - import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; - import studio.livepeer.livepeer.models.components.Type; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.UploadAssetResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.components.*; + import org.openapis.openapi.models.operations.CreateStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - NewAssetFromUrlPayload req = NewAssetFromUrlPayload.builder() - .name("filename.mp4") - .url("https://s3.amazonaws.com/my-bucket/path/filename.mp4") - .staticMp4(true) + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + NewStreamPayload req = NewStreamPayload.builder() + .name("test_stream") + .pull(Pull.builder() + .source("https://myservice.com/live/stream.flv") + .headers(Map.ofEntries( + Map.entry("Authorization", "Bearer 123"))) + .location(Location.builder() + .lat(39.739) + .lon(-104.988) + .build()) + .build()) .playbackPolicy(PlaybackPolicy.builder() .type(Type.WEBHOOK) .webhookId("1bde4o2i6xycudoy") @@ -1447,188 +903,107 @@ actions: .refreshInterval(600d) .build()) .profiles(List.of( - TranscodeProfile.builder() - .bitrate(3000000L) + FfmpegProfile.builder() .width(1280L) .name("720p") .height(720L) - .quality(23L) + .bitrate(3000000L) .fps(30L) .fpsDen(1L) + .quality(23L) .gop("2") - .profile(TranscodeProfileProfile.H264_BASELINE) - .encoder(TranscodeProfileEncoder.H264) + .profile(Profile.H264_BASELINE) .build())) + .record(false) + .recordingSpec(NewStreamPayloadRecordingSpec.builder() + .profiles(List.of( + TranscodeProfile.builder() + .bitrate(3000000L) + .width(1280L) + .name("720p") + .height(720L) + .quality(23L) + .fps(30L) + .fpsDen(1L) + .gop("2") + .profile(TranscodeProfileProfile.H264_BASELINE) + .encoder(TranscodeProfileEncoder.H264) + .build())) + .build()) + .multistream(Multistream.builder() + .targets(List.of( + Target.builder() + .profile("720p") + .id("PUSH123") + .build())) + .build()) .build(); - UploadAssetResponse res = sdk.asset().createViaUrl() + CreateStreamResponse res = sdk.stream().create() .request(req) .call(); - if (res.twoHundredApplicationJsonData().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.stream().isPresent()) { + // handle response } - } } - - target: $["paths"]["/data/usage/query"]["get"] + - target: $["paths"]["/stream/{id}"]["delete"] update: x-codeSamples: - lang: java - label: getUsageMetrics + label: deleteStream source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetUsageMetricsRequest; - import studio.livepeer.livepeer.models.operations.GetUsageMetricsResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.DeleteStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetUsageMetricsRequest req = GetUsageMetricsRequest.builder() - .build(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - GetUsageMetricsResponse res = sdk.metrics().getUsage() - .request(req) - .call(); - - if (res.usageMetric().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; - } - - } - } - - target: $["paths"]["/access-control/signing-key/{keyId}"]["delete"] - update: - x-codeSamples: - - lang: java - label: deleteSigningKey - source: |- - package hello.world; - - import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.DeleteSigningKeyResponse; - - public class Application { - - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - DeleteSigningKeyResponse res = sdk.accessControl().delete() - .keyId("") + DeleteStreamResponse res = sdk.stream().delete() + .id("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; - } - - } - } - - target: $["paths"]["/stream"]["get"] - update: - x-codeSamples: - - lang: java - label: getStreams - source: |- - package hello.world; - - import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetStreamsResponse; - - public class Application { - - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - GetStreamsResponse res = sdk.stream().getAll() - .streamsonly("") - .call(); - - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/session"]["get"] + - target: $["paths"]["/stream/{id}"]["get"] update: x-codeSamples: - lang: java - label: getSessions + label: getStream source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetSessionsResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetSessionsResponse res = sdk.session().getAll() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetStreamResponse res = sdk.stream().get() + .id("") .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.stream().isPresent()) { + // handle response } - } } - target: $["paths"]["/stream/{id}"]["patch"] @@ -1642,44 +1017,28 @@ actions: import java.lang.Exception; import java.util.List; import java.util.Map; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.FfmpegProfile; - import studio.livepeer.livepeer.models.components.Multistream; - import studio.livepeer.livepeer.models.components.PlaybackPolicy; - import studio.livepeer.livepeer.models.components.Profile; - import studio.livepeer.livepeer.models.components.RecordingSpec; - import studio.livepeer.livepeer.models.components.StreamPatchPayload; - import studio.livepeer.livepeer.models.components.Target; - import studio.livepeer.livepeer.models.components.TargetSpec; - import studio.livepeer.livepeer.models.components.TranscodeProfile; - import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; - import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; - import studio.livepeer.livepeer.models.components.Type; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.UpdateStreamResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.components.*; + import org.openapis.openapi.models.operations.UpdateStreamResponse; + import org.openapitools.jackson.nullable.JsonNullable; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - UpdateStreamResponse res = sdk.stream().update() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + UpdateStreamResponse res = sdk.stream().update() + .id("") .streamPatchPayload(StreamPatchPayload.builder() .record(false) .multistream(Multistream.builder() .targets(List.of( Target.builder() - .profile("720p0") - .videoOnly(false) + .profile("720p") .id("PUSH123") - .spec(TargetSpec.builder() - .url("rtmps://live.my-service.tv/channel/secretKey") - .name("My target") - .build()) .build())) .build()) .playbackPolicy(PlaybackPolicy.builder() @@ -1689,18 +1048,7 @@ actions: Map.entry("streamerId", "my-custom-id"))) .refreshInterval(600d) .build()) - .profiles(List.of( - FfmpegProfile.builder() - .width(1280L) - .name("720p") - .height(720L) - .bitrate(3000000L) - .fps(30L) - .fpsDen(1L) - .quality(23L) - .gop("2") - .profile(Profile.H264_BASELINE) - .build())) + .profiles(JsonNullable.of(null)) .recordingSpec(RecordingSpec.builder() .profiles(List.of( TranscodeProfile.builder() @@ -1716,205 +1064,169 @@ actions: .encoder(TranscodeProfileEncoder.H264) .build())) .build()) + .name("test_stream") .build()) .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/multistream/target"]["get"] + - target: $["paths"]["/stream/{id}/clips"]["get"] update: x-codeSamples: - lang: java - label: getMultistreamTargets + label: getClips source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetMultistreamTargetsResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetClipsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetMultistreamTargetsResponse res = sdk.multistream().getAll() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetClipsResponse res = sdk.stream().getClips() + .id("") .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } - - target: $["paths"]["/multistream/target/{id}"]["delete"] + - target: $["paths"]["/stream/{id}/create-multistream-target"]["post"] update: x-codeSamples: - lang: java - label: deleteMultistreamTarget + label: addMultistreamTarget source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.DeleteMultistreamTargetResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.components.TargetAddPayload; + import org.openapis.openapi.models.components.TargetAddPayloadSpec; + import org.openapis.openapi.models.operations.AddMultistreamTargetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - DeleteMultistreamTargetResponse res = sdk.multistream().delete() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + AddMultistreamTargetResponse res = sdk.stream().addMultistreamTarget() + .id("") + .targetAddPayload(TargetAddPayload.builder() + .profile("720p0") + .id("PUSH123") + .spec(TargetAddPayloadSpec.builder() + .url("rtmps://live.my-service.tv/channel/secretKey") + .name("My target") + .build()) + .build()) .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/stream/{id}/terminate"]["delete"] + - target: $["paths"]["/stream/{id}/multistream/{targetId}"]["delete"] update: x-codeSamples: - lang: java - label: terminateStream + label: removeMultistreamTarget source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.TerminateStreamResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.RemoveMultistreamTargetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - TerminateStreamResponse res = sdk.stream().terminate() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + RemoveMultistreamTargetResponse res = sdk.stream().removeMultistreamTarget() + .id("") + .targetId("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/data/views/query/creator"]["get"] + - target: $["paths"]["/stream/{id}/start-pull"]["post"] update: x-codeSamples: - lang: java - label: getCreatorViewershipMetrics + label: startPullStream source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsRequest; - import studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.StartPullStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetCreatorViewershipMetricsRequest req = GetCreatorViewershipMetricsRequest.builder() - .build(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - GetCreatorViewershipMetricsResponse res = sdk.metrics().getCreatorViewership() - .request(req) + StartPullStreamResponse res = sdk.stream().startPull() + .id("") .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.error().isPresent()) { + // handle response } - } } - - target: $["paths"]["/asset/{assetId}"]["delete"] + - target: $["paths"]["/stream/{id}/terminate"]["delete"] update: x-codeSamples: - lang: java - label: deleteAsset + label: terminateStream source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.DeleteAssetResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.TerminateStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - DeleteAssetResponse res = sdk.asset().delete() - .assetId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + TerminateStreamResponse res = sdk.stream().terminate() + .id("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - target: $["paths"]["/stream/{parentId}/sessions"]["get"] @@ -1926,582 +1238,419 @@ actions: package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetRecordedSessionsResponse; - import studio.livepeer.livepeer.models.operations.Record; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetRecordedSessionsResponse; + import org.openapis.openapi.models.operations.Record; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetRecordedSessionsResponse res = sdk.session().getRecorded() - .parentId("") - .record(Record.of(true)) - .call(); - - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; - } - - } - } - - target: $["paths"]["/room/{id}/egress"]["post"] - update: - x-codeSamples: - - lang: java - label: startRoomEgress - source: |- - package hello.world; - - import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.RoomEgressPayload; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.StartRoomEgressResponse; - - public class Application { + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - StartRoomEgressResponse res = sdk.room().startEgress() - .id("") - .roomEgressPayload(RoomEgressPayload.builder() - .streamId("aac12556-4d65-4d34-9fb6-d1f0985eb0a9") - .build()) + GetRecordedSessionsResponse res = sdk.session().getRecorded() + .parentId("") + .record(Record.of(true)) .call(); + if (res.data().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/stream/{id}/start-pull"]["post"] + - target: $["paths"]["/task"]["get"] update: x-codeSamples: - lang: java - label: startPullStream + label: getTasks source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.StartPullStreamResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetTasksResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - StartPullStreamResponse res = sdk.stream().startPull() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetTasksResponse res = sdk.task().getAll() .call(); + if (res.data().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/webhook/{id}/log/{logId}/resend"]["post"] + - target: $["paths"]["/task/{taskId}"]["get"] update: x-codeSamples: - lang: java - label: resendWebhook + label: getTask source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.ResendWebhookResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetTaskResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - ResendWebhookResponse res = sdk.webhook().resendLog() - .id("") - .logId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetTaskResponse res = sdk.task().get() + .taskId("") .call(); - if (res.webhookLog().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.task().isPresent()) { + // handle response } - } } - - target: $["paths"]["/stream"]["post"] + - target: $["paths"]["/transcode"]["post"] update: x-codeSamples: - lang: java - label: createStream + label: transcodeVideo source: |- package hello.world; import java.lang.Exception; import java.util.List; - import java.util.Map; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.FfmpegProfile; - import studio.livepeer.livepeer.models.components.Location; - import studio.livepeer.livepeer.models.components.Multistream; - import studio.livepeer.livepeer.models.components.NewStreamPayload; - import studio.livepeer.livepeer.models.components.NewStreamPayloadRecordingSpec; - import studio.livepeer.livepeer.models.components.PlaybackPolicy; - import studio.livepeer.livepeer.models.components.Profile; - import studio.livepeer.livepeer.models.components.Pull; - import studio.livepeer.livepeer.models.components.Target; - import studio.livepeer.livepeer.models.components.TargetSpec; - import studio.livepeer.livepeer.models.components.TranscodeProfile; - import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; - import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; - import studio.livepeer.livepeer.models.components.Type; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.CreateStreamResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.components.*; + import org.openapis.openapi.models.operations.TranscodeVideoResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - NewStreamPayload req = NewStreamPayload.builder() - .name("test_stream") - .pull(Pull.builder() - .source("https://myservice.com/live/stream.flv") - .headers(Map.ofEntries( - Map.entry("Authorization", "Bearer 123"))) - .location(Location.builder() - .lat(39.739d) - .lon(-104.988d) + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + TranscodePayload req = TranscodePayload.builder() + .input(Input.of(Input2.builder() + .type(InputType.S3) + .endpoint("https://gateway.storjshare.io") + .bucket("inputbucket") + .path("/path/file.mp4") + .credentials(Credentials.builder() + .accessKeyId("AKIAIOSFODNN7EXAMPLE") + .secretAccessKey("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY") + .build()) + .build())) + .storage(TranscodePayloadStorage.of(Storage1.builder() + .type(StorageType.S3) + .endpoint("https://gateway.storjshare.io") + .bucket("outputbucket") + .credentials(StorageCredentials.builder() + .accessKeyId("AKIAIOSFODNN7EXAMPLE") + .secretAccessKey("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY") + .build()) + .build())) + .outputs(Outputs.builder() + .hls(Hls.builder() + .path("/samplevideo/hls") + .build()) + .mp4(Mp4.builder() + .path("/samplevideo/mp4") + .build()) + .fmp4(Fmp4.builder() + .path("/samplevideo/fmp4") .build()) - .build()) - .playbackPolicy(PlaybackPolicy.builder() - .type(Type.WEBHOOK) - .webhookId("1bde4o2i6xycudoy") - .webhookContext(Map.ofEntries( - Map.entry("streamerId", "my-custom-id"))) - .refreshInterval(600d) .build()) .profiles(List.of( - FfmpegProfile.builder() + TranscodeProfile.builder() + .bitrate(3000000L) .width(1280L) .name("720p") .height(720L) - .bitrate(3000000L) + .quality(23L) .fps(30L) .fpsDen(1L) - .quality(23L) .gop("2") - .profile(Profile.H264_BASELINE) + .profile(TranscodeProfileProfile.H264_BASELINE) + .encoder(TranscodeProfileEncoder.H264) .build())) - .record(false) - .recordingSpec(NewStreamPayloadRecordingSpec.builder() - .profiles(List.of( - TranscodeProfile.builder() - .bitrate(3000000L) - .width(1280L) - .name("720p") - .height(720L) - .quality(23L) - .fps(30L) - .fpsDen(1L) - .gop("2") - .profile(TranscodeProfileProfile.H264_BASELINE) - .encoder(TranscodeProfileEncoder.H264) - .build())) - .build()) - .multistream(Multistream.builder() - .targets(List.of( - Target.builder() - .profile("720p0") - .videoOnly(false) - .id("PUSH123") - .spec(TargetSpec.builder() - .url("rtmps://live.my-service.tv/channel/secretKey") - .name("My target") - .build()) - .build())) - .build()) .build(); - CreateStreamResponse res = sdk.stream().create() + TranscodeVideoResponse res = sdk.transcode().create() .request(req) .call(); - if (res.stream().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.task().isPresent()) { + // handle response } - } } - - target: $["paths"]["/asset/{assetId}"]["patch"] + - target: $["paths"]["/webhook"]["get"] update: x-codeSamples: - lang: java - label: updateAsset + label: getWebhooks source: |- package hello.world; import java.lang.Exception; - import java.util.Map; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.components.AssetPatchPayload; - import studio.livepeer.livepeer.models.components.PlaybackPolicy; - import studio.livepeer.livepeer.models.components.Type; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.UpdateAssetResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetWebhooksResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - UpdateAssetResponse res = sdk.asset().update() - .assetId("") - .assetPatchPayload(AssetPatchPayload.builder() - .name("filename.mp4") - .playbackPolicy(PlaybackPolicy.builder() - .type(Type.WEBHOOK) - .webhookId("1bde4o2i6xycudoy") - .webhookContext(Map.ofEntries( - Map.entry("streamerId", "my-custom-id"))) - .refreshInterval(600d) - .build()) - .build()) + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetWebhooksResponse res = sdk.webhook().getAll() .call(); - if (res.asset().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } - - target: $["paths"]["/session/{id}"]["get"] + - target: $["paths"]["/webhook"]["post"] update: x-codeSamples: - lang: java - label: getSession + label: createWebhook source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetSessionResponse; + import java.util.List; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.components.Events; + import org.openapis.openapi.models.components.WebhookInput; + import org.openapis.openapi.models.operations.CreateWebhookResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") + + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + WebhookInput req = WebhookInput.builder() + .name("test_webhook") + .url("https://my-service.com/webhook") + .projectId("aac12556-4d65-4d34-9fb6-d1f0985eb0a9") + .events(List.of( + Events.STREAM_STARTED, + Events.STREAM_IDLE)) + .sharedSecret("my-secret") + .streamId("de7818e7-610a-4057-8f6f-b785dc1e6f88") .build(); - GetSessionResponse res = sdk.session().get() - .id("") + CreateWebhookResponse res = sdk.webhook().create() + .request(req) .call(); - if (res.session().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.webhook().isPresent()) { + // handle response } - } } - - target: $["paths"]["/access-control/signing-key/{keyId}"]["get"] + - target: $["paths"]["/webhook/{id}"]["delete"] update: x-codeSamples: - lang: java - label: getSigningKey + label: deleteWebhook source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetSigningKeyResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.DeleteWebhookResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetSigningKeyResponse res = sdk.accessControl().get() - .keyId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + DeleteWebhookResponse res = sdk.webhook().delete() + .id("") .call(); - if (res.signingKey().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.webhook().isPresent()) { + // handle response } - } } - - target: $["paths"]["/stream/{id}"]["get"] + - target: $["paths"]["/webhook/{id}"]["get"] update: x-codeSamples: - lang: java - label: getStream + label: getWebhook source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetStreamResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetWebhookResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetStreamResponse res = sdk.stream().get() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetWebhookResponse res = sdk.webhook().get() + .id("") .call(); - if (res.stream().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.webhook().isPresent()) { + // handle response } - } } - - target: $["paths"]["/webhook/{id}/log/{logId}"]["get"] + - target: $["paths"]["/webhook/{id}"]["put"] update: x-codeSamples: - lang: java - label: getWebhookLog + label: updateWebhook source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetWebhookLogResponse; + import java.util.List; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.components.Events; + import org.openapis.openapi.models.components.WebhookInput; + import org.openapis.openapi.models.operations.UpdateWebhookResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetWebhookLogResponse res = sdk.webhook().getLog() - .id("") - .logId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + UpdateWebhookResponse res = sdk.webhook().update() + .id("") + .webhook(WebhookInput.builder() + .name("test_webhook") + .url("https://my-service.com/webhook") + .projectId("aac12556-4d65-4d34-9fb6-d1f0985eb0a9") + .events(List.of( + Events.STREAM_STARTED, + Events.STREAM_IDLE)) + .sharedSecret("my-secret") + .streamId("de7818e7-610a-4057-8f6f-b785dc1e6f88") + .build()) .call(); - if (res.webhookLog().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.webhook().isPresent()) { + // handle response } - } } - - target: $["paths"]["/asset/{assetId}"]["get"] + - target: $["paths"]["/webhook/{id}/log"]["get"] update: x-codeSamples: - lang: java - label: getAsset + label: getWebhookLogs source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetAssetResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetWebhookLogsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetAssetResponse res = sdk.asset().get() - .assetId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetWebhookLogsResponse res = sdk.webhook().getLogs() + .id("") .call(); - if (res.asset().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } - - target: $["paths"]["/access-control/signing-key/{keyId}"]["patch"] + - target: $["paths"]["/webhook/{id}/log/{logId}"]["get"] update: x-codeSamples: - lang: java - label: updateSigningKey + label: getWebhookLog source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.UpdateSigningKeyRequestBody; - import studio.livepeer.livepeer.models.operations.UpdateSigningKeyResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.GetWebhookLogResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - UpdateSigningKeyResponse res = sdk.accessControl().update() - .keyId("") - .requestBody(UpdateSigningKeyRequestBody.builder() - .build()) + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetWebhookLogResponse res = sdk.webhook().getLog() + .id("") + .logId("") .call(); + if (res.webhookLog().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } - - target: $["paths"]["/task"]["get"] + - target: $["paths"]["/webhook/{id}/log/{logId}/resend"]["post"] update: x-codeSamples: - lang: java - label: getTasks + label: resendWebhook source: |- package hello.world; import java.lang.Exception; - import studio.livepeer.livepeer.Livepeer; - import studio.livepeer.livepeer.models.errors.SDKError; - import studio.livepeer.livepeer.models.operations.GetTasksResponse; + import org.openapis.openapi.Livepeer; + import org.openapis.openapi.models.operations.ResendWebhookResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetTasksResponse res = sdk.task().getAll() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + ResendWebhookResponse res = sdk.webhook().resendLog() + .id("") + .logId("") .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.webhookLog().isPresent()) { + // handle response } - } } diff --git a/docs/models/components/Asset.md b/docs/models/components/Asset.md index 0a086934..51c510e9 100644 --- a/docs/models/components/Asset.md +++ b/docs/models/components/Asset.md @@ -6,21 +6,21 @@ | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `id` | *String* | :heavy_check_mark: | N/A | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | -| `type` | [Optional](../../models/components/AssetType.md) | :heavy_minus_sign: | Type of the asset. | video | -| `playbackId` | *Optional* | :heavy_minus_sign: | The playback ID to use with the Playback Info endpoint to retrieve playback URLs. | eaw4nk06ts2d0mzb | -| ~~`userId`~~ | *Optional* | :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` | *Optional* | :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` | *Optional* | :heavy_minus_sign: | The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. It is not recommended to use this for playback. | https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video | -| `playbackPolicy` | [JsonNullable](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | +| `type` | [Optional\](../../models/components/AssetType.md) | :heavy_minus_sign: | Type of the asset. | video | +| `playbackId` | *Optional\* | :heavy_minus_sign: | The playback ID to use with the Playback Info endpoint to retrieve playback URLs. | eaw4nk06ts2d0mzb | +| ~~`userId`~~ | *Optional\* | :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` | *Optional\* | :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` | *Optional\* | :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` | [JsonNullable\](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | | `source` | [Source](../../models/components/Source.md) | :heavy_check_mark: | N/A | | -| `creatorId` | [Optional](../../models/components/CreatorId.md) | :heavy_minus_sign: | N/A | | -| `profiles` | List<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | Requested profiles for the asset to be transcoded into. Configured
on the upload APIs payload or through the `stream.recordingSpec`
field for recordings. If not specified, default profiles are derived
based on the source input. If this is a recording, the source will
not be present in this list but will be available for playback.
| | -| `storage` | [Optional](../../models/components/AssetStorage.md) | :heavy_minus_sign: | N/A | | -| `status` | [Optional](../../models/components/AssetStatus.md) | :heavy_minus_sign: | Status of the asset | | +| `creatorId` | [Optional\](../../models/components/CreatorId.md) | :heavy_minus_sign: | N/A | | +| `profiles` | List\<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | Requested profiles for the asset to be transcoded into. Configured
on the upload APIs payload or through the `stream.recordingSpec`
field for recordings. If not specified, default profiles are derived
based on the source input. If this is a recording, the source will
not be present in this list but will be available for playback.
| | +| `storage` | [Optional\](../../models/components/AssetStorage.md) | :heavy_minus_sign: | N/A | | +| `status` | [Optional\](../../models/components/AssetStatus.md) | :heavy_minus_sign: | Status of the asset | | | `name` | *String* | :heavy_check_mark: | The name of the asset. This is not necessarily the filename - it can be a custom name or title.
| filename.mp4 | -| `projectId` | *Optional* | :heavy_minus_sign: | The ID of the project | aac12556-4d65-4d34-9fb6-d1f0985eb0a9 | -| `createdAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which asset was created | 1587667174725 | -| `createdByTokenName` | *Optional* | :heavy_minus_sign: | Name of the token used to create this object | | -| `size` | *Optional* | :heavy_minus_sign: | Size of the asset in bytes | 84934509 | -| `hash` | List<[Hash](../../models/components/Hash.md)> | :heavy_minus_sign: | Hash of the asset | | -| `videoSpec` | [Optional](../../models/components/VideoSpec.md) | :heavy_minus_sign: | Video metadata | | \ No newline at end of file +| `projectId` | *Optional\* | :heavy_minus_sign: | The ID of the project | aac12556-4d65-4d34-9fb6-d1f0985eb0a9 | +| `createdAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which asset was created | 1587667174725 | +| `createdByTokenName` | *Optional\* | :heavy_minus_sign: | Name of the token used to create this object | | +| `size` | *Optional\* | :heavy_minus_sign: | Size of the asset in bytes | 84934509 | +| `hash` | List\<[Hash](../../models/components/Hash.md)> | :heavy_minus_sign: | Hash of the asset | | +| `videoSpec` | [Optional\](../../models/components/VideoSpec.md) | :heavy_minus_sign: | Video metadata | | \ No newline at end of file diff --git a/docs/models/components/AssetIpfs.md b/docs/models/components/AssetIpfs.md index fa75d658..1a0fc336 100644 --- a/docs/models/components/AssetIpfs.md +++ b/docs/models/components/AssetIpfs.md @@ -5,7 +5,7 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `spec` | [Optional](../../models/components/AssetSpec.md) | :heavy_minus_sign: | N/A | | -| `dollarRef` | *Optional* | :heavy_minus_sign: | N/A | | -| `nftMetadata` | [Optional](../../models/components/IpfsFileInfo.md) | :heavy_minus_sign: | N/A | | -| `updatedAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which IPFS export task was
updated
| 1587667174725 | \ No newline at end of file +| `spec` | [Optional\](../../models/components/AssetSpec.md) | :heavy_minus_sign: | N/A | | +| `dollarRef` | *Optional\* | :heavy_minus_sign: | N/A | | +| `nftMetadata` | [Optional\](../../models/components/IpfsFileInfo.md) | :heavy_minus_sign: | N/A | | +| `updatedAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which IPFS export task was
updated
| 1587667174725 | \ No newline at end of file diff --git a/docs/models/components/AssetPatchPayload.md b/docs/models/components/AssetPatchPayload.md index b133cb49..93cc78f4 100644 --- a/docs/models/components/AssetPatchPayload.md +++ b/docs/models/components/AssetPatchPayload.md @@ -5,7 +5,7 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `name` | *Optional* | :heavy_minus_sign: | The name of the asset. This is not necessarily the filename - it can be a custom name or title.
| filename.mp4 | -| `creatorId` | [Optional](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | | -| `playbackPolicy` | [JsonNullable](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | -| `storage` | [Optional](../../models/components/Storage.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `name` | *Optional\* | :heavy_minus_sign: | The name of the asset. This is not necessarily the filename - it can be a custom name or title.
| filename.mp4 | +| `creatorId` | [Optional\](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | | +| `playbackPolicy` | [JsonNullable\](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | +| `storage` | [Optional\](../../models/components/Storage.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/components/AssetSpec.md b/docs/models/components/AssetSpec.md index 6ac93986..1397e67d 100644 --- a/docs/models/components/AssetSpec.md +++ b/docs/models/components/AssetSpec.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `nftMetadataTemplate` | [Optional](../../models/components/AssetNftMetadataTemplate.md) | :heavy_minus_sign: | Name of the NFT metadata template to export. 'player'
will embed the Livepeer Player on the NFT while 'file'
will reference only the immutable MP4 files.
| -| `nftMetadata` | [Optional](../../models/components/AssetNftMetadata.md) | :heavy_minus_sign: | Additional data to add to the NFT metadata exported to
IPFS. Will be deep merged with the default metadata
exported.
| \ No newline at end of file +| `nftMetadataTemplate` | [Optional\](../../models/components/AssetNftMetadataTemplate.md) | :heavy_minus_sign: | Name of the NFT metadata template to export. 'player'
will embed the Livepeer Player on the NFT while 'file'
will reference only the immutable MP4 files.
| +| `nftMetadata` | [Optional\](../../models/components/AssetNftMetadata.md) | :heavy_minus_sign: | Additional data to add to the NFT metadata exported to
IPFS. Will be deep merged with the default metadata
exported.
| \ No newline at end of file diff --git a/docs/models/components/AssetStatus.md b/docs/models/components/AssetStatus.md index 1e44dcfe..b6c0d7ac 100644 --- a/docs/models/components/AssetStatus.md +++ b/docs/models/components/AssetStatus.md @@ -9,5 +9,5 @@ Status of the asset | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | | `phase` | [AssetPhase](../../models/components/AssetPhase.md) | :heavy_check_mark: | Phase of the asset | | | `updatedAt` | *double* | :heavy_check_mark: | Timestamp (in milliseconds) at which the asset was last updated | 1587667174725 | -| `progress` | *Optional* | :heavy_minus_sign: | Current progress of the task creating this asset. | | -| `errorMessage` | *Optional* | :heavy_minus_sign: | Error message if the asset creation failed. | | \ No newline at end of file +| `progress` | *Optional\* | :heavy_minus_sign: | Current progress of the task creating this asset. | | +| `errorMessage` | *Optional\* | :heavy_minus_sign: | Error message if the asset creation failed. | | \ No newline at end of file diff --git a/docs/models/components/AssetStorage.md b/docs/models/components/AssetStorage.md index c9803493..f10b30c6 100644 --- a/docs/models/components/AssetStorage.md +++ b/docs/models/components/AssetStorage.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `ipfs` | [Optional](../../models/components/AssetIpfs.md) | :heavy_minus_sign: | N/A | -| `status` | [Optional](../../models/components/StorageStatus.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `ipfs` | [Optional\](../../models/components/AssetIpfs.md) | :heavy_minus_sign: | N/A | +| `status` | [Optional\](../../models/components/StorageStatus.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/Attestation.md b/docs/models/components/Attestation.md index d78ee963..683f0f98 100644 --- a/docs/models/components/Attestation.md +++ b/docs/models/components/Attestation.md @@ -3,13 +3,13 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `id` | *Optional* | :heavy_minus_sign: | N/A | 5b9e63bb-6fd0-4bea-aff2-cc5d4eb9cad0 | -| `primaryType` | [PrimaryType](../../models/components/PrimaryType.md) | :heavy_check_mark: | Video Metadata EIP-712 primaryType | VideoAttestation | -| `domain` | [Domain](../../models/components/Domain.md) | :heavy_check_mark: | Video Metadata EIP-712 domain | | -| `message` | [Message](../../models/components/Message.md) | :heavy_check_mark: | Video Metadata EIP-712 message content | | -| `signature` | *String* | :heavy_check_mark: | Video Metadata EIP-712 message signature | 1311768467294899700 | -| `createdAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the object was created | 1587667174725 | -| `signatureType` | [Optional](../../models/components/SignatureType.md) | :heavy_minus_sign: | N/A | eip712 | -| `storage` | [Optional](../../models/components/AttestationStorage.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `id` | *Optional\* | :heavy_minus_sign: | N/A | 5b9e63bb-6fd0-4bea-aff2-cc5d4eb9cad0 | +| `primaryType` | [PrimaryType](../../models/components/PrimaryType.md) | :heavy_check_mark: | Video Metadata EIP-712 primaryType | VideoAttestation | +| `domain` | [Domain](../../models/components/Domain.md) | :heavy_check_mark: | Video Metadata EIP-712 domain | | +| `message` | [Message](../../models/components/Message.md) | :heavy_check_mark: | Video Metadata EIP-712 message content | | +| `signature` | *String* | :heavy_check_mark: | Video Metadata EIP-712 message signature | 1311768467294899700 | +| `createdAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the object was created | 1587667174725 | +| `signatureType` | [Optional\](../../models/components/SignatureType.md) | :heavy_minus_sign: | N/A | eip712 | +| `storage` | [Optional\](../../models/components/AttestationStorage.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/components/AttestationIpfs.md b/docs/models/components/AttestationIpfs.md index 37b92141..c4514878 100644 --- a/docs/models/components/AttestationIpfs.md +++ b/docs/models/components/AttestationIpfs.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `dollarRef` | *Optional* | :heavy_minus_sign: | N/A | | -| `updatedAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which IPFS export task was updated
| 1587667174725 | \ No newline at end of file +| `dollarRef` | *Optional\* | :heavy_minus_sign: | N/A | | +| `updatedAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which IPFS export task was updated
| 1587667174725 | \ No newline at end of file diff --git a/docs/models/components/AttestationStorage.md b/docs/models/components/AttestationStorage.md index ba5b9da3..764c4b1f 100644 --- a/docs/models/components/AttestationStorage.md +++ b/docs/models/components/AttestationStorage.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| `ipfs` | [Optional](../../models/components/AttestationIpfs.md) | :heavy_minus_sign: | N/A | -| `status` | [Optional](../../models/components/StorageStatus.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `ipfs` | [Optional\](../../models/components/AttestationIpfs.md) | :heavy_minus_sign: | N/A | +| `status` | [Optional\](../../models/components/StorageStatus.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/Clip.md b/docs/models/components/Clip.md index 5001d81e..f158df4e 100644 --- a/docs/models/components/Clip.md +++ b/docs/models/components/Clip.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `url` | *Optional* | :heavy_minus_sign: | URL of the asset to "clip" | https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4 | -| `clipStrategy` | [Optional](../../models/components/ClipStrategy.md) | :heavy_minus_sign: | Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. | | -| `catalystPipelineStrategy` | [Optional](../../models/components/CatalystPipelineStrategy.md) | :heavy_minus_sign: | Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. | catalyst_ffmpeg | -| `sessionId` | *Optional* | :heavy_minus_sign: | ID of the session | d32ae9e6-c459-4931-9898-e86e2f5e7e16 | -| `inputId` | *Optional* | :heavy_minus_sign: | ID of the input asset or stream | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | \ No newline at end of file +| `url` | *Optional\* | :heavy_minus_sign: | URL of the asset to "clip" | https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4 | +| `clipStrategy` | [Optional\](../../models/components/ClipStrategy.md) | :heavy_minus_sign: | Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. | | +| `catalystPipelineStrategy` | [Optional\](../../models/components/CatalystPipelineStrategy.md) | :heavy_minus_sign: | Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. | catalyst_ffmpeg | +| `sessionId` | *Optional\* | :heavy_minus_sign: | ID of the session | d32ae9e6-c459-4931-9898-e86e2f5e7e16 | +| `inputId` | *Optional\* | :heavy_minus_sign: | ID of the input asset or stream | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | \ No newline at end of file diff --git a/docs/models/components/ClipPayload.md b/docs/models/components/ClipPayload.md index a6c9c9b9..9139fde4 100644 --- a/docs/models/components/ClipPayload.md +++ b/docs/models/components/ClipPayload.md @@ -7,6 +7,6 @@ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `playbackId` | *String* | :heavy_check_mark: | The playback ID of the stream or stream recording to clip. Asset playback IDs are not supported yet. | eaw4nk06ts2d0mzb | | `startTime` | *double* | :heavy_check_mark: | The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ | 1587667174725 | -| `endTime` | *Optional* | :heavy_minus_sign: | The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ | 1587667174725 | -| `name` | *Optional* | :heavy_minus_sign: | The optional friendly name of the clip to create. | My Clip | -| `sessionId` | *Optional* | :heavy_minus_sign: | The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not specified, it will clip the ongoing livestream. | de7818e7-610a-4057-8f6f-b785dc1e6f88 | \ No newline at end of file +| `endTime` | *Optional\* | :heavy_minus_sign: | The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ | 1587667174725 | +| `name` | *Optional\* | :heavy_minus_sign: | The optional friendly name of the clip to create. | My Clip | +| `sessionId` | *Optional\* | :heavy_minus_sign: | The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not specified, it will clip the ongoing livestream. | de7818e7-610a-4057-8f6f-b785dc1e6f88 | \ No newline at end of file diff --git a/docs/models/components/ClipStrategy.md b/docs/models/components/ClipStrategy.md index 51ee330a..0aa2ad0d 100644 --- a/docs/models/components/ClipStrategy.md +++ b/docs/models/components/ClipStrategy.md @@ -7,6 +7,6 @@ Strategy to use for clipping the asset. If not specified, the default strategy t | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `startTime` | *Optional* | :heavy_minus_sign: | The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ | 1587667174725 | -| `endTime` | *Optional* | :heavy_minus_sign: | The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ | 1587667174725 | -| `playbackId` | *Optional* | :heavy_minus_sign: | The playback ID of the stream or stream recording to clip. Asset playback IDs are not supported yet. | eaw4nk06ts2d0mzb | \ No newline at end of file +| `startTime` | *Optional\* | :heavy_minus_sign: | The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ | 1587667174725 | +| `endTime` | *Optional\* | :heavy_minus_sign: | The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ | 1587667174725 | +| `playbackId` | *Optional\* | :heavy_minus_sign: | The playback ID of the stream or stream recording to clip. Asset playback IDs are not supported yet. | eaw4nk06ts2d0mzb | \ No newline at end of file diff --git a/docs/models/components/CreateRoomResponse.md b/docs/models/components/CreateRoomResponse.md index d1044269..8245d72f 100644 --- a/docs/models/components/CreateRoomResponse.md +++ b/docs/models/components/CreateRoomResponse.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `id` | *Optional* | :heavy_minus_sign: | The ID of the room | d32ae9e6-c459-4931-9898-e86e2f5e7e16 | \ No newline at end of file +| `id` | *Optional\* | :heavy_minus_sign: | The ID of the room | d32ae9e6-c459-4931-9898-e86e2f5e7e16 | \ No newline at end of file diff --git a/docs/models/components/Custom.md b/docs/models/components/Custom.md index 2620fca6..0101c60f 100644 --- a/docs/models/components/Custom.md +++ b/docs/models/components/Custom.md @@ -8,5 +8,5 @@ custom URL parameters for the export task | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | | `url` | *String* | :heavy_check_mark: | URL where to export the asset | https://s3.amazonaws.com/my-bucket/path/filename.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=LLMMB | -| `method` | *Optional* | :heavy_minus_sign: | Method to use on the export request | POST | -| `headers` | Map | :heavy_minus_sign: | Headers to add to the export request | | \ No newline at end of file +| `method` | *Optional\* | :heavy_minus_sign: | Method to use on the export request | POST | +| `headers` | Map\ | :heavy_minus_sign: | Headers to add to the export request | | \ No newline at end of file diff --git a/docs/models/components/DvrPlayback.md b/docs/models/components/DvrPlayback.md index 646cf7a8..98e0edbb 100644 --- a/docs/models/components/DvrPlayback.md +++ b/docs/models/components/DvrPlayback.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -| `hrn` | [Optional](../../models/components/PlaybackInfoHrn.md) | :heavy_minus_sign: | N/A | MP4 | -| `type` | [Optional](../../models/components/PlaybackInfoMetaDvrPlaybackType.md) | :heavy_minus_sign: | N/A | html5/video/mp4 | -| `url` | *Optional* | :heavy_minus_sign: | N/A | https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4 | -| `error` | *Optional* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `hrn` | [Optional\](../../models/components/PlaybackInfoHrn.md) | :heavy_minus_sign: | N/A | MP4 | +| `type` | [Optional\](../../models/components/PlaybackInfoMetaDvrPlaybackType.md) | :heavy_minus_sign: | N/A | html5/video/mp4 | +| `url` | *Optional\* | :heavy_minus_sign: | N/A | https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4 | +| `error` | *Optional\* | :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 00000000..1f7667cd --- /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 00000000..a2ba4c3d --- /dev/null +++ b/docs/models/components/Error.md @@ -0,0 +1,8 @@ +# Error + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `errors` | List\<*String*> | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/Export.md b/docs/models/components/Export.md index 10f17f8b..6a53263f 100644 --- a/docs/models/components/Export.md +++ b/docs/models/components/Export.md @@ -5,6 +5,6 @@ Output of the export task ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | -| `ipfs` | [Optional](../../models/components/TaskIpfs.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `ipfs` | [Optional\](../../models/components/TaskIpfs.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/ExportData.md b/docs/models/components/ExportData.md index 281f40d5..5f52bc79 100644 --- a/docs/models/components/ExportData.md +++ b/docs/models/components/ExportData.md @@ -5,6 +5,6 @@ Output of the export data task ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `ipfs` | [Optional](../../models/components/TaskOutputIpfs.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `ipfs` | [Optional\](../../models/components/TaskOutputIpfs.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/FfmpegProfile.md b/docs/models/components/FfmpegProfile.md index 8df3ef18..31d4bc30 100644 --- a/docs/models/components/FfmpegProfile.md +++ b/docs/models/components/FfmpegProfile.md @@ -12,8 +12,8 @@ Transcode profile | `height` | *long* | :heavy_check_mark: | N/A | 720 | | `bitrate` | *long* | :heavy_check_mark: | N/A | 3000000 | | `fps` | *long* | :heavy_check_mark: | N/A | 30 | -| `fpsDen` | *Optional* | :heavy_minus_sign: | N/A | 1 | -| `quality` | *Optional* | :heavy_minus_sign: | Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it.
| 23 | -| `gop` | *Optional* | :heavy_minus_sign: | N/A | 2 | -| `profile` | [Optional](../../models/components/Profile.md) | :heavy_minus_sign: | N/A | H264Baseline | -| `encoder` | [Optional](../../models/components/Encoder.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `fpsDen` | *Optional\* | :heavy_minus_sign: | N/A | 1 | +| `quality` | *Optional\* | :heavy_minus_sign: | Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it.
| 23 | +| `gop` | *Optional\* | :heavy_minus_sign: | N/A | 2 | +| `profile` | [Optional\](../../models/components/Profile.md) | :heavy_minus_sign: | N/A | H264Baseline | +| `encoder` | [Optional\](../../models/components/Encoder.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/components/GetRoomUserResponse.md b/docs/models/components/GetRoomUserResponse.md index 94ea838d..51664db5 100644 --- a/docs/models/components/GetRoomUserResponse.md +++ b/docs/models/components/GetRoomUserResponse.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | -| `id` | *Optional* | :heavy_minus_sign: | The ID of the user | d32ae9e6-c459-4931-9898-e86e2f5e7e16 | -| `joinedAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the user joined | 1687517025261 | -| `name` | *Optional* | :heavy_minus_sign: | The display name of the user | name | -| `isPublisher` | *Optional* | :heavy_minus_sign: | Whether a user is allowed to publish audio/video tracks | true | -| `metadata` | *Optional* | :heavy_minus_sign: | User defined payload to store for the participant | | \ No newline at end of file +| `id` | *Optional\* | :heavy_minus_sign: | The ID of the user | d32ae9e6-c459-4931-9898-e86e2f5e7e16 | +| `joinedAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the user joined | 1687517025261 | +| `name` | *Optional\* | :heavy_minus_sign: | The display name of the user | name | +| `isPublisher` | *Optional\* | :heavy_minus_sign: | Whether a user is allowed to publish audio/video tracks | true | +| `metadata` | *Optional\* | :heavy_minus_sign: | User defined payload to store for the participant | | \ No newline at end of file diff --git a/docs/models/components/Hash.md b/docs/models/components/Hash.md index 17f177c5..991f86cc 100644 --- a/docs/models/components/Hash.md +++ b/docs/models/components/Hash.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `hash` | *Optional* | :heavy_minus_sign: | Hash of the asset | 9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57 | -| `algorithm` | *Optional* | :heavy_minus_sign: | Hash algorithm used to compute the hash | sha256 | \ No newline at end of file +| `hash` | *Optional\* | :heavy_minus_sign: | Hash of the asset | 9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57 | +| `algorithm` | *Optional\* | :heavy_minus_sign: | Hash algorithm used to compute the hash | sha256 | \ No newline at end of file diff --git a/docs/models/components/Ipfs1.md b/docs/models/components/Ipfs1.md index e400eb81..049f69ed 100644 --- a/docs/models/components/Ipfs1.md +++ b/docs/models/components/Ipfs1.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `spec` | [JsonNullable](../../models/components/Spec.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| `spec` | [JsonNullable\](../../models/components/Spec.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/IpfsExportParams.md b/docs/models/components/IpfsExportParams.md index 07775b83..8e10c904 100644 --- a/docs/models/components/IpfsExportParams.md +++ b/docs/models/components/IpfsExportParams.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | -| `dollarRef` | *Optional* | :heavy_minus_sign: | N/A | -| `pinata` | [Optional](../../models/components/Pinata.md) | :heavy_minus_sign: | Custom credentials for the Piñata service. Must have either
a JWT or an API key and an API secret.
| \ No newline at end of file +| `dollarRef` | *Optional\* | :heavy_minus_sign: | N/A | +| `pinata` | [Optional\](../../models/components/Pinata.md) | :heavy_minus_sign: | Custom credentials for the Piñata service. Must have either
a JWT or an API key and an API secret.
| \ No newline at end of file diff --git a/docs/models/components/IpfsFileInfo.md b/docs/models/components/IpfsFileInfo.md index 58a46384..75ce3d9f 100644 --- a/docs/models/components/IpfsFileInfo.md +++ b/docs/models/components/IpfsFileInfo.md @@ -6,5 +6,5 @@ | Field | Type | Required | Description | | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | | `cid` | *String* | :heavy_check_mark: | CID of the file on IPFS | -| `url` | *Optional* | :heavy_minus_sign: | URL with IPFS scheme for the file | -| `gatewayUrl` | *Optional* | :heavy_minus_sign: | URL to access file via HTTP through an IPFS gateway | \ No newline at end of file +| `url` | *Optional\* | :heavy_minus_sign: | URL with IPFS scheme for the file | +| `gatewayUrl` | *Optional\* | :heavy_minus_sign: | URL to access file via HTTP through an IPFS gateway | \ No newline at end of file diff --git a/docs/models/components/LastFailure.md b/docs/models/components/LastFailure.md index 125cfbd8..4d540638 100644 --- a/docs/models/components/LastFailure.md +++ b/docs/models/components/LastFailure.md @@ -7,7 +7,7 @@ failure timestamp and error message with status code | Field | Type | Required | Description | Example | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `timestamp` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the webhook last failed | 1587667174725 | -| `error` | *Optional* | :heavy_minus_sign: | Webhook failure error message | Error message | -| `response` | *Optional* | :heavy_minus_sign: | Webhook failure response | Response body | -| `statusCode` | *Optional* | :heavy_minus_sign: | Webhook failure status code | 500 | \ No newline at end of file +| `timestamp` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the webhook last failed | 1587667174725 | +| `error` | *Optional\* | :heavy_minus_sign: | Webhook failure error message | Error message | +| `response` | *Optional\* | :heavy_minus_sign: | Webhook failure response | Response body | +| `statusCode` | *Optional\* | :heavy_minus_sign: | Webhook failure status code | 500 | \ No newline at end of file diff --git a/docs/models/components/Message.md b/docs/models/components/Message.md index c6207fd7..98362a78 100644 --- a/docs/models/components/Message.md +++ b/docs/models/components/Message.md @@ -5,9 +5,9 @@ Video Metadata EIP-712 message content ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | -| `video` | *String* | :heavy_check_mark: | N/A | 5b9e63bb-6fd0-4bea-aff2-cc5d4eb9cad0 | -| `attestations` | List<[Attestations](../../models/components/Attestations.md)> | :heavy_check_mark: | N/A | | -| `signer` | *String* | :heavy_check_mark: | N/A | 1311768467294899700 | -| `timestamp` | *double* | :heavy_check_mark: | N/A | 1587667174725 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `video` | *String* | :heavy_check_mark: | N/A | 5b9e63bb-6fd0-4bea-aff2-cc5d4eb9cad0 | +| `attestations` | List\<[Attestations](../../models/components/Attestations.md)> | :heavy_check_mark: | N/A | | +| `signer` | *String* | :heavy_check_mark: | N/A | 1311768467294899700 | +| `timestamp` | *double* | :heavy_check_mark: | N/A | 1587667174725 | \ No newline at end of file diff --git a/docs/models/components/Meta.md b/docs/models/components/Meta.md index 1555f4bf..b3796440 100644 --- a/docs/models/components/Meta.md +++ b/docs/models/components/Meta.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `live` | [Optional](../../models/components/Live.md) | :heavy_minus_sign: | N/A | 0 | -| `playbackPolicy` | [JsonNullable](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | -| `source` | List<[PlaybackInfoSource](../../models/components/PlaybackInfoSource.md)> | :heavy_check_mark: | N/A | | -| `dvrPlayback` | List<[DvrPlayback](../../models/components/DvrPlayback.md)> | :heavy_minus_sign: | N/A | | -| `attestation` | [Optional](../../models/components/Attestation.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `live` | [Optional\](../../models/components/Live.md) | :heavy_minus_sign: | N/A | 0 | +| `playbackPolicy` | [JsonNullable\](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | +| `source` | List\<[PlaybackInfoSource](../../models/components/PlaybackInfoSource.md)> | :heavy_check_mark: | N/A | | +| `dvrPlayback` | List\<[DvrPlayback](../../models/components/DvrPlayback.md)> | :heavy_minus_sign: | N/A | | +| `attestation` | [Optional\](../../models/components/Attestation.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/components/Multistream.md b/docs/models/components/Multistream.md index d221a15c..15b70136 100644 --- a/docs/models/components/Multistream.md +++ b/docs/models/components/Multistream.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| `targets` | List<[Target](../../models/components/Target.md)> | :heavy_minus_sign: | References to targets where this stream will be simultaneously
streamed to
| [
{
"id": "PUSH123",
"profile": "720p"
}
] | \ No newline at end of file +| `targets` | List\<[Target](../../models/components/Target.md)> | :heavy_minus_sign: | References to targets where this stream will be simultaneously
streamed to
| [
{
"id": "PUSH123",
"profile": "720p"
}
] | \ No newline at end of file diff --git a/docs/models/components/MultistreamTarget.md b/docs/models/components/MultistreamTarget.md index db6d018c..8a2c6c23 100644 --- a/docs/models/components/MultistreamTarget.md +++ b/docs/models/components/MultistreamTarget.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| `id` | *Optional* | :heavy_minus_sign: | N/A | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | -| `name` | *Optional* | :heavy_minus_sign: | N/A | | -| ~~`userId`~~ | *Optional* | :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 | -| `disabled` | *Optional* | :heavy_minus_sign: | If true then this multistream target will not be used for pushing
even if it is configured in a stream object.
| | -| `createdAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which multistream target object was
created
| 1587667174725 | \ No newline at end of file +| `id` | *Optional\* | :heavy_minus_sign: | N/A | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | +| `name` | *Optional\* | :heavy_minus_sign: | N/A | | +| ~~`userId`~~ | *Optional\* | :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 | +| `disabled` | *Optional\* | :heavy_minus_sign: | If true then this multistream target will not be used for pushing
even if it is configured in a stream object.
| | +| `createdAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which multistream target object was
created
| 1587667174725 | \ No newline at end of file diff --git a/docs/models/components/MultistreamTargetPatchPayload.md b/docs/models/components/MultistreamTargetInput.md similarity index 90% rename from docs/models/components/MultistreamTargetPatchPayload.md rename to docs/models/components/MultistreamTargetInput.md index b88be5c9..b34eca02 100644 --- a/docs/models/components/MultistreamTargetPatchPayload.md +++ b/docs/models/components/MultistreamTargetInput.md @@ -1,10 +1,10 @@ -# MultistreamTargetPatchPayload +# MultistreamTargetInput ## Fields | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | -| `name` | *Optional* | :heavy_minus_sign: | N/A | | +| `name` | *Optional\* | :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` | *Optional* | :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 +| `disabled` | *Optional\* | :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/NewAssetFromUrlPayload.md b/docs/models/components/NewAssetFromUrlPayload.md index 319a022f..30156358 100644 --- a/docs/models/components/NewAssetFromUrlPayload.md +++ b/docs/models/components/NewAssetFromUrlPayload.md @@ -6,12 +6,12 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `name` | *String* | :heavy_check_mark: | The name of the asset. This is not necessarily the filename - it can be a custom name or title.
| filename.mp4 | -| `staticMp4` | *Optional* | :heavy_minus_sign: | Whether to generate MP4s for the asset. | true | -| `playbackPolicy` | [JsonNullable](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | -| `creatorId` | [Optional](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | | -| `storage` | [Optional](../../models/components/Storage.md) | :heavy_minus_sign: | N/A | | +| `staticMp4` | *Optional\* | :heavy_minus_sign: | Whether to generate MP4s for the asset. | true | +| `playbackPolicy` | [JsonNullable\](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | +| `creatorId` | [Optional\](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | | +| `storage` | [Optional\](../../models/components/Storage.md) | :heavy_minus_sign: | N/A | | | `url` | *String* | :heavy_check_mark: | URL where the asset contents can be retrieved, e.g. `https://s3.amazonaws.com/my-bucket/path/filename.mp4`.
For an IPFS source, this should be similar to: `ipfs://{CID}`. For an Arweave
source: `ar://{CID}`.
| https://s3.amazonaws.com/my-bucket/path/filename.mp4 | -| `encryption` | [Optional](../../models/components/Encryption.md) | :heavy_minus_sign: | N/A | | -| `c2pa` | *Optional* | :heavy_minus_sign: | Decides if the output video should include C2PA signature | | -| `profiles` | List<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | | -| `targetSegmentSizeSecs` | *Optional* | :heavy_minus_sign: | How many seconds the duration of each output segment should be | | \ No newline at end of file +| `encryption` | [Optional\](../../models/components/Encryption.md) | :heavy_minus_sign: | N/A | | +| `c2pa` | *Optional\* | :heavy_minus_sign: | Decides if the output video should include C2PA signature | | +| `profiles` | List\<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | | +| `targetSegmentSizeSecs` | *Optional\* | :heavy_minus_sign: | How many seconds the duration of each output segment should be | | \ No newline at end of file diff --git a/docs/models/components/NewAssetPayload.md b/docs/models/components/NewAssetPayload.md index e55a41a2..20eef0ab 100644 --- a/docs/models/components/NewAssetPayload.md +++ b/docs/models/components/NewAssetPayload.md @@ -6,11 +6,11 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | | `name` | *String* | :heavy_check_mark: | The name of the asset. This is not necessarily the filename - it can be a custom name or title.
| filename.mp4 | -| `staticMp4` | *Optional* | :heavy_minus_sign: | Whether to generate MP4s for the asset. | true | -| `playbackPolicy` | [JsonNullable](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | -| `creatorId` | [Optional](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | | -| `storage` | [Optional](../../models/components/NewAssetPayloadStorage.md) | :heavy_minus_sign: | N/A | | -| `encryption` | [Optional](../../models/components/NewAssetPayloadEncryption.md) | :heavy_minus_sign: | N/A | | -| `c2pa` | *Optional* | :heavy_minus_sign: | Decides if the output video should include C2PA signature | | -| `profiles` | List<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | | -| `targetSegmentSizeSecs` | *Optional* | :heavy_minus_sign: | How many seconds the duration of each output segment should be | | \ No newline at end of file +| `staticMp4` | *Optional\* | :heavy_minus_sign: | Whether to generate MP4s for the asset. | true | +| `playbackPolicy` | [JsonNullable\](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | +| `creatorId` | [Optional\](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | | +| `storage` | [Optional\](../../models/components/NewAssetPayloadStorage.md) | :heavy_minus_sign: | N/A | | +| `encryption` | [Optional\](../../models/components/NewAssetPayloadEncryption.md) | :heavy_minus_sign: | N/A | | +| `c2pa` | *Optional\* | :heavy_minus_sign: | Decides if the output video should include C2PA signature | | +| `profiles` | List\<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | | +| `targetSegmentSizeSecs` | *Optional\* | :heavy_minus_sign: | How many seconds the duration of each output segment should be | | \ No newline at end of file diff --git a/docs/models/components/NewAssetPayloadIpfs1.md b/docs/models/components/NewAssetPayloadIpfs1.md index 5b7fd537..225de3ab 100644 --- a/docs/models/components/NewAssetPayloadIpfs1.md +++ b/docs/models/components/NewAssetPayloadIpfs1.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `spec` | [JsonNullable](../../models/components/Spec.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| `spec` | [JsonNullable\](../../models/components/Spec.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/NewAssetPayloadStorage.md b/docs/models/components/NewAssetPayloadStorage.md index bb469fcb..8c1ccf44 100644 --- a/docs/models/components/NewAssetPayloadStorage.md +++ b/docs/models/components/NewAssetPayloadStorage.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `ipfs` | [JsonNullable](../../models/components/NewAssetPayloadIpfs.md) | :heavy_minus_sign: | Set to true to make default export to IPFS. To customize the
pinned files, specify an object with a spec field. False or null
means to unpin from IPFS, but it's unsupported right now.
| \ No newline at end of file +| `ipfs` | [JsonNullable\](../../models/components/NewAssetPayloadIpfs.md) | :heavy_minus_sign: | Set to true to make default export to IPFS. To customize the
pinned files, specify an object with a spec field. False or null
means to unpin from IPFS, but it's unsupported right now.
| \ No newline at end of file diff --git a/docs/models/components/NewStreamPayload.md b/docs/models/components/NewStreamPayload.md index 52833af2..0beea4d3 100644 --- a/docs/models/components/NewStreamPayload.md +++ b/docs/models/components/NewStreamPayload.md @@ -6,11 +6,11 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `name` | *String* | :heavy_check_mark: | N/A | test_stream | -| `pull` | [Optional](../../models/components/Pull.md) | :heavy_minus_sign: | Configuration for a stream that should be actively pulled from an
external source, rather than pushed to Livepeer. If specified, the
stream will not have a streamKey. | | -| `creatorId` | [Optional](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | | -| `playbackPolicy` | [JsonNullable](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | -| `profiles` | List<[FfmpegProfile](../../models/components/FfmpegProfile.md)> | :heavy_minus_sign: | N/A | | -| `record` | *Optional* | :heavy_minus_sign: | Should this stream be recorded? Uses default settings. For more
customization, create and configure an object store.
| false | -| `recordingSpec` | [Optional](../../models/components/NewStreamPayloadRecordingSpec.md) | :heavy_minus_sign: | N/A | | -| `multistream` | [Optional](../../models/components/Multistream.md) | :heavy_minus_sign: | N/A | | -| `userTags` | Map | :heavy_minus_sign: | User input tags associated with the stream | | \ No newline at end of file +| `pull` | [Optional\](../../models/components/Pull.md) | :heavy_minus_sign: | Configuration for a stream that should be actively pulled from an
external source, rather than pushed to Livepeer. If specified, the
stream will not have a streamKey. | | +| `creatorId` | [Optional\](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | | +| `playbackPolicy` | [JsonNullable\](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | +| `profiles` | List\<[FfmpegProfile](../../models/components/FfmpegProfile.md)> | :heavy_minus_sign: | N/A | | +| `record` | *Optional\* | :heavy_minus_sign: | Should this stream be recorded? Uses default settings. For more
customization, create and configure an object store.
| false | +| `recordingSpec` | [Optional\](../../models/components/NewStreamPayloadRecordingSpec.md) | :heavy_minus_sign: | N/A | | +| `multistream` | [Optional\](../../models/components/Multistream.md) | :heavy_minus_sign: | N/A | | +| `userTags` | Map\ | :heavy_minus_sign: | User input tags associated with the stream | | \ No newline at end of file diff --git a/docs/models/components/NewStreamPayloadRecordingSpec.md b/docs/models/components/NewStreamPayloadRecordingSpec.md index 0234fb07..b04200f2 100644 --- a/docs/models/components/NewStreamPayloadRecordingSpec.md +++ b/docs/models/components/NewStreamPayloadRecordingSpec.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `profiles` | List<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `profiles` | List\<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/Output.md b/docs/models/components/Output.md index 3aa3cd59..10803cb7 100644 --- a/docs/models/components/Output.md +++ b/docs/models/components/Output.md @@ -5,8 +5,8 @@ Output of the task ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | -| `upload` | Map | :heavy_minus_sign: | Output of the upload task | -| `export` | [Optional](../../models/components/Export.md) | :heavy_minus_sign: | Output of the export task | -| `exportData` | [Optional](../../models/components/ExportData.md) | :heavy_minus_sign: | Output of the export data task | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `upload` | [Optional\](../../models/components/TaskUpload.md) | :heavy_minus_sign: | Output of the upload task | +| `export` | [Optional\](../../models/components/Export.md) | :heavy_minus_sign: | Output of the export task | +| `exportData` | [Optional\](../../models/components/ExportData.md) | :heavy_minus_sign: | Output of the export data task | \ No newline at end of file diff --git a/docs/models/components/Outputs.md b/docs/models/components/Outputs.md index 21f8824f..e58d6e5c 100644 --- a/docs/models/components/Outputs.md +++ b/docs/models/components/Outputs.md @@ -5,8 +5,8 @@ Output formats ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | -| `hls` | [Optional](../../models/components/Hls.md) | :heavy_minus_sign: | HLS output format | -| `mp4` | [Optional](../../models/components/Mp4.md) | :heavy_minus_sign: | MP4 output format | -| `fmp4` | [Optional](../../models/components/Fmp4.md) | :heavy_minus_sign: | FMP4 output format | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `hls` | [Optional\](../../models/components/Hls.md) | :heavy_minus_sign: | HLS output format | +| `mp4` | [Optional\](../../models/components/Mp4.md) | :heavy_minus_sign: | MP4 output format | +| `fmp4` | [Optional\](../../models/components/Fmp4.md) | :heavy_minus_sign: | FMP4 output format | \ No newline at end of file diff --git a/docs/models/components/Params.md b/docs/models/components/Params.md index f84e148b..082b32d2 100644 --- a/docs/models/components/Params.md +++ b/docs/models/components/Params.md @@ -5,10 +5,10 @@ Parameters of the task ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `upload` | [Optional](../../models/components/Upload.md) | :heavy_minus_sign: | Parameters for the upload task | -| `export` | [Optional](../../models/components/ExportTaskParams.md) | :heavy_minus_sign: | Parameters for the export task | -| `exportData` | [Optional](../../models/components/TaskExportData.md) | :heavy_minus_sign: | Parameters for the export-data task | -| `transcodeFile` | [Optional](../../models/components/TranscodeFile.md) | :heavy_minus_sign: | Parameters for the transcode-file task | -| `clip` | [Optional](../../models/components/Clip.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `upload` | [Optional\](../../models/components/Upload.md) | :heavy_minus_sign: | Parameters for the upload task | +| `export` | [Optional\](../../models/components/ExportTaskParams.md) | :heavy_minus_sign: | Parameters for the export task | +| `exportData` | [Optional\](../../models/components/TaskExportData.md) | :heavy_minus_sign: | Parameters for the export-data task | +| `transcodeFile` | [Optional\](../../models/components/TranscodeFile.md) | :heavy_minus_sign: | Parameters for the transcode-file task | +| `clip` | [Optional\](../../models/components/Clip.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/Participants.md b/docs/models/components/Participants.md index 47e19685..4da6126d 100644 --- a/docs/models/components/Participants.md +++ b/docs/models/components/Participants.md @@ -5,7 +5,7 @@ | Field | Type | Required | Description | | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `identity` | *Optional* | :heavy_minus_sign: | participant ID | -| `name` | *Optional* | :heavy_minus_sign: | user defined participant name | -| `joinedAt` | *Optional* | :heavy_minus_sign: | the time the participant joined | -| `leftAt` | *Optional* | :heavy_minus_sign: | the time the participant left | \ No newline at end of file +| `identity` | *Optional\* | :heavy_minus_sign: | participant ID | +| `name` | *Optional\* | :heavy_minus_sign: | user defined participant name | +| `joinedAt` | *Optional\* | :heavy_minus_sign: | the time the participant joined | +| `leftAt` | *Optional\* | :heavy_minus_sign: | the time the participant left | \ No newline at end of file diff --git a/docs/models/components/PlaybackInfoSource.md b/docs/models/components/PlaybackInfoSource.md index 7c50d75e..aef94d1d 100644 --- a/docs/models/components/PlaybackInfoSource.md +++ b/docs/models/components/PlaybackInfoSource.md @@ -8,7 +8,7 @@ | `hrn` | [Hrn](../../models/components/Hrn.md) | :heavy_check_mark: | Human Readable Name | MP4 | | `type` | [PlaybackInfoMetaType](../../models/components/PlaybackInfoMetaType.md) | :heavy_check_mark: | N/A | html5/video/mp4 | | `url` | *String* | :heavy_check_mark: | N/A | https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4 | -| `size` | *Optional* | :heavy_minus_sign: | N/A | 494778 | -| `width` | *Optional* | :heavy_minus_sign: | N/A | 204 | -| `height` | *Optional* | :heavy_minus_sign: | N/A | 360 | -| `bitrate` | *Optional* | :heavy_minus_sign: | N/A | 449890 | \ No newline at end of file +| `size` | *Optional\* | :heavy_minus_sign: | N/A | 494778 | +| `width` | *Optional\* | :heavy_minus_sign: | N/A | 204 | +| `height` | *Optional\* | :heavy_minus_sign: | N/A | 360 | +| `bitrate` | *Optional\* | :heavy_minus_sign: | N/A | 449890 | \ No newline at end of file diff --git a/docs/models/components/PlaybackPolicy.md b/docs/models/components/PlaybackPolicy.md index 6a1998b5..1c6f9345 100644 --- a/docs/models/components/PlaybackPolicy.md +++ b/docs/models/components/PlaybackPolicy.md @@ -8,7 +8,7 @@ Whether the playback policy for an asset or stream is public or signed | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `type` | [Type](../../models/components/Type.md) | :heavy_check_mark: | N/A | webhook | -| `webhookId` | *Optional* | :heavy_minus_sign: | ID of the webhook to use for playback policy | 1bde4o2i6xycudoy | -| `webhookContext` | Map | :heavy_minus_sign: | User-defined webhook context | {
"streamerId": "my-custom-id"
} | -| `refreshInterval` | *Optional* | :heavy_minus_sign: | Interval (in seconds) at which the playback policy should be
refreshed (default 600 seconds)
| 600 | -| `allowedOrigins` | List<*String*> | :heavy_minus_sign: | List of allowed origins for CORS playback (://:, ://) | | \ No newline at end of file +| `webhookId` | *Optional\* | :heavy_minus_sign: | ID of the webhook to use for playback policy | 1bde4o2i6xycudoy | +| `webhookContext` | Map\ | :heavy_minus_sign: | User-defined webhook context | {
"streamerId": "my-custom-id"
} | +| `refreshInterval` | *Optional\* | :heavy_minus_sign: | Interval (in seconds) at which the playback policy should be
refreshed (default 600 seconds)
| 600 | +| `allowedOrigins` | List\<*String*> | :heavy_minus_sign: | List of allowed origins for CORS playback (://:, ://) | | \ No newline at end of file diff --git a/docs/models/components/Pull.md b/docs/models/components/Pull.md index 3e451c1a..c24fd948 100644 --- a/docs/models/components/Pull.md +++ b/docs/models/components/Pull.md @@ -10,6 +10,6 @@ stream will not have a streamKey. | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | | `source` | *String* | :heavy_check_mark: | URL from which to pull from. | https://myservice.com/live/stream.flv | -| `headers` | Map | :heavy_minus_sign: | Headers to be sent with the request to the pull source. | {
"Authorization": "Bearer 123"
} | -| `isMobile` | [Optional](../../models/components/IsMobile.md) | :heavy_minus_sign: | Indicates whether the stream will be pulled from a mobile source. | | -| `location` | [Optional](../../models/components/Location.md) | :heavy_minus_sign: | Approximate location of the pull source. The location is used to
determine the closest Livepeer region to pull the stream from. | | \ No newline at end of file +| `headers` | Map\ | :heavy_minus_sign: | Headers to be sent with the request to the pull source. | {
"Authorization": "Bearer 123"
} | +| `isMobile` | [Optional\](../../models/components/IsMobile.md) | :heavy_minus_sign: | Indicates whether the stream will be pulled from a mobile source. | | +| `location` | [Optional\](../../models/components/Location.md) | :heavy_minus_sign: | Approximate location of the pull source. The location is used to
determine the closest Livepeer region to pull the stream from. | | \ No newline at end of file diff --git a/docs/models/components/RealtimeViewershipMetric.md b/docs/models/components/RealtimeViewershipMetric.md index 24a8dab9..63b530e1 100644 --- a/docs/models/components/RealtimeViewershipMetric.md +++ b/docs/models/components/RealtimeViewershipMetric.md @@ -8,9 +8,9 @@ An individual metric about realtime viewership of a stream/asset. | Field | Type | Required | Description | Example | | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | -| `playbackId` | *Optional* | :heavy_minus_sign: | The playback ID associated with the metric. | 1bde4o2i6xycudoy | -| `device` | *Optional* | :heavy_minus_sign: | The device used by the viewer. | iPhone | -| `browser` | *Optional* | :heavy_minus_sign: | The browser used by the viewer. | Safari | -| `country` | *Optional* | :heavy_minus_sign: | The country where the viewer is located. | United States | +| `playbackId` | *Optional\* | :heavy_minus_sign: | The playback ID associated with the metric. | 1bde4o2i6xycudoy | +| `device` | *Optional\* | :heavy_minus_sign: | The device used by the viewer. | iPhone | +| `browser` | *Optional\* | :heavy_minus_sign: | The browser used by the viewer. | Safari | +| `country` | *Optional\* | :heavy_minus_sign: | The country where the viewer is located. | United States | | `viewCount` | *long* | :heavy_check_mark: | The number of views for the stream/asset. | 100 | | `errorRate` | *double* | :heavy_check_mark: | The error rate for the stream/asset. | 0.1 | \ No newline at end of file diff --git a/docs/models/components/RecordingSpec.md b/docs/models/components/RecordingSpec.md index 9f227684..0dab35d2 100644 --- a/docs/models/components/RecordingSpec.md +++ b/docs/models/components/RecordingSpec.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `profiles` | List<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `profiles` | List\<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/RecordingStatus.md b/docs/models/components/RecordingStatus.md index 42350181..5fccebcb 100644 --- a/docs/models/components/RecordingStatus.md +++ b/docs/models/components/RecordingStatus.md @@ -10,4 +10,5 @@ The status of the recording process of this stream session. | `WAITING` | waiting | | `READY` | ready | | `FAILED` | failed | +| `DELETED` | deleted | | `NONE` | none | \ No newline at end of file diff --git a/docs/models/components/Request.md b/docs/models/components/Request.md index e9d424cd..9b971e1f 100644 --- a/docs/models/components/Request.md +++ b/docs/models/components/Request.md @@ -5,7 +5,7 @@ | Field | Type | Required | Description | Example | | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `url` | *Optional* | :heavy_minus_sign: | URL used for the request | https://my-service.com/webhook | -| `method` | *Optional* | :heavy_minus_sign: | HTTP request method | POST | -| `headers` | Map | :heavy_minus_sign: | HTTP request headers | {
"User-Agent": "livepeer.studio"
} | -| `body` | *Optional* | :heavy_minus_sign: | request body | {"event": "stream.started"} | \ No newline at end of file +| `url` | *Optional\* | :heavy_minus_sign: | URL used for the request | https://my-service.com/webhook | +| `method` | *Optional\* | :heavy_minus_sign: | HTTP request method | POST | +| `headers` | Map\ | :heavy_minus_sign: | HTTP request headers | {
"User-Agent": "livepeer.studio"
} | +| `body` | *Optional\* | :heavy_minus_sign: | request body | {"event": "stream.started"} | \ No newline at end of file diff --git a/docs/models/components/Response.md b/docs/models/components/Response.md index 8518b42f..53048eca 100644 --- a/docs/models/components/Response.md +++ b/docs/models/components/Response.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | | -------------------- | -------------------- | -------------------- | -------------------- | -| `body` | *Optional* | :heavy_minus_sign: | response body | -| `status` | *Optional* | :heavy_minus_sign: | HTTP status code | -| `statusText` | *Optional* | :heavy_minus_sign: | response status text | \ No newline at end of file +| `body` | *Optional\* | :heavy_minus_sign: | response body | +| `status` | *Optional\* | :heavy_minus_sign: | HTTP status code | +| `statusText` | *Optional\* | :heavy_minus_sign: | response status text | \ No newline at end of file diff --git a/docs/models/components/Room.md b/docs/models/components/Room.md index 2ad18d01..9ef481c1 100644 --- a/docs/models/components/Room.md +++ b/docs/models/components/Room.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `id` | *String* | :heavy_check_mark: | room ID | d32ae9e6-c459-4931-9898-e86e2f5e7e16 | -| `createdAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the room was created | 1587667174725 | -| `updatedAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which room was updated | 1587667174725 | -| `egressId` | *Optional* | :heavy_minus_sign: | internal ID for egress output | | -| `participants` | Map | :heavy_check_mark: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | +| `id` | *String* | :heavy_check_mark: | room ID | d32ae9e6-c459-4931-9898-e86e2f5e7e16 | +| `createdAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the room was created | 1587667174725 | +| `updatedAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which room was updated | 1587667174725 | +| `egressId` | *Optional\* | :heavy_minus_sign: | internal ID for egress output | | +| `participants` | Map\ | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/components/RoomUserPayload.md b/docs/models/components/RoomUserPayload.md index 8cf2978f..8a01860c 100644 --- a/docs/models/components/RoomUserPayload.md +++ b/docs/models/components/RoomUserPayload.md @@ -6,6 +6,6 @@ | Field | Type | Required | Description | Example | | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | | `name` | *String* | :heavy_check_mark: | Display name | name | -| `canPublish` | *Optional* | :heavy_minus_sign: | Whether a user is allowed to publish audio/video tracks | true | -| `canPublishData` | *Optional* | :heavy_minus_sign: | Whether a user is allowed to publish data messages to the room | true | -| `metadata` | *Optional* | :heavy_minus_sign: | User defined payload to store for the participant | | \ No newline at end of file +| `canPublish` | *Optional\* | :heavy_minus_sign: | Whether a user is allowed to publish audio/video tracks | true | +| `canPublishData` | *Optional\* | :heavy_minus_sign: | Whether a user is allowed to publish data messages to the room | true | +| `metadata` | *Optional\* | :heavy_minus_sign: | User defined payload to store for the participant | | \ No newline at end of file diff --git a/docs/models/components/RoomUserResponse.md b/docs/models/components/RoomUserResponse.md index 3b0d4bae..80c2e022 100644 --- a/docs/models/components/RoomUserResponse.md +++ b/docs/models/components/RoomUserResponse.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | -| `id` | *Optional* | :heavy_minus_sign: | The ID of the user | d32ae9e6-c459-4931-9898-e86e2f5e7e16 | -| `joinUrl` | *Optional* | :heavy_minus_sign: | Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide for more info). | https://meet.livepeer.chat | -| `token` | *Optional* | :heavy_minus_sign: | Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming guide for more info). | token | \ No newline at end of file +| `id` | *Optional\* | :heavy_minus_sign: | The ID of the user | d32ae9e6-c459-4931-9898-e86e2f5e7e16 | +| `joinUrl` | *Optional\* | :heavy_minus_sign: | Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide for more info). | https://meet.livepeer.chat | +| `token` | *Optional\* | :heavy_minus_sign: | Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming guide for more info). | token | \ No newline at end of file diff --git a/docs/models/components/RoomUserUpdatePayload.md b/docs/models/components/RoomUserUpdatePayload.md index fd9d8820..e1f8d562 100644 --- a/docs/models/components/RoomUserUpdatePayload.md +++ b/docs/models/components/RoomUserUpdatePayload.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `canPublish` | *Optional* | :heavy_minus_sign: | Whether a user is allowed to publish audio/video tracks (i.e. their microphone and webcam) | true | -| `canPublishData` | *Optional* | :heavy_minus_sign: | Whether a user is allowed to publish data messages to the room | true | -| `metadata` | *Optional* | :heavy_minus_sign: | User defined payload to store for the participant | | \ No newline at end of file +| `canPublish` | *Optional\* | :heavy_minus_sign: | Whether a user is allowed to publish audio/video tracks (i.e. their microphone and webcam) | true | +| `canPublishData` | *Optional\* | :heavy_minus_sign: | Whether a user is allowed to publish data messages to the room | true | +| `metadata` | *Optional\* | :heavy_minus_sign: | User defined payload to store for the participant | | \ No newline at end of file diff --git a/docs/models/components/Session.md b/docs/models/components/Session.md index b76ea3ae..0802331d 100644 --- a/docs/models/components/Session.md +++ b/docs/models/components/Session.md @@ -5,28 +5,28 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *Optional* | :heavy_minus_sign: | N/A | de7818e7-610a-4057-8f6f-b785dc1e6f88 | -| ~~`kind`~~ | *Optional* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | stream | -| ~~`userId`~~ | *Optional* | :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 | +| `id` | *Optional\* | :heavy_minus_sign: | N/A | de7818e7-610a-4057-8f6f-b785dc1e6f88 | +| ~~`kind`~~ | *Optional\* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | stream | +| ~~`userId`~~ | *Optional\* | :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 | | `name` | *String* | :heavy_check_mark: | N/A | test_session | -| `lastSeen` | *Optional* | :heavy_minus_sign: | N/A | 1587667174725 | -| `sourceSegments` | *Optional* | :heavy_minus_sign: | N/A | 1 | -| `transcodedSegments` | *Optional* | :heavy_minus_sign: | N/A | 2 | -| `sourceSegmentsDuration` | *Optional* | :heavy_minus_sign: | Duration of all the source segments, sec | 1 | -| `transcodedSegmentsDuration` | *Optional* | :heavy_minus_sign: | Duration of all the transcoded segments, sec | 2 | -| `sourceBytes` | *Optional* | :heavy_minus_sign: | N/A | 1 | -| `transcodedBytes` | *Optional* | :heavy_minus_sign: | N/A | 2 | -| `ingestRate` | *Optional* | :heavy_minus_sign: | Rate at which sourceBytes increases (bytes/second) | 1 | -| `outgoingRate` | *Optional* | :heavy_minus_sign: | Rate at which transcodedBytes increases (bytes/second) | 2 | -| `isHealthy` | *JsonNullable* | :heavy_minus_sign: | Indicates whether the stream is healthy or not. | | -| `issues` | List<*String*> | :heavy_minus_sign: | A string array of human-readable errors describing issues affecting the stream, if any. | | -| `createdAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which stream object was created | 1587667174725 | -| `parentId` | *Optional* | :heavy_minus_sign: | Points to parent stream object | de7818e7-610a-4057-8f6f-b785dc1e6f88 | -| `projectId` | *Optional* | :heavy_minus_sign: | The ID of the project | aac12556-4d65-4d34-9fb6-d1f0985eb0a9 | -| `record` | *Optional* | :heavy_minus_sign: | Whether the stream should be recorded. Uses default settings. For more customization, create and configure an object store.
| false | -| `recordingStatus` | [Optional](../../models/components/RecordingStatus.md) | :heavy_minus_sign: | The status of the recording process of this stream session. | | -| `recordingUrl` | *Optional* | :heavy_minus_sign: | URL for accessing the recording of this stream session. | | -| `mp4Url` | *Optional* | :heavy_minus_sign: | The URL for the stream session recording packaged in an MP4. | | -| `playbackId` | *Optional* | :heavy_minus_sign: | The playback ID to use with the Playback Info endpoint to retrieve playback URLs. | eaw4nk06ts2d0mzb | -| `profiles` | List<[FfmpegProfile](../../models/components/FfmpegProfile.md)> | :heavy_minus_sign: | Profiles to transcode the stream into. If not specified, a default
set of profiles will be used with 240p, 360p, 480p and 720p
resolutions. Keep in mind that the source rendition is always kept.
| | -| `recordingSpec` | [Optional](../../models/components/RecordingSpec.md) | :heavy_minus_sign: | Configuration for recording the stream. This can only be set if
`record` is true.
| | \ No newline at end of file +| `lastSeen` | *Optional\* | :heavy_minus_sign: | N/A | 1587667174725 | +| `sourceSegments` | *Optional\* | :heavy_minus_sign: | N/A | 1 | +| `transcodedSegments` | *Optional\* | :heavy_minus_sign: | N/A | 2 | +| `sourceSegmentsDuration` | *Optional\* | :heavy_minus_sign: | Duration of all the source segments, sec | 1 | +| `transcodedSegmentsDuration` | *Optional\* | :heavy_minus_sign: | Duration of all the transcoded segments, sec | 2 | +| `sourceBytes` | *Optional\* | :heavy_minus_sign: | N/A | 1 | +| `transcodedBytes` | *Optional\* | :heavy_minus_sign: | N/A | 2 | +| `ingestRate` | *Optional\* | :heavy_minus_sign: | Rate at which sourceBytes increases (bytes/second) | 1 | +| `outgoingRate` | *Optional\* | :heavy_minus_sign: | Rate at which transcodedBytes increases (bytes/second) | 2 | +| `isHealthy` | *JsonNullable\* | :heavy_minus_sign: | Indicates whether the stream is healthy or not. | | +| `issues` | List\<*String*> | :heavy_minus_sign: | A string array of human-readable errors describing issues affecting the stream, if any. | | +| `createdAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which stream object was created | 1587667174725 | +| `parentId` | *Optional\* | :heavy_minus_sign: | Points to parent stream object | de7818e7-610a-4057-8f6f-b785dc1e6f88 | +| `projectId` | *Optional\* | :heavy_minus_sign: | The ID of the project | aac12556-4d65-4d34-9fb6-d1f0985eb0a9 | +| `record` | *Optional\* | :heavy_minus_sign: | Whether the stream should be recorded. Uses default settings. For more customization, create and configure an object store.
| false | +| `recordingStatus` | [Optional\](../../models/components/RecordingStatus.md) | :heavy_minus_sign: | The status of the recording process of this stream session. | | +| `recordingUrl` | *Optional\* | :heavy_minus_sign: | URL for accessing the recording of this stream session. | | +| `mp4Url` | *Optional\* | :heavy_minus_sign: | The URL for the stream session recording packaged in an MP4. | | +| `playbackId` | *Optional\* | :heavy_minus_sign: | The playback ID to use with the Playback Info endpoint to retrieve playback URLs. | eaw4nk06ts2d0mzb | +| `profiles` | List\<[FfmpegProfile](../../models/components/FfmpegProfile.md)> | :heavy_minus_sign: | Profiles to transcode the stream into. If not specified, a default
set of profiles will be used with 240p, 360p, 480p and 720p
resolutions. Keep in mind that the source rendition is always kept.
| | +| `recordingSpec` | [Optional\](../../models/components/RecordingSpec.md) | :heavy_minus_sign: | Configuration for recording the stream. This can only be set if
`record` is true.
| | \ No newline at end of file diff --git a/docs/models/components/SigningKey.md b/docs/models/components/SigningKey.md index 979fd579..26669ab8 100644 --- a/docs/models/components/SigningKey.md +++ b/docs/models/components/SigningKey.md @@ -5,11 +5,11 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| `id` | *Optional* | :heavy_minus_sign: | N/A | 78df0075-b5f3-4683-a618-1086faca35dc | -| `name` | *Optional* | :heavy_minus_sign: | Name of the signing key | key1 | -| ~~`userId`~~ | *Optional* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | 78df0075-b5f3-4683-a618-1086faca35dc | -| `createdAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the signing-key was created | 1587667174725 | -| `lastSeen` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the signing-key was last used | 1587667174725 | +| `id` | *Optional\* | :heavy_minus_sign: | N/A | 78df0075-b5f3-4683-a618-1086faca35dc | +| `name` | *Optional\* | :heavy_minus_sign: | Name of the signing key | key1 | +| ~~`userId`~~ | *Optional\* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | 78df0075-b5f3-4683-a618-1086faca35dc | +| `createdAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the signing-key was created | 1587667174725 | +| `lastSeen` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the signing-key was last used | 1587667174725 | | `publicKey` | *String* | :heavy_check_mark: | N/A | | -| `disabled` | *Optional* | :heavy_minus_sign: | Disable the signing key to allow rotation safely | false | -| `projectId` | *Optional* | :heavy_minus_sign: | The ID of the project | aac12556-4d65-4d34-9fb | \ No newline at end of file +| `disabled` | *Optional\* | :heavy_minus_sign: | Disable the signing key to allow rotation safely | false | +| `projectId` | *Optional\* | :heavy_minus_sign: | The ID of the project | aac12556-4d65-4d34-9fb | \ No newline at end of file diff --git a/docs/models/components/Source1.md b/docs/models/components/Source1.md index 4c86cb4f..30159a51 100644 --- a/docs/models/components/Source1.md +++ b/docs/models/components/Source1.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `type` | [SourceType](../../models/components/SourceType.md) | :heavy_check_mark: | N/A | -| `url` | *String* | :heavy_check_mark: | URL from which the asset was uploaded. | -| `gatewayUrl` | *Optional* | :heavy_minus_sign: | Gateway URL from asset if parsed from provided URL on upload. | -| `encryption` | [Optional](../../models/components/EncryptionOutput.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `type` | [SourceType](../../models/components/SourceType.md) | :heavy_check_mark: | N/A | +| `url` | *String* | :heavy_check_mark: | URL from which the asset was uploaded. | +| `gatewayUrl` | *Optional\* | :heavy_minus_sign: | Gateway URL from asset if parsed from provided URL on upload. | +| `encryption` | [Optional\](../../models/components/EncryptionOutput.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/Source3.md b/docs/models/components/Source3.md index 01a054c7..63a5ec53 100644 --- a/docs/models/components/Source3.md +++ b/docs/models/components/Source3.md @@ -3,12 +3,12 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `type` | [AssetSource3Type](../../models/components/AssetSource3Type.md) | :heavy_check_mark: | N/A | -| `encryption` | [Optional](../../models/components/EncryptionOutput.md) | :heavy_minus_sign: | N/A | -| `sourceId` | *Optional* | :heavy_minus_sign: | ID of the asset or stream from which this asset was created. | -| `sessionId` | *Optional* | :heavy_minus_sign: | ID of the session from which this asset was created. | -| `playbackId` | *Optional* | :heavy_minus_sign: | Playback ID of the asset or stream from which this asset was created. | -| `requesterId` | *Optional* | :heavy_minus_sign: | ID of the requester from which this asset was created. | -| `assetId` | *Optional* | :heavy_minus_sign: | ID of the asset from which this asset was created. | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `type` | [AssetSource3Type](../../models/components/AssetSource3Type.md) | :heavy_check_mark: | N/A | +| `encryption` | [Optional\](../../models/components/EncryptionOutput.md) | :heavy_minus_sign: | N/A | +| `sourceId` | *Optional\* | :heavy_minus_sign: | ID of the asset or stream from which this asset was created. | +| `sessionId` | *Optional\* | :heavy_minus_sign: | ID of the session from which this asset was created. | +| `playbackId` | *Optional\* | :heavy_minus_sign: | Playback ID of the asset or stream from which this asset was created. | +| `requesterId` | *Optional\* | :heavy_minus_sign: | ID of the requester from which this asset was created. | +| `assetId` | *Optional\* | :heavy_minus_sign: | ID of the asset from which this asset was created. | \ No newline at end of file diff --git a/docs/models/components/Spec.md b/docs/models/components/Spec.md index 9dd3a5d4..038dc5b9 100644 --- a/docs/models/components/Spec.md +++ b/docs/models/components/Spec.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `nftMetadataTemplate` | [Optional](../../models/components/NftMetadataTemplate.md) | :heavy_minus_sign: | Name of the NFT metadata template to export. 'player'
will embed the Livepeer Player on the NFT while 'file'
will reference only the immutable MP4 files.
| -| `nftMetadata` | [Optional](../../models/components/NftMetadata.md) | :heavy_minus_sign: | Additional data to add to the NFT metadata exported to
IPFS. Will be deep merged with the default metadata
exported.
| \ No newline at end of file +| `nftMetadataTemplate` | [Optional\](../../models/components/NftMetadataTemplate.md) | :heavy_minus_sign: | Name of the NFT metadata template to export. 'player'
will embed the Livepeer Player on the NFT while 'file'
will reference only the immutable MP4 files.
| +| `nftMetadata` | [Optional\](../../models/components/NftMetadata.md) | :heavy_minus_sign: | Additional data to add to the NFT metadata exported to
IPFS. Will be deep merged with the default metadata
exported.
| \ No newline at end of file diff --git a/docs/models/components/Status.md b/docs/models/components/Status.md index 757be8b3..799c553e 100644 --- a/docs/models/components/Status.md +++ b/docs/models/components/Status.md @@ -7,5 +7,5 @@ status of webhook | Field | Type | Required | Description | Example | | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `lastFailure` | [Optional](../../models/components/LastFailure.md) | :heavy_minus_sign: | failure timestamp and error message with status code | | -| `lastTriggeredAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the webhook last was
triggered
| 1587667174725 | \ No newline at end of file +| `lastFailure` | [Optional\](../../models/components/LastFailure.md) | :heavy_minus_sign: | failure timestamp and error message with status code | | +| `lastTriggeredAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the webhook last was
triggered
| 1587667174725 | \ No newline at end of file diff --git a/docs/models/components/Storage.md b/docs/models/components/Storage.md index b6393357..ce53a989 100644 --- a/docs/models/components/Storage.md +++ b/docs/models/components/Storage.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `ipfs` | [JsonNullable](../../models/components/Ipfs.md) | :heavy_minus_sign: | Set to true to make default export to IPFS. To customize the
pinned files, specify an object with a spec field. False or null
means to unpin from IPFS, but it's unsupported right now.
| \ No newline at end of file +| `ipfs` | [JsonNullable\](../../models/components/Ipfs.md) | :heavy_minus_sign: | Set to true to make default export to IPFS. To customize the
pinned files, specify an object with a spec field. False or null
means to unpin from IPFS, but it's unsupported right now.
| \ No newline at end of file diff --git a/docs/models/components/StorageStatus.md b/docs/models/components/StorageStatus.md index 79af3e13..604d808a 100644 --- a/docs/models/components/StorageStatus.md +++ b/docs/models/components/StorageStatus.md @@ -6,6 +6,6 @@ | Field | Type | Required | Description | Example | | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | | `phase` | [Phase](../../models/components/Phase.md) | :heavy_check_mark: | Phase of the asset storage | ready | -| `progress` | *Optional* | :heavy_minus_sign: | Current progress of the task updating the storage. | 0.5 | -| `errorMessage` | *Optional* | :heavy_minus_sign: | Error message if the last storage changed failed. | Failed to update storage | +| `progress` | *Optional\* | :heavy_minus_sign: | Current progress of the task updating the storage. | 0.5 | +| `errorMessage` | *Optional\* | :heavy_minus_sign: | Error message if the last storage changed failed. | Failed to update storage | | `tasks` | [Tasks](../../models/components/Tasks.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/components/Stream.md b/docs/models/components/Stream.md index 551ba2a8..02f554a7 100644 --- a/docs/models/components/Stream.md +++ b/docs/models/components/Stream.md @@ -5,36 +5,36 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | *Optional* | :heavy_minus_sign: | N/A | de7818e7-610a-4057-8f6f-b785dc1e6f88 | +| `id` | *Optional\* | :heavy_minus_sign: | N/A | de7818e7-610a-4057-8f6f-b785dc1e6f88 | | `name` | *String* | :heavy_check_mark: | N/A | test_stream | -| ~~`kind`~~ | *Optional* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | stream | -| `creatorId` | [Optional](../../models/components/CreatorId.md) | :heavy_minus_sign: | N/A | | -| `userTags` | Map | :heavy_minus_sign: | User input tags associated with the stream | | -| `lastSeen` | *Optional* | :heavy_minus_sign: | N/A | 1587667174725 | -| `sourceSegments` | *Optional* | :heavy_minus_sign: | N/A | 1 | -| `transcodedSegments` | *Optional* | :heavy_minus_sign: | N/A | 2 | -| `sourceSegmentsDuration` | *Optional* | :heavy_minus_sign: | Duration of all the source segments, sec | 1 | -| `transcodedSegmentsDuration` | *Optional* | :heavy_minus_sign: | Duration of all the transcoded segments, sec | 2 | -| `sourceBytes` | *Optional* | :heavy_minus_sign: | N/A | 1 | -| `transcodedBytes` | *Optional* | :heavy_minus_sign: | N/A | 2 | -| `ingestRate` | *Optional* | :heavy_minus_sign: | Rate at which sourceBytes increases (bytes/second) | 1 | -| `outgoingRate` | *Optional* | :heavy_minus_sign: | Rate at which transcodedBytes increases (bytes/second) | 2 | -| `isActive` | *Optional* | :heavy_minus_sign: | If currently active | true | -| `isHealthy` | *JsonNullable* | :heavy_minus_sign: | Indicates whether the stream is healthy or not. | | -| `issues` | List<*String*> | :heavy_minus_sign: | A string array of human-readable errors describing issues affecting the stream, if any. | | -| `createdByTokenName` | *Optional* | :heavy_minus_sign: | Name of the token used to create this object | abc-123-xyz-456 | -| `createdAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which stream object was created | 1587667174725 | -| `parentId` | *Optional* | :heavy_minus_sign: | Points to parent stream object | de7818e7-610a-4057-8f6f-b785dc1e6f88 | -| `streamKey` | *Optional* | :heavy_minus_sign: | Used to form RTMP ingest URL | hgebdhhigq | -| `pull` | [Optional](../../models/components/StreamPull.md) | :heavy_minus_sign: | Configuration for a stream that should be actively pulled from an
external source, rather than pushed to Livepeer. If specified, the
stream will not have a streamKey. | | -| `playbackId` | *Optional* | :heavy_minus_sign: | The playback ID to use with the Playback Info endpoint to retrieve playback URLs. | eaw4nk06ts2d0mzb | -| `playbackPolicy` | [JsonNullable](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | -| `profiles` | List<[FfmpegProfile](../../models/components/FfmpegProfile.md)> | :heavy_minus_sign: | Profiles to transcode the stream into. If not specified, a default
set of profiles will be used with 240p, 360p, 480p and 720p
resolutions. Keep in mind that the source rendition is always kept.
| | -| `projectId` | *Optional* | :heavy_minus_sign: | The ID of the project | aac12556-4d65-4d34-9fb6-d1f0985eb0a9 | -| `record` | *Optional* | :heavy_minus_sign: | Should this stream be recorded? Uses default settings. For more
customization, create and configure an object store.
| false | -| `recordingSpec` | [Optional](../../models/components/StreamRecordingSpec.md) | :heavy_minus_sign: | Configuration for recording the stream. This can only be set if
`record` is true.
| | -| `multistream` | [Optional](../../models/components/StreamMultistream.md) | :heavy_minus_sign: | N/A | | -| `suspended` | *Optional* | :heavy_minus_sign: | If currently suspended | | -| `lastTerminatedAt` | *JsonNullable* | :heavy_minus_sign: | Timestamp (in milliseconds) when the stream was last terminated | 1713281212993 | -| ~~`userId`~~ | *Optional* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | we7818e7-610a-4057-8f6f-b785dc1e6f88 | -| `renditions` | [Optional](../../models/components/Renditions.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| ~~`kind`~~ | *Optional\* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | stream | +| `creatorId` | [Optional\](../../models/components/CreatorId.md) | :heavy_minus_sign: | N/A | | +| `userTags` | Map\ | :heavy_minus_sign: | User input tags associated with the stream | | +| `lastSeen` | *Optional\* | :heavy_minus_sign: | N/A | 1587667174725 | +| `sourceSegments` | *Optional\* | :heavy_minus_sign: | N/A | 1 | +| `transcodedSegments` | *Optional\* | :heavy_minus_sign: | N/A | 2 | +| `sourceSegmentsDuration` | *Optional\* | :heavy_minus_sign: | Duration of all the source segments, sec | 1 | +| `transcodedSegmentsDuration` | *Optional\* | :heavy_minus_sign: | Duration of all the transcoded segments, sec | 2 | +| `sourceBytes` | *Optional\* | :heavy_minus_sign: | N/A | 1 | +| `transcodedBytes` | *Optional\* | :heavy_minus_sign: | N/A | 2 | +| `ingestRate` | *Optional\* | :heavy_minus_sign: | Rate at which sourceBytes increases (bytes/second) | 1 | +| `outgoingRate` | *Optional\* | :heavy_minus_sign: | Rate at which transcodedBytes increases (bytes/second) | 2 | +| `isActive` | *Optional\* | :heavy_minus_sign: | If currently active | true | +| `isHealthy` | *JsonNullable\* | :heavy_minus_sign: | Indicates whether the stream is healthy or not. | | +| `issues` | List\<*String*> | :heavy_minus_sign: | A string array of human-readable errors describing issues affecting the stream, if any. | | +| `createdByTokenName` | *Optional\* | :heavy_minus_sign: | Name of the token used to create this object | abc-123-xyz-456 | +| `createdAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which stream object was created | 1587667174725 | +| `parentId` | *Optional\* | :heavy_minus_sign: | Points to parent stream object | de7818e7-610a-4057-8f6f-b785dc1e6f88 | +| `streamKey` | *Optional\* | :heavy_minus_sign: | Used to form RTMP ingest URL | hgebdhhigq | +| `pull` | [Optional\](../../models/components/StreamPull.md) | :heavy_minus_sign: | Configuration for a stream that should be actively pulled from an
external source, rather than pushed to Livepeer. If specified, the
stream will not have a streamKey. | | +| `playbackId` | *Optional\* | :heavy_minus_sign: | The playback ID to use with the Playback Info endpoint to retrieve playback URLs. | eaw4nk06ts2d0mzb | +| `playbackPolicy` | [JsonNullable\](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | +| `profiles` | List\<[FfmpegProfile](../../models/components/FfmpegProfile.md)> | :heavy_minus_sign: | Profiles to transcode the stream into. If not specified, a default
set of profiles will be used with 240p, 360p, 480p and 720p
resolutions. Keep in mind that the source rendition is always kept.
| | +| `projectId` | *Optional\* | :heavy_minus_sign: | The ID of the project | aac12556-4d65-4d34-9fb6-d1f0985eb0a9 | +| `record` | *Optional\* | :heavy_minus_sign: | Should this stream be recorded? Uses default settings. For more
customization, create and configure an object store.
| false | +| `recordingSpec` | [Optional\](../../models/components/StreamRecordingSpec.md) | :heavy_minus_sign: | Configuration for recording the stream. This can only be set if
`record` is true.
| | +| `multistream` | [Optional\](../../models/components/StreamMultistream.md) | :heavy_minus_sign: | N/A | | +| `suspended` | *Optional\* | :heavy_minus_sign: | If currently suspended | | +| `lastTerminatedAt` | *JsonNullable\* | :heavy_minus_sign: | Timestamp (in milliseconds) when the stream was last terminated | 1713281212993 | +| ~~`userId`~~ | *Optional\* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | we7818e7-610a-4057-8f6f-b785dc1e6f88 | +| `renditions` | [Optional\](../../models/components/Renditions.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/components/StreamMultistream.md b/docs/models/components/StreamMultistream.md index 2297063a..c50af01b 100644 --- a/docs/models/components/StreamMultistream.md +++ b/docs/models/components/StreamMultistream.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| `targets` | List<[TargetOutput](../../models/components/TargetOutput.md)> | :heavy_minus_sign: | References to targets where this stream will be simultaneously
streamed to
| [
{
"id": "PUSH123",
"profile": "720p"
}
] | \ No newline at end of file +| `targets` | List\<[TargetOutput](../../models/components/TargetOutput.md)> | :heavy_minus_sign: | References to targets where this stream will be simultaneously
streamed to
| [
{
"id": "PUSH123",
"profile": "720p"
}
] | \ No newline at end of file diff --git a/docs/models/components/StreamPatchPayload.md b/docs/models/components/StreamPatchPayload.md index cad701a5..48663853 100644 --- a/docs/models/components/StreamPatchPayload.md +++ b/docs/models/components/StreamPatchPayload.md @@ -5,11 +5,12 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | -| `creatorId` | [Optional](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | | -| `record` | *Optional* | :heavy_minus_sign: | Should this stream be recorded? Uses default settings. For more
customization, create and configure an object store.
| false | -| `suspended` | *Optional* | :heavy_minus_sign: | If currently suspended | | -| `multistream` | [Optional](../../models/components/Multistream.md) | :heavy_minus_sign: | N/A | | -| `playbackPolicy` | [JsonNullable](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | -| `profiles` | List<[FfmpegProfile](../../models/components/FfmpegProfile.md)> | :heavy_minus_sign: | N/A | | -| `recordingSpec` | [Optional](../../models/components/RecordingSpec.md) | :heavy_minus_sign: | N/A | | -| `userTags` | Map | :heavy_minus_sign: | User input tags associated with the stream | | \ No newline at end of file +| `creatorId` | [Optional\](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | | +| `record` | *Optional\* | :heavy_minus_sign: | Should this stream be recorded? Uses default settings. For more
customization, create and configure an object store.
| false | +| `suspended` | *Optional\* | :heavy_minus_sign: | If currently suspended | | +| `multistream` | [Optional\](../../models/components/Multistream.md) | :heavy_minus_sign: | N/A | | +| `playbackPolicy` | [JsonNullable\](../../models/components/PlaybackPolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | +| `profiles` | List\<[FfmpegProfile](../../models/components/FfmpegProfile.md)> | :heavy_minus_sign: | N/A | | +| `recordingSpec` | [Optional\](../../models/components/RecordingSpec.md) | :heavy_minus_sign: | N/A | | +| `userTags` | Map\ | :heavy_minus_sign: | User input tags associated with the stream | | +| `name` | *Optional\* | :heavy_minus_sign: | N/A | test_stream | \ No newline at end of file diff --git a/docs/models/components/StreamPull.md b/docs/models/components/StreamPull.md index 9952d192..3bd2c222 100644 --- a/docs/models/components/StreamPull.md +++ b/docs/models/components/StreamPull.md @@ -10,6 +10,6 @@ stream will not have a streamKey. | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | | `source` | *String* | :heavy_check_mark: | URL from which to pull from. | https://myservice.com/live/stream.flv | -| `headers` | Map | :heavy_minus_sign: | Headers to be sent with the request to the pull source. | {
"Authorization": "Bearer 123"
} | -| `isMobile` | [Optional](../../models/components/StreamIsMobile.md) | :heavy_minus_sign: | Indicates whether the stream will be pulled from a mobile source. | | -| `location` | [Optional](../../models/components/StreamLocation.md) | :heavy_minus_sign: | Approximate location of the pull source. The location is used to
determine the closest Livepeer region to pull the stream from. | | \ No newline at end of file +| `headers` | Map\ | :heavy_minus_sign: | Headers to be sent with the request to the pull source. | {
"Authorization": "Bearer 123"
} | +| `isMobile` | [Optional\](../../models/components/StreamIsMobile.md) | :heavy_minus_sign: | Indicates whether the stream will be pulled from a mobile source. | | +| `location` | [Optional\](../../models/components/StreamLocation.md) | :heavy_minus_sign: | Approximate location of the pull source. The location is used to
determine the closest Livepeer region to pull the stream from. | | \ No newline at end of file diff --git a/docs/models/components/StreamRecordingSpec.md b/docs/models/components/StreamRecordingSpec.md index e5a93a3c..3e20c3fb 100644 --- a/docs/models/components/StreamRecordingSpec.md +++ b/docs/models/components/StreamRecordingSpec.md @@ -9,4 +9,4 @@ Configuration for recording the stream. This can only be set if | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `profiles` | List<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | Profiles to process the recording of this stream into. If not
specified, default profiles will be derived based on the stream
input. Keep in mind that the source rendition is always kept.
| \ No newline at end of file +| `profiles` | List\<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | Profiles to process the recording of this stream into. If not
specified, default profiles will be derived based on the stream
input. Keep in mind that the source rendition is always kept.
| \ 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 00000000..56bbcdb2 --- /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` | *Optional\* | :heavy_minus_sign: | If true, the stream audio will be muted and only silent
video will be pushed to the target.
| false | +| `id` | *Optional\* | :heavy_minus_sign: | ID of multistream target object where to push this stream | PUSH123 | +| `spec` | [Optional\](../../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/TargetAddPayload.md b/docs/models/components/TargetAddPayload.md index 9ff315ed..34f436f9 100644 --- a/docs/models/components/TargetAddPayload.md +++ b/docs/models/components/TargetAddPayload.md @@ -6,6 +6,6 @@ | 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` | *Optional* | :heavy_minus_sign: | If true, the stream audio will be muted and only silent
video will be pushed to the target.
| false | -| `id` | *Optional* | :heavy_minus_sign: | ID of multistream target object where to push this stream | PUSH123 | -| `spec` | [Optional](../../models/components/TargetAddPayloadSpec.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 +| `videoOnly` | *Optional\* | :heavy_minus_sign: | If true, the stream audio will be muted and only silent
video will be pushed to the target.
| false | +| `id` | *Optional\* | :heavy_minus_sign: | ID of multistream target object where to push this stream | PUSH123 | +| `spec` | [Optional\](../../models/components/TargetAddPayloadSpec.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/TargetAddPayloadSpec.md b/docs/models/components/TargetAddPayloadSpec.md index f1dc43f8..88384414 100644 --- a/docs/models/components/TargetAddPayloadSpec.md +++ b/docs/models/components/TargetAddPayloadSpec.md @@ -10,5 +10,5 @@ stream. | Field | Type | Required | Description | Example | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `name` | *Optional* | :heavy_minus_sign: | N/A | My target | +| `name` | *Optional\* | :heavy_minus_sign: | N/A | My target | | `url` | *String* | :heavy_check_mark: | Livepeer-compatible multistream target URL (RTMP(S) or SRT) | rtmps://live.my-service.tv/channel/secretKey | \ No newline at end of file diff --git a/docs/models/components/TargetOutput.md b/docs/models/components/TargetOutput.md index 8e1d0f3b..c9039923 100644 --- a/docs/models/components/TargetOutput.md +++ b/docs/models/components/TargetOutput.md @@ -6,5 +6,5 @@ | 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` | *Optional* | :heavy_minus_sign: | If true, the stream audio will be muted and only silent
video will be pushed to the target.
| false | -| `id` | *Optional* | :heavy_minus_sign: | ID of multistream target object where to push this stream | PUSH123 | \ No newline at end of file +| `videoOnly` | *Optional\* | :heavy_minus_sign: | If true, the stream audio will be muted and only silent
video will be pushed to the target.
| false | +| `id` | *Optional\* | :heavy_minus_sign: | ID of multistream target object where to push this stream | PUSH123 | \ No newline at end of file diff --git a/docs/models/components/TargetSpec.md b/docs/models/components/TargetSpec.md index db1cc7cc..08318455 100644 --- a/docs/models/components/TargetSpec.md +++ b/docs/models/components/TargetSpec.md @@ -10,5 +10,5 @@ stream. | Field | Type | Required | Description | Example | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | -| `name` | *Optional* | :heavy_minus_sign: | N/A | My target | +| `name` | *Optional\* | :heavy_minus_sign: | N/A | My target | | `url` | *String* | :heavy_check_mark: | Livepeer-compatible multistream target URL (RTMP(S) or SRT) | rtmps://live.my-service.tv/channel/secretKey | \ No newline at end of file diff --git a/docs/models/components/Task.md b/docs/models/components/Task.md index 31a03635..0d04c663 100644 --- a/docs/models/components/Task.md +++ b/docs/models/components/Task.md @@ -5,13 +5,14 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -| `id` | *Optional* | :heavy_minus_sign: | Task ID | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | -| `type` | [Optional](../../models/components/TaskType.md) | :heavy_minus_sign: | Type of the task | upload | -| `createdAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which task was created | 1587667174725 | -| `scheduledAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the task was scheduled for
execution (e.g. after file upload finished).
| 1587667174725 | -| `inputAssetId` | *Optional* | :heavy_minus_sign: | ID of the input asset | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | -| `outputAssetId` | *Optional* | :heavy_minus_sign: | ID of the output asset | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | -| `requesterId` | *Optional* | :heavy_minus_sign: | ID of the requester hash(IP + SALT + PlaybackId) | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | -| `params` | [Optional](../../models/components/Params.md) | :heavy_minus_sign: | Parameters of the task | | -| `status` | [Optional](../../models/components/TaskStatus.md) | :heavy_minus_sign: | Status of the task | | -| `output` | [Optional](../../models/components/Output.md) | :heavy_minus_sign: | Output of the task | | \ No newline at end of file +| `id` | *Optional\* | :heavy_minus_sign: | Task ID | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | +| `type` | [Optional\](../../models/components/TaskType.md) | :heavy_minus_sign: | Type of the task | upload | +| `createdAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which task was created | 1587667174725 | +| `scheduledAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which the task was scheduled for
execution (e.g. after file upload finished).
| 1587667174725 | +| `inputAssetId` | *Optional\* | :heavy_minus_sign: | ID of the input asset | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | +| `outputAssetId` | *Optional\* | :heavy_minus_sign: | ID of the output asset | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | +| `projectId` | *Optional\* | :heavy_minus_sign: | ID of the project | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | +| `requesterId` | *Optional\* | :heavy_minus_sign: | ID of the requester hash(IP + SALT + PlaybackId) | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | +| `params` | [Optional\](../../models/components/Params.md) | :heavy_minus_sign: | Parameters of the task | | +| `status` | [Optional\](../../models/components/TaskStatus.md) | :heavy_minus_sign: | Status of the task | | +| `output` | [Optional\](../../models/components/Output.md) | :heavy_minus_sign: | Output of the task | | \ No newline at end of file diff --git a/docs/models/components/TaskExportData.md b/docs/models/components/TaskExportData.md index 10eca19e..c64b9dc6 100644 --- a/docs/models/components/TaskExportData.md +++ b/docs/models/components/TaskExportData.md @@ -5,9 +5,9 @@ Parameters for the export-data task ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `content` | [Content](../../models/components/Content.md) | :heavy_check_mark: | File content to store into IPFS | {
"data": "Hello, World!"
} | -| `ipfs` | [Optional](../../models/components/IpfsExportParams.md) | :heavy_minus_sign: | N/A | | -| `type` | *Optional* | :heavy_minus_sign: | Optional type of content | text/plain | -| `id` | *Optional* | :heavy_minus_sign: | Optional ID of the content | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `content` | [Content](../../models/components/Content.md) | :heavy_check_mark: | File content to store into IPFS | {
"data": "Hello, World!"
} | +| `ipfs` | [Optional\](../../models/components/IpfsExportParams.md) | :heavy_minus_sign: | N/A | | +| `type` | *Optional\* | :heavy_minus_sign: | Optional type of content | text/plain | +| `id` | *Optional\* | :heavy_minus_sign: | Optional ID of the content | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | \ No newline at end of file diff --git a/docs/models/components/TaskHls.md b/docs/models/components/TaskHls.md index b212d1bc..c1bc8e00 100644 --- a/docs/models/components/TaskHls.md +++ b/docs/models/components/TaskHls.md @@ -7,4 +7,4 @@ HLS output format | Field | Type | Required | Description | Example | | ----------------------- | ----------------------- | ----------------------- | ----------------------- | ----------------------- | -| `path` | *Optional* | :heavy_minus_sign: | Path for the HLS output | /samplevideo/hls | \ No newline at end of file +| `path` | *Optional\* | :heavy_minus_sign: | Path for the HLS output | /samplevideo/hls | \ No newline at end of file diff --git a/docs/models/components/TaskInput.md b/docs/models/components/TaskInput.md index ebf47981..7736bba2 100644 --- a/docs/models/components/TaskInput.md +++ b/docs/models/components/TaskInput.md @@ -7,4 +7,4 @@ Input video file to transcode | Field | Type | Required | Description | Example | | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `url` | *Optional* | :heavy_minus_sign: | URL of a video to transcode, accepts object-store format
"s3+https"
| https://cdn.livepeer.com/ABC123/filename.mp4 | \ No newline at end of file +| `url` | *Optional\* | :heavy_minus_sign: | URL of a video to transcode, accepts object-store format
"s3+https"
| https://cdn.livepeer.com/ABC123/filename.mp4 | \ No newline at end of file diff --git a/docs/models/components/TaskIpfs.md b/docs/models/components/TaskIpfs.md index c0b6888e..4413f89c 100644 --- a/docs/models/components/TaskIpfs.md +++ b/docs/models/components/TaskIpfs.md @@ -6,8 +6,8 @@ | Field | Type | Required | Description | Example | | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | | `videoFileCid` | *String* | :heavy_check_mark: | IPFS CID of the exported video file | Qmabc123xyz341 | -| `videoFileUrl` | *Optional* | :heavy_minus_sign: | URL for the file with the IPFS protocol | ipfs://Qmabc123xyz341 | -| `videoFileGatewayUrl` | *Optional* | :heavy_minus_sign: | URL to access file via HTTP through an IPFS gateway | https://gateway.ipfs.io/ipfs/Qmabc123xyz341 | -| `nftMetadataCid` | *Optional* | :heavy_minus_sign: | IPFS CID of the default metadata exported for the video | Qmabc123xyz341 | -| `nftMetadataUrl` | *Optional* | :heavy_minus_sign: | URL for the metadata file with the IPFS protocol | ipfs://Qmabc123xyz341 | -| `nftMetadataGatewayUrl` | *Optional* | :heavy_minus_sign: | URL to access metadata file via HTTP through an IPFS
gateway
| https://gateway.ipfs.io/ipfs/Qmabc123xyz341 | \ No newline at end of file +| `videoFileUrl` | *Optional\* | :heavy_minus_sign: | URL for the file with the IPFS protocol | ipfs://Qmabc123xyz341 | +| `videoFileGatewayUrl` | *Optional\* | :heavy_minus_sign: | URL to access file via HTTP through an IPFS gateway | https://gateway.ipfs.io/ipfs/Qmabc123xyz341 | +| `nftMetadataCid` | *Optional\* | :heavy_minus_sign: | IPFS CID of the default metadata exported for the video | Qmabc123xyz341 | +| `nftMetadataUrl` | *Optional\* | :heavy_minus_sign: | URL for the metadata file with the IPFS protocol | ipfs://Qmabc123xyz341 | +| `nftMetadataGatewayUrl` | *Optional\* | :heavy_minus_sign: | URL to access metadata file via HTTP through an IPFS
gateway
| https://gateway.ipfs.io/ipfs/Qmabc123xyz341 | \ No newline at end of file diff --git a/docs/models/components/TaskMp4.md b/docs/models/components/TaskMp4.md index 33ffa160..c71e250c 100644 --- a/docs/models/components/TaskMp4.md +++ b/docs/models/components/TaskMp4.md @@ -7,4 +7,4 @@ MP4 output format | Field | Type | Required | Description | Example | | ----------------------- | ----------------------- | ----------------------- | ----------------------- | ----------------------- | -| `path` | *Optional* | :heavy_minus_sign: | Path for the MP4 output | /samplevideo/mp4 | \ No newline at end of file +| `path` | *Optional\* | :heavy_minus_sign: | Path for the MP4 output | /samplevideo/mp4 | \ No newline at end of file diff --git a/docs/models/components/TaskOutputs.md b/docs/models/components/TaskOutputs.md index d18f177c..7c97b8a4 100644 --- a/docs/models/components/TaskOutputs.md +++ b/docs/models/components/TaskOutputs.md @@ -5,7 +5,7 @@ Output formats ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | -| `hls` | [Optional](../../models/components/TaskHls.md) | :heavy_minus_sign: | HLS output format | -| `mp4` | [Optional](../../models/components/TaskMp4.md) | :heavy_minus_sign: | MP4 output format | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `hls` | [Optional\](../../models/components/TaskHls.md) | :heavy_minus_sign: | HLS output format | +| `mp4` | [Optional\](../../models/components/TaskMp4.md) | :heavy_minus_sign: | MP4 output format | \ No newline at end of file diff --git a/docs/models/components/TaskStatus.md b/docs/models/components/TaskStatus.md index 4993beba..f60a5e5a 100644 --- a/docs/models/components/TaskStatus.md +++ b/docs/models/components/TaskStatus.md @@ -9,6 +9,6 @@ Status of the task | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | | `phase` | [TaskPhase](../../models/components/TaskPhase.md) | :heavy_check_mark: | Phase of the task | pending | | `updatedAt` | *double* | :heavy_check_mark: | Timestamp (in milliseconds) at which task was updated | 1587667174725 | -| `progress` | *Optional* | :heavy_minus_sign: | Current progress of the task in a 0-1 ratio | 0.5 | -| `errorMessage` | *Optional* | :heavy_minus_sign: | Error message if the task failed | Failed to upload file | -| `retries` | *Optional* | :heavy_minus_sign: | Number of retries done on the task | 3 | \ No newline at end of file +| `progress` | *Optional\* | :heavy_minus_sign: | Current progress of the task in a 0-1 ratio | 0.5 | +| `errorMessage` | *Optional\* | :heavy_minus_sign: | Error message if the task failed | Failed to upload file | +| `retries` | *Optional\* | :heavy_minus_sign: | Number of retries done on the task | 3 | \ No newline at end of file diff --git a/docs/models/components/TaskStorage.md b/docs/models/components/TaskStorage.md index 236ea08e..2f8dc64b 100644 --- a/docs/models/components/TaskStorage.md +++ b/docs/models/components/TaskStorage.md @@ -7,4 +7,4 @@ Storage for the output files | Field | Type | Required | Description | Example | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `url` | *Optional* | :heavy_minus_sign: | URL of the output storage, accepts object-store format
"s3+https"
| s3+https://accessKeyId:secretAccessKey@s3Endpoint/bucket | \ No newline at end of file +| `url` | *Optional\* | :heavy_minus_sign: | URL of the output storage, accepts object-store format
"s3+https"
| s3+https://accessKeyId:secretAccessKey@s3Endpoint/bucket | \ No newline at end of file diff --git a/docs/models/components/TaskUpload.md b/docs/models/components/TaskUpload.md new file mode 100644 index 00000000..eb35075e --- /dev/null +++ b/docs/models/components/TaskUpload.md @@ -0,0 +1,11 @@ +# TaskUpload + +Output of the upload task + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| `assetSpec` | [Optional\](../../models/components/Asset.md) | :heavy_minus_sign: | N/A | +| `additionalProperties` | Map\ | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/Tasks.md b/docs/models/components/Tasks.md index 2109aa9a..18b57236 100644 --- a/docs/models/components/Tasks.md +++ b/docs/models/components/Tasks.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -| `pending` | *Optional* | :heavy_minus_sign: | ID of any currently running task that is exporting this
asset to IPFS.
| 09F8B46C-61A0-4254-9875-F71F4C605BC7 | -| `last` | *Optional* | :heavy_minus_sign: | ID of the last task to run successfully, that created
the currently saved data.
| 09F8B46C-61A0-4254-9875-F71F4C605BC7 | -| `failed` | *Optional* | :heavy_minus_sign: | ID of the last task to fail execution. | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | \ No newline at end of file +| `pending` | *Optional\* | :heavy_minus_sign: | ID of any currently running task that is exporting this
asset to IPFS.
| 09F8B46C-61A0-4254-9875-F71F4C605BC7 | +| `last` | *Optional\* | :heavy_minus_sign: | ID of the last task to run successfully, that created
the currently saved data.
| 09F8B46C-61A0-4254-9875-F71F4C605BC7 | +| `failed` | *Optional\* | :heavy_minus_sign: | ID of the last task to fail execution. | 09F8B46C-61A0-4254-9875-F71F4C605BC7 | \ No newline at end of file diff --git a/docs/models/components/Tracks.md b/docs/models/components/Tracks.md index 6b6c0f56..cf8828b4 100644 --- a/docs/models/components/Tracks.md +++ b/docs/models/components/Tracks.md @@ -7,13 +7,13 @@ | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | | `type` | [AssetVideoSpecType](../../models/components/AssetVideoSpecType.md) | :heavy_check_mark: | type of track | video | | `codec` | *String* | :heavy_check_mark: | Codec of the track | aac | -| `startTime` | *Optional* | :heavy_minus_sign: | Start time of the track in seconds | 23.8238 | -| `duration` | *Optional* | :heavy_minus_sign: | Duration of the track in seconds | 23.8238 | -| `bitrate` | *Optional* | :heavy_minus_sign: | Bitrate of the track in bits per second | 1000000 | -| `width` | *Optional* | :heavy_minus_sign: | Width of the track - only for video tracks | 1920 | -| `height` | *Optional* | :heavy_minus_sign: | Height of the track - only for video tracks | 1080 | -| `pixelFormat` | *Optional* | :heavy_minus_sign: | Pixel format of the track - only for video tracks | yuv420p | -| `fps` | *Optional* | :heavy_minus_sign: | Frame rate of the track - only for video tracks | 30 | -| `channels` | *Optional* | :heavy_minus_sign: | Amount of audio channels in the track | 2 | -| `sampleRate` | *Optional* | :heavy_minus_sign: | Sample rate of the track in samples per second - only for
audio tracks
| 44100 | -| `bitDepth` | *Optional* | :heavy_minus_sign: | Bit depth of the track - only for audio tracks | 16 | \ No newline at end of file +| `startTime` | *Optional\* | :heavy_minus_sign: | Start time of the track in seconds | 23.8238 | +| `duration` | *Optional\* | :heavy_minus_sign: | Duration of the track in seconds | 23.8238 | +| `bitrate` | *Optional\* | :heavy_minus_sign: | Bitrate of the track in bits per second | 1000000 | +| `width` | *Optional\* | :heavy_minus_sign: | Width of the track - only for video tracks | 1920 | +| `height` | *Optional\* | :heavy_minus_sign: | Height of the track - only for video tracks | 1080 | +| `pixelFormat` | *Optional\* | :heavy_minus_sign: | Pixel format of the track - only for video tracks | yuv420p | +| `fps` | *Optional\* | :heavy_minus_sign: | Frame rate of the track - only for video tracks | 30 | +| `channels` | *Optional\* | :heavy_minus_sign: | Amount of audio channels in the track | 2 | +| `sampleRate` | *Optional\* | :heavy_minus_sign: | Sample rate of the track in samples per second - only for
audio tracks
| 44100 | +| `bitDepth` | *Optional\* | :heavy_minus_sign: | Bit depth of the track - only for audio tracks | 16 | \ No newline at end of file diff --git a/docs/models/components/TranscodeFile.md b/docs/models/components/TranscodeFile.md index 64a07928..9e7c8f65 100644 --- a/docs/models/components/TranscodeFile.md +++ b/docs/models/components/TranscodeFile.md @@ -5,12 +5,12 @@ Parameters for the transcode-file task ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- | -| `input` | [Optional](../../models/components/TaskInput.md) | :heavy_minus_sign: | Input video file to transcode | | -| `storage` | [Optional](../../models/components/TaskStorage.md) | :heavy_minus_sign: | Storage for the output files | | -| `outputs` | [Optional](../../models/components/TaskOutputs.md) | :heavy_minus_sign: | Output formats | | -| `profiles` | List<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | | -| `targetSegmentSizeSecs` | *Optional* | :heavy_minus_sign: | How many seconds the duration of each output segment should
be
| 10 | -| `creatorId` | [Optional](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | | -| `c2pa` | *Optional* | :heavy_minus_sign: | Decides if the output video should include C2PA signature | false | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `input` | [Optional\](../../models/components/TaskInput.md) | :heavy_minus_sign: | Input video file to transcode | | +| `storage` | [Optional\](../../models/components/TaskStorage.md) | :heavy_minus_sign: | Storage for the output files | | +| `outputs` | [Optional\](../../models/components/TaskOutputs.md) | :heavy_minus_sign: | Output formats | | +| `profiles` | List\<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | | +| `targetSegmentSizeSecs` | *Optional\* | :heavy_minus_sign: | How many seconds the duration of each output segment should
be
| 10 | +| `creatorId` | [Optional\](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | | +| `c2pa` | *Optional\* | :heavy_minus_sign: | Decides if the output video should include C2PA signature | false | \ No newline at end of file diff --git a/docs/models/components/TranscodePayload.md b/docs/models/components/TranscodePayload.md index 3618ac8d..9f2d6855 100644 --- a/docs/models/components/TranscodePayload.md +++ b/docs/models/components/TranscodePayload.md @@ -8,7 +8,7 @@ | `input` | [Input](../../models/components/Input.md) | :heavy_check_mark: | N/A | | `storage` | [TranscodePayloadStorage](../../models/components/TranscodePayloadStorage.md) | :heavy_check_mark: | N/A | | `outputs` | [Outputs](../../models/components/Outputs.md) | :heavy_check_mark: | Output formats | -| `profiles` | List<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | -| `targetSegmentSizeSecs` | *Optional* | :heavy_minus_sign: | How many seconds the duration of each output segment should be | -| `creatorId` | [Optional](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | -| `c2pa` | *Optional* | :heavy_minus_sign: | Decides if the output video should include C2PA signature | \ No newline at end of file +| `profiles` | List\<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | +| `targetSegmentSizeSecs` | *Optional\* | :heavy_minus_sign: | How many seconds the duration of each output segment should be | +| `creatorId` | [Optional\](../../models/components/InputCreatorId.md) | :heavy_minus_sign: | N/A | +| `c2pa` | *Optional\* | :heavy_minus_sign: | Decides if the output video should include C2PA signature | \ No newline at end of file diff --git a/docs/models/components/TranscodeProfile.md b/docs/models/components/TranscodeProfile.md index bff35f64..71a416ab 100644 --- a/docs/models/components/TranscodeProfile.md +++ b/docs/models/components/TranscodeProfile.md @@ -7,13 +7,13 @@ Transcode API profile | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `width` | *Optional* | :heavy_minus_sign: | N/A | 1280 | -| `name` | *Optional* | :heavy_minus_sign: | N/A | 720p | -| `height` | *Optional* | :heavy_minus_sign: | N/A | 720 | +| `width` | *Optional\* | :heavy_minus_sign: | N/A | 1280 | +| `name` | *Optional\* | :heavy_minus_sign: | N/A | 720p | +| `height` | *Optional\* | :heavy_minus_sign: | N/A | 720 | | `bitrate` | *long* | :heavy_check_mark: | N/A | 3000000 | -| `quality` | *Optional* | :heavy_minus_sign: | Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it.
| 23 | -| `fps` | *Optional* | :heavy_minus_sign: | N/A | 30 | -| `fpsDen` | *Optional* | :heavy_minus_sign: | N/A | 1 | -| `gop` | *Optional* | :heavy_minus_sign: | N/A | 2 | -| `profile` | [Optional](../../models/components/TranscodeProfileProfile.md) | :heavy_minus_sign: | N/A | H264Baseline | -| `encoder` | [Optional](../../models/components/TranscodeProfileEncoder.md) | :heavy_minus_sign: | N/A | H.264 | \ No newline at end of file +| `quality` | *Optional\* | :heavy_minus_sign: | Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it.
| 23 | +| `fps` | *Optional\* | :heavy_minus_sign: | N/A | 30 | +| `fpsDen` | *Optional\* | :heavy_minus_sign: | N/A | 1 | +| `gop` | *Optional\* | :heavy_minus_sign: | N/A | 2 | +| `profile` | [Optional\](../../models/components/TranscodeProfileProfile.md) | :heavy_minus_sign: | N/A | H264Baseline | +| `encoder` | [Optional\](../../models/components/TranscodeProfileEncoder.md) | :heavy_minus_sign: | N/A | H.264 | \ No newline at end of file diff --git a/docs/models/components/Upload.md b/docs/models/components/Upload.md index c63ad6d7..2391bd52 100644 --- a/docs/models/components/Upload.md +++ b/docs/models/components/Upload.md @@ -5,10 +5,10 @@ Parameters for the upload task ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------- | -| `url` | *Optional* | :heavy_minus_sign: | URL of the asset to "upload" | https://cdn.livepeer.com/ABC123/filename.mp4 | -| `encryption` | [Optional](../../models/components/EncryptionOutput.md) | :heavy_minus_sign: | N/A | | -| `c2pa` | *Optional* | :heavy_minus_sign: | Decides if the output video should include C2PA signature | true | -| `profiles` | List<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | | -| `targetSegmentSizeSecs` | *Optional* | :heavy_minus_sign: | How many seconds the duration of each output segment should be | 6 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `url` | *Optional\* | :heavy_minus_sign: | URL of the asset to "upload" | https://cdn.livepeer.com/ABC123/filename.mp4 | +| `encryption` | [Optional\](../../models/components/EncryptionOutput.md) | :heavy_minus_sign: | N/A | | +| `c2pa` | *Optional\* | :heavy_minus_sign: | Decides if the output video should include C2PA signature | true | +| `profiles` | List\<[TranscodeProfile](../../models/components/TranscodeProfile.md)> | :heavy_minus_sign: | N/A | | +| `targetSegmentSizeSecs` | *Optional\* | :heavy_minus_sign: | How many seconds the duration of each output segment should be | 6 | \ No newline at end of file diff --git a/docs/models/components/UsageMetric.md b/docs/models/components/UsageMetric.md index ceec6784..9b6b5d5a 100644 --- a/docs/models/components/UsageMetric.md +++ b/docs/models/components/UsageMetric.md @@ -8,8 +8,8 @@ An individual metric about usage of a user. | Field | Type | Required | Description | Example | | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | -| `userID` | *Optional* | :heavy_minus_sign: | The user ID associated with the metric | 1bde4o2i6xycudoy | -| `creatorID` | *Optional* | :heavy_minus_sign: | The creator ID associated with the metric | john@doe.com | -| `deliveryUsageMins` | *Optional* | :heavy_minus_sign: | Total minutes of delivery usage. | 100 | -| `totalUsageMins` | *Optional* | :heavy_minus_sign: | Total transcoded minutes. | 100 | -| `storageUsageMins` | *Optional* | :heavy_minus_sign: | Total minutes of storage usage. | 100 | \ No newline at end of file +| `userID` | *Optional\* | :heavy_minus_sign: | The user ID associated with the metric | 1bde4o2i6xycudoy | +| `creatorID` | *Optional\* | :heavy_minus_sign: | The creator ID associated with the metric | john@doe.com | +| `deliveryUsageMins` | *Optional\* | :heavy_minus_sign: | Total minutes of delivery usage. | 100 | +| `totalUsageMins` | *Optional\* | :heavy_minus_sign: | Total transcoded minutes. | 100 | +| `storageUsageMins` | *Optional\* | :heavy_minus_sign: | Total minutes of storage usage. | 100 | \ No newline at end of file diff --git a/docs/models/components/VideoSpec.md b/docs/models/components/VideoSpec.md index e5ce1e9b..808f4050 100644 --- a/docs/models/components/VideoSpec.md +++ b/docs/models/components/VideoSpec.md @@ -7,7 +7,7 @@ Video metadata | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `format` | *Optional* | :heavy_minus_sign: | Format of the asset | mp4 | -| `duration` | *Optional* | :heavy_minus_sign: | Duration of the asset in seconds (float) | 23.8328 | -| `bitrate` | *Optional* | :heavy_minus_sign: | Bitrate of the video in bits per second | 1000000 | -| `tracks` | List<[Tracks](../../models/components/Tracks.md)> | :heavy_minus_sign: | List of tracks associated with the asset when the format
contemplates them (e.g. mp4)
| | \ No newline at end of file +| `format` | *Optional\* | :heavy_minus_sign: | Format of the asset | mp4 | +| `duration` | *Optional\* | :heavy_minus_sign: | Duration of the asset in seconds (float) | 23.8328 | +| `bitrate` | *Optional\* | :heavy_minus_sign: | Bitrate of the video in bits per second | 1000000 | +| `tracks` | List\<[Tracks](../../models/components/Tracks.md)> | :heavy_minus_sign: | List of tracks associated with the asset when the format
contemplates them (e.g. mp4)
| | \ No newline at end of file diff --git a/docs/models/components/ViewershipMetric.md b/docs/models/components/ViewershipMetric.md index 8719a5cc..4783ee32 100644 --- a/docs/models/components/ViewershipMetric.md +++ b/docs/models/components/ViewershipMetric.md @@ -9,25 +9,25 @@ An individual metric about viewership of a stream/asset. Necessarily, at least | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `playbackId` | *Optional* | :heavy_minus_sign: | The playback ID associated with the metric. | 1bde4o2i6xycudoy | -| `creatorId` | *Optional* | :heavy_minus_sign: | The ID of the creator associated with the metric. | john@doe.com | -| `viewerId` | *Optional* | :heavy_minus_sign: | The ID of the viewer associated with the metric. | 1bde4o2i6xycudoy | -| `dStorageUrl` | *Optional* | :heavy_minus_sign: | The URL of the distributed storage used for the asset | ipfs://QmZ4 | -| `timestamp` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) when the metric was recorded. If the
query contains a time step, this timestamp will point to the
beginning of the time step period.
| 1587667174725 | -| `device` | *Optional* | :heavy_minus_sign: | The device used by the viewer. | iPhone | -| `deviceType` | *Optional* | :heavy_minus_sign: | The type of the device used by the viewer. | mobile | -| `cpu` | *Optional* | :heavy_minus_sign: | The CPU used by the viewer's device. | ARM | -| `os` | *Optional* | :heavy_minus_sign: | The operating system used by the viewer. | iOS | -| `browser` | *Optional* | :heavy_minus_sign: | The browser used by the viewer. | Safari | -| `browserEngine` | *Optional* | :heavy_minus_sign: | The browser engine used by the viewer's browser. | WebKit | -| `continent` | *Optional* | :heavy_minus_sign: | The continent where the viewer is located. | North America | -| `country` | *Optional* | :heavy_minus_sign: | The country where the viewer is located. | United States | -| `subdivision` | *Optional* | :heavy_minus_sign: | The subdivision (e.g., state or province) where the viewer is
located.
| California | -| `timezone` | *Optional* | :heavy_minus_sign: | The timezone where the viewer is located. | America/Los_Angeles | -| `geohash` | *Optional* | :heavy_minus_sign: | Geographic encoding of the viewers location. Accurate to 3 digits. | 123 | +| `playbackId` | *Optional\* | :heavy_minus_sign: | The playback ID associated with the metric. | 1bde4o2i6xycudoy | +| `creatorId` | *Optional\* | :heavy_minus_sign: | The ID of the creator associated with the metric. | john@doe.com | +| `viewerId` | *Optional\* | :heavy_minus_sign: | The ID of the viewer associated with the metric. | 1bde4o2i6xycudoy | +| `dStorageUrl` | *Optional\* | :heavy_minus_sign: | The URL of the distributed storage used for the asset | ipfs://QmZ4 | +| `timestamp` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) when the metric was recorded. If the
query contains a time step, this timestamp will point to the
beginning of the time step period.
| 1587667174725 | +| `device` | *Optional\* | :heavy_minus_sign: | The device used by the viewer. | iPhone | +| `deviceType` | *Optional\* | :heavy_minus_sign: | The type of the device used by the viewer. | mobile | +| `cpu` | *Optional\* | :heavy_minus_sign: | The CPU used by the viewer's device. | ARM | +| `os` | *Optional\* | :heavy_minus_sign: | The operating system used by the viewer. | iOS | +| `browser` | *Optional\* | :heavy_minus_sign: | The browser used by the viewer. | Safari | +| `browserEngine` | *Optional\* | :heavy_minus_sign: | The browser engine used by the viewer's browser. | WebKit | +| `continent` | *Optional\* | :heavy_minus_sign: | The continent where the viewer is located. | North America | +| `country` | *Optional\* | :heavy_minus_sign: | The country where the viewer is located. | United States | +| `subdivision` | *Optional\* | :heavy_minus_sign: | The subdivision (e.g., state or province) where the viewer is
located.
| California | +| `timezone` | *Optional\* | :heavy_minus_sign: | The timezone where the viewer is located. | America/Los_Angeles | +| `geohash` | *Optional\* | :heavy_minus_sign: | Geographic encoding of the viewers location. Accurate to 3 digits. | 123 | | `viewCount` | *long* | :heavy_check_mark: | The number of views for the stream/asset. | 100 | | `playtimeMins` | *double* | :heavy_check_mark: | The total playtime in minutes for the stream/asset. | 10 | -| `ttffMs` | *Optional* | :heavy_minus_sign: | The time-to-first-frame (TTFF) in milliseconds. | 100 | -| `rebufferRatio` | *Optional* | :heavy_minus_sign: | The rebuffering ratio for the asset. | 0.1 | -| `errorRate` | *Optional* | :heavy_minus_sign: | The error rate for the stream/asset. | 0.1 | -| `exitsBeforeStart` | *Optional* | :heavy_minus_sign: | The percentage of sessions that existed before the asset started
playing.
| 0.5 | \ No newline at end of file +| `ttffMs` | *Optional\* | :heavy_minus_sign: | The time-to-first-frame (TTFF) in milliseconds. | 100 | +| `rebufferRatio` | *Optional\* | :heavy_minus_sign: | The rebuffering ratio for the asset. | 0.1 | +| `errorRate` | *Optional\* | :heavy_minus_sign: | The error rate for the stream/asset. | 0.1 | +| `exitsBeforeStart` | *Optional\* | :heavy_minus_sign: | The percentage of sessions that existed before the asset started
playing.
| 0.5 | \ No newline at end of file diff --git a/docs/models/components/Webhook.md b/docs/models/components/Webhook.md index f51664eb..830bf568 100644 --- a/docs/models/components/Webhook.md +++ b/docs/models/components/Webhook.md @@ -5,13 +5,13 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| `id` | *Optional* | :heavy_minus_sign: | N/A | de7818e7-610a-4057-8f6f-b785dc1e6f88 | +| `id` | *Optional\* | :heavy_minus_sign: | N/A | de7818e7-610a-4057-8f6f-b785dc1e6f88 | | `name` | *String* | :heavy_check_mark: | N/A | test_webhook | -| ~~`kind`~~ | *Optional* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | webhook | -| ~~`userId`~~ | *Optional* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | | -| `projectId` | *Optional* | :heavy_minus_sign: | The ID of the project | aac12556-4d65-4d34-9fb6-d1f0985eb0a9 | -| `createdAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which stream object was created | 1587667174725 | -| `events` | List<[Events](../../models/components/Events.md)> | :heavy_minus_sign: | N/A | [
"stream.started",
"stream.idle"
] | +| ~~`kind`~~ | *Optional\* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | webhook | +| ~~`userId`~~ | *Optional\* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | | +| `projectId` | *Optional\* | :heavy_minus_sign: | The ID of the project | aac12556-4d65-4d34-9fb6-d1f0985eb0a9 | +| `createdAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which stream object was created | 1587667174725 | +| `events` | List\<[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 | -| `streamId` | *Optional* | :heavy_minus_sign: | streamId of the stream on which the webhook is applied | de7818e7-610a-4057-8f6f-b785dc1e6f88 | -| `status` | [Optional](../../models/components/Status.md) | :heavy_minus_sign: | status of webhook | | \ No newline at end of file +| `streamId` | *Optional\* | :heavy_minus_sign: | streamId of the stream on which the webhook is applied | de7818e7-610a-4057-8f6f-b785dc1e6f88 | +| `status` | [Optional\](../../models/components/Status.md) | :heavy_minus_sign: | status of webhook | | \ 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 00000000..3c953457 --- /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` | *Optional\* | :heavy_minus_sign: | The ID of the project | aac12556-4d65-4d34-9fb6-d1f0985eb0a9 | +| `events` | List\<[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` | *Optional\* | :heavy_minus_sign: | shared secret used to sign the webhook payload | my-secret | +| `streamId` | *Optional\* | :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/components/WebhookLog.md b/docs/models/components/WebhookLog.md index 354a8891..922a6b99 100644 --- a/docs/models/components/WebhookLog.md +++ b/docs/models/components/WebhookLog.md @@ -7,9 +7,9 @@ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | | `id` | *String* | :heavy_check_mark: | N/A | de7818e7-610a-4057-8f6f-b785dc1e6f88 | | `webhookId` | *String* | :heavy_check_mark: | ID of the webhook this request was made for | de7818e7-610a-4057-8f6f-b785dc1e6f88 | -| `event` | *Optional* | :heavy_minus_sign: | The event type that triggered the webhook request | stream.started | -| `createdAt` | *Optional* | :heavy_minus_sign: | Timestamp (in milliseconds) at which webhook request object was
created
| 1587667174725 | -| `duration` | *Optional* | :heavy_minus_sign: | The time taken (in seconds) to make the webhook request | 0.5 | -| `success` | *Optional* | :heavy_minus_sign: | Whether the webhook request was successful | true | -| `request` | [Optional](../../models/components/Request.md) | :heavy_minus_sign: | N/A | | -| `response` | [Optional](../../models/components/Response.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `event` | *Optional\* | :heavy_minus_sign: | The event type that triggered the webhook request | stream.started | +| `createdAt` | *Optional\* | :heavy_minus_sign: | Timestamp (in milliseconds) at which webhook request object was
created
| 1587667174725 | +| `duration` | *Optional\* | :heavy_minus_sign: | The time taken (in seconds) to make the webhook request | 0.5 | +| `success` | *Optional\* | :heavy_minus_sign: | Whether the webhook request was successful | true | +| `request` | [Optional\](../../models/components/Request.md) | :heavy_minus_sign: | N/A | | +| `response` | [Optional\](../../models/components/Response.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/errors/Error.md b/docs/models/errors/Error.md index 25b31cc3..a2ba4c3d 100644 --- a/docs/models/errors/Error.md +++ b/docs/models/errors/Error.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `errors` | List<*String*> | :heavy_minus_sign: | N/A | \ No newline at end of file +| `errors` | List\<*String*> | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/AddMultistreamTargetResponse.md b/docs/models/operations/AddMultistreamTargetResponse.md index 3da82469..6d1a37e9 100644 --- a/docs/models/operations/AddMultistreamTargetResponse.md +++ b/docs/models/operations/AddMultistreamTargetResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 c6406603..37592f47 100644 --- a/docs/models/operations/CreateClipResponse.md +++ b/docs/models/operations/CreateClipResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | [Optional](../../models/operations/CreateClipData.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | [Optional\](../../models/operations/CreateClipData.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../models/components/Error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/CreateClipTask.md b/docs/models/operations/CreateClipTask.md index dc493a05..5d710cdb 100644 --- a/docs/models/operations/CreateClipTask.md +++ b/docs/models/operations/CreateClipTask.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `id` | *Optional* | :heavy_minus_sign: | N/A | 34d7618e-fd42-4798-acf5-19504616a11e | \ No newline at end of file +| `id` | *Optional\* | :heavy_minus_sign: | N/A | 34d7618e-fd42-4798-acf5-19504616a11e | \ No newline at end of file diff --git a/docs/models/operations/CreateMultistreamTargetResponse.md b/docs/models/operations/CreateMultistreamTargetResponse.md index 28ec03ba..a021587b 100644 --- a/docs/models/operations/CreateMultistreamTargetResponse.md +++ b/docs/models/operations/CreateMultistreamTargetResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `multistreamTarget` | [Optional](../../models/components/MultistreamTarget.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `multistreamTarget` | [Optional\](../../models/components/MultistreamTarget.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 df87089d..da4e4179 100644 --- a/docs/models/operations/CreateRoomResponse.md +++ b/docs/models/operations/CreateRoomResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `createRoomResponse` | [Optional](../../models/components/CreateRoomResponse.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `createRoomResponse` | [Optional\](../../models/components/CreateRoomResponse.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 1d41549a..940a107e 100644 --- a/docs/models/operations/CreateRoomUserResponse.md +++ b/docs/models/operations/CreateRoomUserResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `roomUserResponse` | [Optional](../../models/components/RoomUserResponse.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `roomUserResponse` | [Optional\](../../models/components/RoomUserResponse.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 327fde06..aa854ca2 100644 --- a/docs/models/operations/CreateSigningKeyResponse.md +++ b/docs/models/operations/CreateSigningKeyResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `signingKey` | [Optional](../../models/components/SigningKey.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `signingKey` | [Optional\](../../models/components/SigningKey.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 2d8e055d..a0db684e 100644 --- a/docs/models/operations/CreateStreamResponse.md +++ b/docs/models/operations/CreateStreamResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `stream` | [Optional](../../models/components/Stream.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `stream` | [Optional\](../../models/components/Stream.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 83db0cd6..94d1e75f 100644 --- a/docs/models/operations/CreateWebhookResponse.md +++ b/docs/models/operations/CreateWebhookResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `webhook` | [Optional](../../models/components/Webhook.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `webhook` | [Optional\](../../models/components/Webhook.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 9faa3878..646b0c89 100644 --- a/docs/models/operations/DeleteAssetResponse.md +++ b/docs/models/operations/DeleteAssetResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 97a72d44..4d4d54d6 100644 --- a/docs/models/operations/DeleteMultistreamTargetResponse.md +++ b/docs/models/operations/DeleteMultistreamTargetResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 f86b8a70..d17ee51c 100644 --- a/docs/models/operations/DeleteRoomResponse.md +++ b/docs/models/operations/DeleteRoomResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 390d080e..1f774534 100644 --- a/docs/models/operations/DeleteRoomUserResponse.md +++ b/docs/models/operations/DeleteRoomUserResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 9253c43b..284503c3 100644 --- a/docs/models/operations/DeleteSigningKeyResponse.md +++ b/docs/models/operations/DeleteSigningKeyResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 6e84149f..edcf1cda 100644 --- a/docs/models/operations/DeleteStreamResponse.md +++ b/docs/models/operations/DeleteStreamResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 43325530..4ed0a1f8 100644 --- a/docs/models/operations/DeleteWebhookResponse.md +++ b/docs/models/operations/DeleteWebhookResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `webhook` | [Optional](../../models/components/Webhook.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `webhook` | [Optional\](../../models/components/Webhook.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../models/components/Error.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 bab0167d..d32ca7ad 100644 --- a/docs/models/operations/GetAssetResponse.md +++ b/docs/models/operations/GetAssetResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `asset` | [Optional](../../models/components/Asset.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `asset` | [Optional\](../../models/components/Asset.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 a3e6551f..0b53d04d 100644 --- a/docs/models/operations/GetAssetsResponse.md +++ b/docs/models/operations/GetAssetsResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[Asset](../../models/components/Asset.md)> | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[Asset](../../models/components/Asset.md)> | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 56d4ce27..aa13b5b9 100644 --- a/docs/models/operations/GetClipsResponse.md +++ b/docs/models/operations/GetClipsResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[Asset](../../models/components/Asset.md)> | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[Asset](../../models/components/Asset.md)> | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../models/components/Error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/GetCreatorViewershipMetricsRequest.md b/docs/models/operations/GetCreatorViewershipMetricsRequest.md index d1489629..6ce86463 100644 --- a/docs/models/operations/GetCreatorViewershipMetricsRequest.md +++ b/docs/models/operations/GetCreatorViewershipMetricsRequest.md @@ -3,12 +3,12 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -| `from` | [Optional](../../models/operations/QueryParamFrom.md) | :heavy_minus_sign: | Start timestamp for the query range (inclusive) | -| `to` | [Optional](../../models/operations/QueryParamTo.md) | :heavy_minus_sign: | End timestamp for the query range (exclusive) | -| `timeStep` | [Optional](../../models/operations/QueryParamTimeStep.md) | :heavy_minus_sign: | The time step to aggregate viewership metrics by | -| `assetId` | *Optional* | :heavy_minus_sign: | The asset ID to filter metrics for | -| `streamId` | *Optional* | :heavy_minus_sign: | The stream ID to filter metrics for | -| `creatorId` | *Optional* | :heavy_minus_sign: | The creator ID to filter the query results | -| `breakdownBy` | List<[GetCreatorViewershipMetricsQueryParamBreakdownBy](../../models/operations/GetCreatorViewershipMetricsQueryParamBreakdownBy.md)> | :heavy_minus_sign: | The list of fields to break down the query results. Specify this
query-string multiple times to break down by multiple fields.
| \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | [Optional\](../../models/operations/QueryParamFrom.md) | :heavy_minus_sign: | Start timestamp for the query range (inclusive) | +| `to` | [Optional\](../../models/operations/QueryParamTo.md) | :heavy_minus_sign: | End timestamp for the query range (exclusive) | +| `timeStep` | [Optional\](../../models/operations/QueryParamTimeStep.md) | :heavy_minus_sign: | The time step to aggregate viewership metrics by | +| `assetId` | *Optional\* | :heavy_minus_sign: | The asset ID to filter metrics for | +| `streamId` | *Optional\* | :heavy_minus_sign: | The stream ID to filter metrics for | +| `creatorId` | *Optional\* | :heavy_minus_sign: | The creator ID to filter the query results | +| `breakdownBy` | List\<[GetCreatorViewershipMetricsQueryParamBreakdownBy](../../models/operations/GetCreatorViewershipMetricsQueryParamBreakdownBy.md)> | :heavy_minus_sign: | The list of fields to break down the query results. Specify this
query-string multiple times to break down by multiple fields.
| \ No newline at end of file diff --git a/docs/models/operations/GetCreatorViewershipMetricsResponse.md b/docs/models/operations/GetCreatorViewershipMetricsResponse.md index df05bb2d..378b40d6 100644 --- a/docs/models/operations/GetCreatorViewershipMetricsResponse.md +++ b/docs/models/operations/GetCreatorViewershipMetricsResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[ViewershipMetric](../../models/components/ViewershipMetric.md)> | :heavy_minus_sign: | A list of Metric objects | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[ViewershipMetric](../../models/components/ViewershipMetric.md)> | :heavy_minus_sign: | A list of Metric objects | +| `error` | [Optional\](../../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 51e416c0..88fc3114 100644 --- a/docs/models/operations/GetMultistreamTargetResponse.md +++ b/docs/models/operations/GetMultistreamTargetResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `multistreamTarget` | [Optional](../../models/components/MultistreamTarget.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `multistreamTarget` | [Optional\](../../models/components/MultistreamTarget.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 ff5c4b82..9a64f13b 100644 --- a/docs/models/operations/GetMultistreamTargetsResponse.md +++ b/docs/models/operations/GetMultistreamTargetsResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[MultistreamTarget](../../models/components/MultistreamTarget.md)> | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[MultistreamTarget](../../models/components/MultistreamTarget.md)> | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 9b55fe80..6eb13d5b 100644 --- a/docs/models/operations/GetPlaybackInfoResponse.md +++ b/docs/models/operations/GetPlaybackInfoResponse.md @@ -3,9 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `playbackInfo` | [Optional](../../models/components/PlaybackInfo.md) | :heavy_minus_sign: | Successful response | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `playbackInfo` | [Optional\](../../models/components/PlaybackInfo.md) | :heavy_minus_sign: | Successful response | +| `error` | [Optional\](../../models/components/Error.md) | :heavy_minus_sign: | Playback not found | \ No newline at end of file diff --git a/docs/models/operations/GetPublicViewershipMetricsData.md b/docs/models/operations/GetPublicViewershipMetricsData.md index f231c25a..9b9522c8 100644 --- a/docs/models/operations/GetPublicViewershipMetricsData.md +++ b/docs/models/operations/GetPublicViewershipMetricsData.md @@ -9,7 +9,7 @@ asset. Either playbackId or dStorageUrl will be set. | Field | Type | Required | Description | Example | | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `playbackId` | *Optional* | :heavy_minus_sign: | The playback ID associated with the metric. | 1bde4o2i6xycudoy | -| `dStorageUrl` | *Optional* | :heavy_minus_sign: | The URL of the distributed storage used for the asset | ipfs://QmZ4 | -| `viewCount` | *Optional* | :heavy_minus_sign: | The number of views for the stream/asset. | 100 | -| `playtimeMins` | *Optional* | :heavy_minus_sign: | The total playtime in minutes for the stream/asset. | 10 | \ No newline at end of file +| `playbackId` | *Optional\* | :heavy_minus_sign: | The playback ID associated with the metric. | 1bde4o2i6xycudoy | +| `dStorageUrl` | *Optional\* | :heavy_minus_sign: | The URL of the distributed storage used for the asset | ipfs://QmZ4 | +| `viewCount` | *Optional\* | :heavy_minus_sign: | The number of views for the stream/asset. | 100 | +| `playtimeMins` | *Optional\* | :heavy_minus_sign: | The total playtime in minutes for the stream/asset. | 10 | \ No newline at end of file diff --git a/docs/models/operations/GetPublicViewershipMetricsResponse.md b/docs/models/operations/GetPublicViewershipMetricsResponse.md index 3872ebb3..b09a88a4 100644 --- a/docs/models/operations/GetPublicViewershipMetricsResponse.md +++ b/docs/models/operations/GetPublicViewershipMetricsResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | [Optional](../../models/operations/GetPublicViewershipMetricsData.md) | :heavy_minus_sign: | A single Metric object with the viewCount and playtimeMins metrics. | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | [Optional\](../../models/operations/GetPublicViewershipMetricsData.md) | :heavy_minus_sign: | A single Metric object with the viewCount and playtimeMins metrics. | +| `error` | [Optional\](../../models/components/Error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/GetRealtimeViewershipNowRequest.md b/docs/models/operations/GetRealtimeViewershipNowRequest.md index 4d9ba217..95046882 100644 --- a/docs/models/operations/GetRealtimeViewershipNowRequest.md +++ b/docs/models/operations/GetRealtimeViewershipNowRequest.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `playbackId` | *Optional* | :heavy_minus_sign: | The playback ID to filter the query results. This can be a canonical
playback ID from Livepeer assets or streams, or dStorage identifiers
for assets
| -| `creatorId` | *Optional* | :heavy_minus_sign: | The creator ID to filter the query results | -| `breakdownBy` | List<[BreakdownBy](../../models/operations/BreakdownBy.md)> | :heavy_minus_sign: | The list of fields to break down the query results. Specify this
query-string multiple times to break down by multiple fields.
| \ No newline at end of file +| `playbackId` | *Optional\* | :heavy_minus_sign: | The playback ID to filter the query results. This can be a canonical
playback ID from Livepeer assets or streams, or dStorage identifiers
for assets
| +| `creatorId` | *Optional\* | :heavy_minus_sign: | The creator ID to filter the query results | +| `breakdownBy` | List\<[BreakdownBy](../../models/operations/BreakdownBy.md)> | :heavy_minus_sign: | The list of fields to break down the query results. Specify this
query-string multiple times to break down by multiple fields.
| \ No newline at end of file diff --git a/docs/models/operations/GetRealtimeViewershipNowResponse.md b/docs/models/operations/GetRealtimeViewershipNowResponse.md index 8e89968c..e41c9bcd 100644 --- a/docs/models/operations/GetRealtimeViewershipNowResponse.md +++ b/docs/models/operations/GetRealtimeViewershipNowResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[RealtimeViewershipMetric](../../models/components/RealtimeViewershipMetric.md)> | :heavy_minus_sign: | A list of Metric objects | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[RealtimeViewershipMetric](../../models/components/RealtimeViewershipMetric.md)> | :heavy_minus_sign: | A list of Metric objects | +| `error` | [Optional\](../../models/components/Error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/GetRecordedSessionsRequest.md b/docs/models/operations/GetRecordedSessionsRequest.md index e7b927ed..a8efe115 100644 --- a/docs/models/operations/GetRecordedSessionsRequest.md +++ b/docs/models/operations/GetRecordedSessionsRequest.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | | `parentId` | *String* | :heavy_check_mark: | ID of the parent stream | | -| `record` | [Optional](../../models/operations/Record.md) | :heavy_minus_sign: | Flag indicating if the response should only include recorded
sessions
| true | \ No newline at end of file +| `record` | [Optional\](../../models/operations/Record.md) | :heavy_minus_sign: | Flag indicating if the response should only include recorded
sessions
| true | \ No newline at end of file diff --git a/docs/models/operations/GetRecordedSessionsResponse.md b/docs/models/operations/GetRecordedSessionsResponse.md index cce07520..c18aa18a 100644 --- a/docs/models/operations/GetRecordedSessionsResponse.md +++ b/docs/models/operations/GetRecordedSessionsResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[Session](../../models/components/Session.md)> | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[Session](../../models/components/Session.md)> | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 c0d88115..f52875b2 100644 --- a/docs/models/operations/GetRoomResponse.md +++ b/docs/models/operations/GetRoomResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `room` | [Optional](../../models/components/Room.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `room` | [Optional\](../../models/components/Room.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 86e160e6..a63ebab6 100644 --- a/docs/models/operations/GetRoomUserResponse.md +++ b/docs/models/operations/GetRoomUserResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `getRoomUserResponse` | [Optional](../../models/components/GetRoomUserResponse.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `getRoomUserResponse` | [Optional\](../../models/components/GetRoomUserResponse.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 954e521c..e61d321a 100644 --- a/docs/models/operations/GetSessionClipsResponse.md +++ b/docs/models/operations/GetSessionClipsResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[Asset](../../models/components/Asset.md)> | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[Asset](../../models/components/Asset.md)> | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 2a1833ef..c317a102 100644 --- a/docs/models/operations/GetSessionResponse.md +++ b/docs/models/operations/GetSessionResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `session` | [Optional](../../models/components/Session.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `session` | [Optional\](../../models/components/Session.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 2bce61e7..7d18c522 100644 --- a/docs/models/operations/GetSessionsResponse.md +++ b/docs/models/operations/GetSessionsResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[Session](../../models/components/Session.md)> | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[Session](../../models/components/Session.md)> | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 efc8ecca..6952fdf1 100644 --- a/docs/models/operations/GetSigningKeyResponse.md +++ b/docs/models/operations/GetSigningKeyResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `signingKey` | [Optional](../../models/components/SigningKey.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `signingKey` | [Optional\](../../models/components/SigningKey.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 e65fd8eb..5e1668ee 100644 --- a/docs/models/operations/GetSigningKeysResponse.md +++ b/docs/models/operations/GetSigningKeysResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[SigningKey](../../models/components/SigningKey.md)> | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[SigningKey](../../models/components/SigningKey.md)> | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 ae521bc5..98595ba9 100644 --- a/docs/models/operations/GetStreamResponse.md +++ b/docs/models/operations/GetStreamResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `stream` | [Optional](../../models/components/Stream.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `stream` | [Optional\](../../models/components/Stream.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../models/components/Error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/GetStreamsRequest.md b/docs/models/operations/GetStreamsRequest.md index bbd99d7d..1718ff6a 100644 --- a/docs/models/operations/GetStreamsRequest.md +++ b/docs/models/operations/GetStreamsRequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `streamsonly` | *Optional* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------- | ------------------- | ------------------- | ------------------- | +| `streamsonly` | *Optional\* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/GetStreamsResponse.md b/docs/models/operations/GetStreamsResponse.md index 1ea00102..4c9be9d7 100644 --- a/docs/models/operations/GetStreamsResponse.md +++ b/docs/models/operations/GetStreamsResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[Stream](../../models/components/Stream.md)> | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[Stream](../../models/components/Stream.md)> | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../models/components/Error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/GetTaskResponse.md b/docs/models/operations/GetTaskResponse.md index 3a27830b..5292e0a9 100644 --- a/docs/models/operations/GetTaskResponse.md +++ b/docs/models/operations/GetTaskResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `task` | [Optional](../../models/components/Task.md) | :heavy_minus_sign: | Success | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `task` | [Optional\](../../models/components/Task.md) | :heavy_minus_sign: | Success | \ No newline at end of file diff --git a/docs/models/operations/GetTasksResponse.md b/docs/models/operations/GetTasksResponse.md index 72f6c33d..b2cd898b 100644 --- a/docs/models/operations/GetTasksResponse.md +++ b/docs/models/operations/GetTasksResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[Task](../../models/components/Task.md)> | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[Task](../../models/components/Task.md)> | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../models/components/Error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/GetUsageMetricsRequest.md b/docs/models/operations/GetUsageMetricsRequest.md index 5ca81b34..47a999bd 100644 --- a/docs/models/operations/GetUsageMetricsRequest.md +++ b/docs/models/operations/GetUsageMetricsRequest.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -| `from` | *Optional* | :heavy_minus_sign: | Start millis timestamp for the query range (inclusive)
| -| `to` | *Optional* | :heavy_minus_sign: | End millis timestamp for the query range (exclusive)
| -| `timeStep` | [Optional](../../models/operations/GetUsageMetricsQueryParamTimeStep.md) | :heavy_minus_sign: | The time step to aggregate viewership metrics by
| -| `creatorId` | *Optional* | :heavy_minus_sign: | The creator ID to filter the query results
| -| `breakdownBy` | List<[GetUsageMetricsQueryParamBreakdownBy](../../models/operations/GetUsageMetricsQueryParamBreakdownBy.md)> | :heavy_minus_sign: | The list of fields to break down the query results. Currently the
only supported breakdown is by `creatorId`.
| \ No newline at end of file +| `from` | *Optional\* | :heavy_minus_sign: | Start millis timestamp for the query range (inclusive)
| +| `to` | *Optional\* | :heavy_minus_sign: | End millis timestamp for the query range (exclusive)
| +| `timeStep` | [Optional\](../../models/operations/GetUsageMetricsQueryParamTimeStep.md) | :heavy_minus_sign: | The time step to aggregate viewership metrics by
| +| `creatorId` | *Optional\* | :heavy_minus_sign: | The creator ID to filter the query results
| +| `breakdownBy` | List\<[GetUsageMetricsQueryParamBreakdownBy](../../models/operations/GetUsageMetricsQueryParamBreakdownBy.md)> | :heavy_minus_sign: | The list of fields to break down the query results. Currently the
only supported breakdown is by `creatorId`.
| \ No newline at end of file diff --git a/docs/models/operations/GetUsageMetricsResponse.md b/docs/models/operations/GetUsageMetricsResponse.md index b31e631e..ec428fe6 100644 --- a/docs/models/operations/GetUsageMetricsResponse.md +++ b/docs/models/operations/GetUsageMetricsResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `usageMetric` | [Optional](../../models/components/UsageMetric.md) | :heavy_minus_sign: | A Usage Metric object | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `usageMetric` | [Optional\](../../models/components/UsageMetric.md) | :heavy_minus_sign: | A Usage Metric object | +| `error` | [Optional\](../../models/components/Error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/GetViewershipMetricsRequest.md b/docs/models/operations/GetViewershipMetricsRequest.md index efda874a..d57b4bbd 100644 --- a/docs/models/operations/GetViewershipMetricsRequest.md +++ b/docs/models/operations/GetViewershipMetricsRequest.md @@ -5,11 +5,11 @@ | Field | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `playbackId` | *Optional* | :heavy_minus_sign: | The playback ID to filter the query results. This can be a canonical
playback ID from Livepeer assets or streams, or dStorage identifiers
for assets
| -| `from` | [Optional](../../models/operations/From.md) | :heavy_minus_sign: | Start timestamp for the query range (inclusive) | -| `to` | [Optional](../../models/operations/To.md) | :heavy_minus_sign: | End timestamp for the query range (exclusive) | -| `timeStep` | [Optional](../../models/operations/TimeStep.md) | :heavy_minus_sign: | The time step to aggregate viewership metrics by | -| `assetId` | *Optional* | :heavy_minus_sign: | The asset ID to filter metrics for | -| `streamId` | *Optional* | :heavy_minus_sign: | The stream ID to filter metrics for | -| `creatorId` | *Optional* | :heavy_minus_sign: | The creator ID to filter the query results | -| `breakdownBy` | List<[QueryParamBreakdownBy](../../models/operations/QueryParamBreakdownBy.md)> | :heavy_minus_sign: | The list of fields to break down the query results. Specify this
query-string multiple times to break down by multiple fields.
| \ No newline at end of file +| `playbackId` | *Optional\* | :heavy_minus_sign: | The playback ID to filter the query results. This can be a canonical
playback ID from Livepeer assets or streams, or dStorage identifiers
for assets
| +| `from` | [Optional\](../../models/operations/From.md) | :heavy_minus_sign: | Start timestamp for the query range (inclusive) | +| `to` | [Optional\](../../models/operations/To.md) | :heavy_minus_sign: | End timestamp for the query range (exclusive) | +| `timeStep` | [Optional\](../../models/operations/TimeStep.md) | :heavy_minus_sign: | The time step to aggregate viewership metrics by | +| `assetId` | *Optional\* | :heavy_minus_sign: | The asset ID to filter metrics for | +| `streamId` | *Optional\* | :heavy_minus_sign: | The stream ID to filter metrics for | +| `creatorId` | *Optional\* | :heavy_minus_sign: | The creator ID to filter the query results | +| `breakdownBy` | List\<[QueryParamBreakdownBy](../../models/operations/QueryParamBreakdownBy.md)> | :heavy_minus_sign: | The list of fields to break down the query results. Specify this
query-string multiple times to break down by multiple fields.
| \ No newline at end of file diff --git a/docs/models/operations/GetViewershipMetricsResponse.md b/docs/models/operations/GetViewershipMetricsResponse.md index 762ae90a..6d39acfe 100644 --- a/docs/models/operations/GetViewershipMetricsResponse.md +++ b/docs/models/operations/GetViewershipMetricsResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[ViewershipMetric](../../models/components/ViewershipMetric.md)> | :heavy_minus_sign: | A list of Metric objects | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[ViewershipMetric](../../models/components/ViewershipMetric.md)> | :heavy_minus_sign: | A list of Metric objects | +| `error` | [Optional\](../../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 fd44c3ef..d6c722a9 100644 --- a/docs/models/operations/GetWebhookLogResponse.md +++ b/docs/models/operations/GetWebhookLogResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `webhookLog` | [Optional](../../models/components/WebhookLog.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `webhookLog` | [Optional\](../../models/components/WebhookLog.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 e958c3f2..69b8ca62 100644 --- a/docs/models/operations/GetWebhookLogsResponse.md +++ b/docs/models/operations/GetWebhookLogsResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[WebhookLog](../../models/components/WebhookLog.md)> | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[WebhookLog](../../models/components/WebhookLog.md)> | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 2f893e0f..c01e251a 100644 --- a/docs/models/operations/GetWebhookResponse.md +++ b/docs/models/operations/GetWebhookResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `webhook` | [Optional](../../models/components/Webhook.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `webhook` | [Optional\](../../models/components/Webhook.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 2968f74c..9e2a7336 100644 --- a/docs/models/operations/GetWebhooksResponse.md +++ b/docs/models/operations/GetWebhooksResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | List<[Webhook](../../models/components/Webhook.md)> | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | List\<[Webhook](../../models/components/Webhook.md)> | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 d1420839..ff47365c 100644 --- a/docs/models/operations/RemoveMultistreamTargetResponse.md +++ b/docs/models/operations/RemoveMultistreamTargetResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 9ccb4332..872a60ec 100644 --- a/docs/models/operations/RequestUploadResponse.md +++ b/docs/models/operations/RequestUploadResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `data` | [Optional](../../models/operations/RequestUploadData.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `data` | [Optional\](../../models/operations/RequestUploadData.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 9c5d1b65..ff70adb2 100644 --- a/docs/models/operations/ResendWebhookResponse.md +++ b/docs/models/operations/ResendWebhookResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `webhookLog` | [Optional](../../models/components/WebhookLog.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `webhookLog` | [Optional\](../../models/components/WebhookLog.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 23f62ea7..6a97aef1 100644 --- a/docs/models/operations/StartPullStreamResponse.md +++ b/docs/models/operations/StartPullStreamResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 102814e6..b056f981 100644 --- a/docs/models/operations/StartRoomEgressResponse.md +++ b/docs/models/operations/StartRoomEgressResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 efe3aab1..c0e45d07 100644 --- a/docs/models/operations/StopRoomEgressResponse.md +++ b/docs/models/operations/StopRoomEgressResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 42550cc0..2ec368df 100644 --- a/docs/models/operations/TerminateStreamResponse.md +++ b/docs/models/operations/TerminateStreamResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 24ccb137..27502f0c 100644 --- a/docs/models/operations/TranscodeVideoResponse.md +++ b/docs/models/operations/TranscodeVideoResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `task` | [Optional](../../models/components/Task.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `task` | [Optional\](../../models/components/Task.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 dcbc33f3..e00914e4 100644 --- a/docs/models/operations/UpdateAssetResponse.md +++ b/docs/models/operations/UpdateAssetResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `asset` | [Optional](../../models/components/Asset.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `asset` | [Optional\](../../models/components/Asset.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../models/components/Error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/UpdateMultistreamTargetRequest.md b/docs/models/operations/UpdateMultistreamTargetRequest.md index 4d985df0..4c0ee5ff 100644 --- a/docs/models/operations/UpdateMultistreamTargetRequest.md +++ b/docs/models/operations/UpdateMultistreamTargetRequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| `id` | *String* | :heavy_check_mark: | ID of the multistream target | -| `multistreamTargetPatchPayload` | [MultistreamTargetPatchPayload](../../models/components/MultistreamTargetPatchPayload.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| `id` | *String* | :heavy_check_mark: | ID of the multistream target | +| `multistreamTarget` | [MultistreamTargetInput](../../models/components/MultistreamTargetInput.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/UpdateMultistreamTargetResponse.md b/docs/models/operations/UpdateMultistreamTargetResponse.md index e344005b..96cc89cb 100644 --- a/docs/models/operations/UpdateMultistreamTargetResponse.md +++ b/docs/models/operations/UpdateMultistreamTargetResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 d54cb655..2e53ecd3 100644 --- a/docs/models/operations/UpdateRoomUserResponse.md +++ b/docs/models/operations/UpdateRoomUserResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../models/components/Error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/UpdateSigningKeyRequestBody.md b/docs/models/operations/UpdateSigningKeyRequestBody.md index f183b8d4..9732af37 100644 --- a/docs/models/operations/UpdateSigningKeyRequestBody.md +++ b/docs/models/operations/UpdateSigningKeyRequestBody.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------- | ------------------- | ------------------- | ------------------- | -| `disabled` | *Optional* | :heavy_minus_sign: | N/A | -| `name` | *Optional* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------- | -------------------- | -------------------- | -------------------- | +| `disabled` | *Optional\* | :heavy_minus_sign: | N/A | +| `name` | *Optional\* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/UpdateSigningKeyResponse.md b/docs/models/operations/UpdateSigningKeyResponse.md index 815fe3a6..3b8601fa 100644 --- a/docs/models/operations/UpdateSigningKeyResponse.md +++ b/docs/models/operations/UpdateSigningKeyResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 fad32518..ef3ae74c 100644 --- a/docs/models/operations/UpdateStreamResponse.md +++ b/docs/models/operations/UpdateStreamResponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `error` | [Optional\](../../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 49637c2c..3af7b91b 100644 --- a/docs/models/operations/UpdateWebhookResponse.md +++ b/docs/models/operations/UpdateWebhookResponse.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `webhook` | [Optional](../../models/components/Webhook.md) | :heavy_minus_sign: | Success | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `webhook` | [Optional\](../../models/components/Webhook.md) | :heavy_minus_sign: | Success | +| `error` | [Optional\](../../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 a0dad73a..f039c138 100644 --- a/docs/models/operations/UploadAssetResponse.md +++ b/docs/models/operations/UploadAssetResponse.md @@ -3,11 +3,11 @@ ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | -| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `rawResponse` | [HttpResponse](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `twoHundredApplicationJsonData` | [Optional](../../models/operations/UploadAssetData.md) | :heavy_minus_sign: | Upload in progress | -| `twoHundredAndOneApplicationJsonData` | [Optional](../../models/operations/UploadAssetDataOutput.md) | :heavy_minus_sign: | Upload started | -| `error` | *Optional* | :heavy_minus_sign: | Error | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `twoHundredApplicationJsonData` | [Optional\](../../models/operations/UploadAssetData.md) | :heavy_minus_sign: | Upload in progress | +| `twoHundredAndOneApplicationJsonData` | [Optional\](../../models/operations/UploadAssetDataOutput.md) | :heavy_minus_sign: | Upload started | +| `error` | [Optional\](../../models/components/Error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/sdks/accesscontrol/README.md b/docs/sdks/accesscontrol/README.md index 12695c43..cb84186f 100644 --- a/docs/sdks/accesscontrol/README.md +++ b/docs/sdks/accesscontrol/README.md @@ -21,36 +21,28 @@ Up to 10 signing keys can be generated, after that you must delete at least one ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.CreateSigningKeyResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - CreateSigningKeyResponse res = sdk.accessControl().create() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + CreateSigningKeyResponse res = sdk.accessControl().create() .call(); - if (res.signingKey().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.signingKey().isPresent()) { + // handle response } - } } ``` @@ -61,10 +53,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## getAll @@ -72,36 +63,28 @@ Retrieves signing keys ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetSigningKeysResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetSigningKeysResponse res = sdk.accessControl().getAll() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetSigningKeysResponse res = sdk.accessControl().getAll() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -112,10 +95,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## delete @@ -123,35 +105,29 @@ Delete Signing Key ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.DeleteSigningKeyResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - DeleteSigningKeyResponse res = sdk.accessControl().delete() - .keyId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + DeleteSigningKeyResponse res = sdk.accessControl().delete() + .keyId("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -168,10 +144,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## get @@ -179,37 +154,29 @@ Retrieves a signing key ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetSigningKeyResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetSigningKeyResponse res = sdk.accessControl().get() - .keyId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetSigningKeyResponse res = sdk.accessControl().get() + .keyId("") .call(); - if (res.signingKey().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.signingKey().isPresent()) { + // handle response } - } } ``` @@ -226,10 +193,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## update @@ -237,38 +203,32 @@ Update a signing key ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.UpdateSigningKeyRequestBody; import studio.livepeer.livepeer.models.operations.UpdateSigningKeyResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - UpdateSigningKeyResponse res = sdk.accessControl().update() - .keyId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + UpdateSigningKeyResponse res = sdk.accessControl().update() + .keyId("") .requestBody(UpdateSigningKeyRequestBody.builder() .build()) .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -286,6 +246,6 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/asset/README.md b/docs/sdks/asset/README.md index 27da1d3c..371e77a3 100644 --- a/docs/sdks/asset/README.md +++ b/docs/sdks/asset/README.md @@ -20,36 +20,28 @@ Retrieve assets ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetAssetsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetAssetsResponse res = sdk.asset().getAll() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetAssetsResponse res = sdk.asset().getAll() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -60,10 +52,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## create @@ -142,6 +133,7 @@ definition above. ### Example Usage + ```java package hello.world; @@ -149,24 +141,18 @@ import java.lang.Exception; import java.util.List; import java.util.Map; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.components.NewAssetPayload; -import studio.livepeer.livepeer.models.components.PlaybackPolicy; -import studio.livepeer.livepeer.models.components.TranscodeProfile; -import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; -import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; -import studio.livepeer.livepeer.models.components.Type; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.components.*; import studio.livepeer.livepeer.models.operations.RequestUploadResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - NewAssetPayload req = NewAssetPayload.builder() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + NewAssetPayload req = NewAssetPayload.builder() .name("filename.mp4") .staticMp4(true) .playbackPolicy(PlaybackPolicy.builder() @@ -191,21 +177,13 @@ public class Application { .build())) .build(); - RequestUploadResponse res = sdk.asset().create() + RequestUploadResponse res = sdk.asset().create() .request(req) .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -222,10 +200,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## createViaUrl @@ -233,41 +210,30 @@ Upload asset via URL ### Example Usage + ```java package hello.world; import java.lang.Exception; import java.util.List; -import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.components.NewAssetFromUrlPayload; -import studio.livepeer.livepeer.models.components.PlaybackPolicy; -import studio.livepeer.livepeer.models.components.TranscodeProfile; -import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; -import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; -import studio.livepeer.livepeer.models.components.Type; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.components.*; import studio.livepeer.livepeer.models.operations.UploadAssetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - NewAssetFromUrlPayload req = NewAssetFromUrlPayload.builder() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + NewAssetFromUrlPayload req = NewAssetFromUrlPayload.builder() .name("filename.mp4") .url("https://s3.amazonaws.com/my-bucket/path/filename.mp4") .staticMp4(true) - .playbackPolicy(PlaybackPolicy.builder() - .type(Type.WEBHOOK) - .webhookId("1bde4o2i6xycudoy") - .webhookContext(Map.ofEntries( - Map.entry("streamerId", "my-custom-id"))) - .refreshInterval(600d) - .build()) + .playbackPolicy(JsonNullable.of(null)) .profiles(List.of( TranscodeProfile.builder() .bitrate(3000000L) @@ -283,21 +249,13 @@ public class Application { .build())) .build(); - UploadAssetResponse res = sdk.asset().createViaUrl() + UploadAssetResponse res = sdk.asset().createViaUrl() .request(req) .call(); - if (res.twoHundredApplicationJsonData().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.twoHundredApplicationJsonData().isPresent()) { + // handle response } - } } ``` @@ -314,10 +272,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## get @@ -325,37 +282,29 @@ Retrieves an asset ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetAssetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetAssetResponse res = sdk.asset().get() - .assetId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetAssetResponse res = sdk.asset().get() + .assetId("") .call(); - if (res.asset().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.asset().isPresent()) { + // handle response } - } } ``` @@ -372,10 +321,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## update @@ -383,28 +331,26 @@ Patch an asset ### Example Usage + ```java package hello.world; import java.lang.Exception; import java.util.Map; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.components.AssetPatchPayload; -import studio.livepeer.livepeer.models.components.PlaybackPolicy; -import studio.livepeer.livepeer.models.components.Type; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.components.*; import studio.livepeer.livepeer.models.operations.UpdateAssetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - UpdateAssetResponse res = sdk.asset().update() - .assetId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + UpdateAssetResponse res = sdk.asset().update() + .assetId("") .assetPatchPayload(AssetPatchPayload.builder() .name("filename.mp4") .playbackPolicy(PlaybackPolicy.builder() @@ -417,17 +363,9 @@ public class Application { .build()) .call(); - if (res.asset().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.asset().isPresent()) { + // handle response } - } } ``` @@ -445,10 +383,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## delete @@ -456,35 +393,29 @@ Delete an asset ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.DeleteAssetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - DeleteAssetResponse res = sdk.asset().delete() - .assetId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + DeleteAssetResponse res = sdk.asset().delete() + .assetId("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -501,6 +432,6 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/livepeer/README.md b/docs/sdks/livepeer/README.md deleted file mode 100644 index 808685bd..00000000 --- a/docs/sdks/livepeer/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Livepeer SDK - -## Overview - -Livepeer API Reference: Welcome to the Livepeer API reference docs. Here you will find all the -endpoints exposed on the standard Livepeer API, learn how to use them and -what they return. diff --git a/docs/sdks/metrics/README.md b/docs/sdks/metrics/README.md index 16d672c3..9026230f 100644 --- a/docs/sdks/metrics/README.md +++ b/docs/sdks/metrics/README.md @@ -20,42 +20,28 @@ Requires a private (non-CORS) API key to be used. ### Example Usage + ```java package hello.world; import java.lang.Exception; -import java.util.List; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; -import studio.livepeer.livepeer.models.operations.BreakdownBy; import studio.livepeer.livepeer.models.operations.GetRealtimeViewershipNowResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - GetRealtimeViewershipNowResponse res = sdk.metrics().getRealtimeViewership() - .playbackId("") - .creatorId("") - .breakdownBy(List.of( - BreakdownBy.PLAYBACK_ID)) + + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetRealtimeViewershipNowResponse res = sdk.metrics().getRealtimeViewership() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -64,9 +50,9 @@ public class Application { | Parameter | Type | Required | Description | | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `playbackId` | *Optional* | :heavy_minus_sign: | The playback ID to filter the query results. This can be a canonical
playback ID from Livepeer assets or streams, or dStorage identifiers
for assets
| -| `creatorId` | *Optional* | :heavy_minus_sign: | The creator ID to filter the query results | -| `breakdownBy` | List<[BreakdownBy](../../models/operations/BreakdownBy.md)> | :heavy_minus_sign: | The list of fields to break down the query results. Specify this
query-string multiple times to break down by multiple fields.
| +| `playbackId` | *Optional\* | :heavy_minus_sign: | The playback ID to filter the query results. This can be a canonical
playback ID from Livepeer assets or streams, or dStorage identifiers
for assets
| +| `creatorId` | *Optional\* | :heavy_minus_sign: | The creator ID to filter the query results | +| `breakdownBy` | List\<[BreakdownBy](../../models/operations/BreakdownBy.md)> | :heavy_minus_sign: | The list of fields to break down the query results. Specify this
query-string multiple times to break down by multiple fields.
| ### Response @@ -74,10 +60,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## getViewership @@ -86,41 +71,28 @@ Requires a private (non-CORS) API key to be used. ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; -import studio.livepeer.livepeer.models.operations.GetViewershipMetricsRequest; import studio.livepeer.livepeer.models.operations.GetViewershipMetricsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetViewershipMetricsRequest req = GetViewershipMetricsRequest.builder() - .build(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - GetViewershipMetricsResponse res = sdk.metrics().getViewership() - .request(req) + GetViewershipMetricsResponse res = sdk.metrics().getViewership() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -137,10 +109,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## getCreatorViewership @@ -149,41 +120,28 @@ Requires a proof of ownership to be sent in the request, which for now is just t ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; -import studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsRequest; import studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetCreatorViewershipMetricsRequest req = GetCreatorViewershipMetricsRequest.builder() - .build(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - GetCreatorViewershipMetricsResponse res = sdk.metrics().getCreatorViewership() - .request(req) + GetCreatorViewershipMetricsResponse res = sdk.metrics().getCreatorViewership() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -200,10 +158,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## getPublicViewership @@ -214,37 +171,29 @@ unauthenticated. ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetPublicViewershipMetricsResponse res = sdk.metrics().getPublicViewership() - .playbackId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetPublicViewershipMetricsResponse res = sdk.metrics().getPublicViewership() + .playbackId("") .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -261,10 +210,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## getUsage @@ -272,41 +220,28 @@ Query usage metrics ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; -import studio.livepeer.livepeer.models.operations.GetUsageMetricsRequest; import studio.livepeer.livepeer.models.operations.GetUsageMetricsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetUsageMetricsRequest req = GetUsageMetricsRequest.builder() - .build(); + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); - GetUsageMetricsResponse res = sdk.metrics().getUsage() - .request(req) + GetUsageMetricsResponse res = sdk.metrics().getUsage() .call(); - if (res.usageMetric().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.usageMetric().isPresent()) { + // handle response } - } } ``` @@ -323,6 +258,6 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/multistream/README.md b/docs/sdks/multistream/README.md index 08093e2c..0c7466c9 100644 --- a/docs/sdks/multistream/README.md +++ b/docs/sdks/multistream/README.md @@ -19,36 +19,28 @@ Retrieve Multistream Targets ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetMultistreamTargetsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetMultistreamTargetsResponse res = sdk.multistream().getAll() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetMultistreamTargetsResponse res = sdk.multistream().getAll() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -59,10 +51,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## create @@ -70,42 +61,34 @@ Create a multistream target ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; import studio.livepeer.livepeer.models.components.MultistreamTargetInput; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.CreateMultistreamTargetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - MultistreamTargetInput req = MultistreamTargetInput.builder() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + MultistreamTargetInput req = MultistreamTargetInput.builder() .url("rtmps://live.my-service.tv/channel/secretKey") .build(); - CreateMultistreamTargetResponse res = sdk.multistream().create() + CreateMultistreamTargetResponse res = sdk.multistream().create() .request(req) .call(); - if (res.multistreamTarget().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.multistreamTarget().isPresent()) { + // handle response } - } } ``` @@ -122,10 +105,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## get @@ -133,37 +115,29 @@ Retrieve a multistream target ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetMultistreamTargetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetMultistreamTargetResponse res = sdk.multistream().get() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetMultistreamTargetResponse res = sdk.multistream().get() + .id("") .call(); - if (res.multistreamTarget().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.multistreamTarget().isPresent()) { + // handle response } - } } ``` @@ -180,10 +154,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## update @@ -191,49 +164,43 @@ Update Multistream Target ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.components.MultistreamTargetPatchPayload; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.components.MultistreamTargetInput; import studio.livepeer.livepeer.models.operations.UpdateMultistreamTargetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - UpdateMultistreamTargetResponse res = sdk.multistream().update() - .id("") - .multistreamTargetPatchPayload(MultistreamTargetPatchPayload.builder() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + UpdateMultistreamTargetResponse res = sdk.multistream().update() + .id("") + .multistreamTarget(MultistreamTargetInput.builder() .url("rtmps://live.my-service.tv/channel/secretKey") .build()) .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| `id` | *String* | :heavy_check_mark: | ID of the multistream target | -| `multistreamTargetPatchPayload` | [MultistreamTargetPatchPayload](../../models/components/MultistreamTargetPatchPayload.md) | :heavy_check_mark: | N/A | +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| `id` | *String* | :heavy_check_mark: | ID of the multistream target | +| `multistreamTarget` | [MultistreamTargetInput](../../models/components/MultistreamTargetInput.md) | :heavy_check_mark: | N/A | ### Response @@ -241,10 +208,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## delete @@ -254,35 +220,29 @@ streams before actually deleting it from the API. ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.DeleteMultistreamTargetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - DeleteMultistreamTargetResponse res = sdk.multistream().delete() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + DeleteMultistreamTargetResponse res = sdk.multistream().delete() + .id("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -299,6 +259,6 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/playback/README.md b/docs/sdks/playback/README.md index f2477d38..e572cffb 100644 --- a/docs/sdks/playback/README.md +++ b/docs/sdks/playback/README.md @@ -15,40 +15,30 @@ Retrieve Playback Info ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.models.operations.GetPlaybackInfoResponse; public class Application { - public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); + public static void main(String[] args) throws Error, Exception { - GetPlaybackInfoResponse res = sdk.playback().get() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetPlaybackInfoResponse res = sdk.playback().get() + .id("") .call(); - if (res.playbackInfo().isPresent()) { - // handle response - } - } catch (studio.livepeer.livepeer.models.errors.Error e) { - // handle exception - throw e; - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.playbackInfo().isPresent()) { + // handle response } - } } ``` @@ -65,7 +55,7 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/Error | 404 | application/json | -| models/errors/SDKError | 4xx-5xx | \*\/* | +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/Error | 404 | application/json | +| models/errors/SDKException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/room/README.md b/docs/sdks/room/README.md index 1580b9e1..055c9bc7 100644 --- a/docs/sdks/room/README.md +++ b/docs/sdks/room/README.md @@ -26,36 +26,28 @@ Create a multiparticipant livestreaming room. ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.CreateRoomResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - CreateRoomResponse res = sdk.room().create() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + CreateRoomResponse res = sdk.room().create() .call(); - if (res.createRoomResponse().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.createRoomResponse().isPresent()) { + // handle response } - } } ``` @@ -66,10 +58,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## ~~get~~ @@ -79,37 +70,29 @@ Retrieve a room ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetRoomResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetRoomResponse res = sdk.room().get() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetRoomResponse res = sdk.room().get() + .id("") .call(); - if (res.room().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.room().isPresent()) { + // handle response } - } } ``` @@ -126,10 +109,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## ~~delete~~ @@ -139,35 +121,29 @@ Delete a room ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.DeleteRoomResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - DeleteRoomResponse res = sdk.room().delete() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + DeleteRoomResponse res = sdk.room().delete() + .id("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -184,10 +160,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## ~~startEgress~~ @@ -199,39 +174,33 @@ This allows you to leverage livestreaming features like recording and HLS output ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; import studio.livepeer.livepeer.models.components.RoomEgressPayload; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.StartRoomEgressResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - StartRoomEgressResponse res = sdk.room().startEgress() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + StartRoomEgressResponse res = sdk.room().startEgress() + .id("") .roomEgressPayload(RoomEgressPayload.builder() .streamId("aac12556-4d65-4d34-9fb6-d1f0985eb0a9") .build()) .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -249,10 +218,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## ~~stopEgress~~ @@ -262,35 +230,29 @@ Stop room RTMP egress ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.StopRoomEgressResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - StopRoomEgressResponse res = sdk.room().stopEgress() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + StopRoomEgressResponse res = sdk.room().stopEgress() + .id("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -307,10 +269,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## ~~createUser~~ @@ -323,25 +284,25 @@ Alternatively the joining token can be used with a custom app. ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; import studio.livepeer.livepeer.models.components.RoomUserPayload; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.CreateRoomUserResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - CreateRoomUserResponse res = sdk.room().createUser() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + CreateRoomUserResponse res = sdk.room().createUser() + .id("") .roomUserPayload(RoomUserPayload.builder() .name("name") .canPublish(true) @@ -349,17 +310,9 @@ public class Application { .build()) .call(); - if (res.roomUserResponse().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.roomUserResponse().isPresent()) { + // handle response } - } } ``` @@ -377,10 +330,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## ~~getUser~~ @@ -390,38 +342,30 @@ Get user details ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetRoomUserResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - GetRoomUserResponse res = sdk.room().getUser() - .id("") - .userId("") + + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetRoomUserResponse res = sdk.room().getUser() + .id("") + .userId("") .call(); - if (res.getRoomUserResponse().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.getRoomUserResponse().isPresent()) { + // handle response } - } } ``` @@ -439,10 +383,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## ~~updateUser~~ @@ -452,41 +395,33 @@ Update properties for a user. ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; import studio.livepeer.livepeer.models.components.RoomUserUpdatePayload; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.UpdateRoomUserResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - UpdateRoomUserResponse res = sdk.room().updateUser() - .id("") - .userId("") + + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + UpdateRoomUserResponse res = sdk.room().updateUser() + .id("") + .userId("") .roomUserUpdatePayload(RoomUserUpdatePayload.builder() - .canPublish(true) - .canPublishData(true) .build()) .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -505,10 +440,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## ~~deleteUser~~ @@ -518,36 +452,30 @@ Remove a user from the room ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.DeleteRoomUserResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - - DeleteRoomUserResponse res = sdk.room().deleteUser() - .id("") - .userId("") + + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + DeleteRoomUserResponse res = sdk.room().deleteUser() + .id("") + .userId("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -565,6 +493,6 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/session/README.md b/docs/sdks/session/README.md index b08c6181..77f7139c 100644 --- a/docs/sdks/session/README.md +++ b/docs/sdks/session/README.md @@ -18,37 +18,29 @@ Retrieve clips of a session ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetSessionClipsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetSessionClipsResponse res = sdk.session().getClips() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetSessionClipsResponse res = sdk.session().getClips() + .id("") .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -65,10 +57,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## getAll @@ -76,36 +67,28 @@ Retrieve sessions ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetSessionsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetSessionsResponse res = sdk.session().getAll() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetSessionsResponse res = sdk.session().getAll() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -116,10 +99,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## get @@ -127,37 +109,29 @@ Retrieve a session ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetSessionResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetSessionResponse res = sdk.session().get() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetSessionResponse res = sdk.session().get() + .id("") .call(); - if (res.session().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.session().isPresent()) { + // handle response } - } } ``` @@ -174,10 +148,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## getRecorded @@ -185,39 +158,31 @@ Retrieve Recorded Sessions ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetRecordedSessionsResponse; import studio.livepeer.livepeer.models.operations.Record; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetRecordedSessionsResponse res = sdk.session().getRecorded() - .parentId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetRecordedSessionsResponse res = sdk.session().getRecorded() + .parentId("") .record(Record.of(true)) .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -227,7 +192,7 @@ public class Application { | Parameter | Type | Required | Description | Example | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | | `parentId` | *String* | :heavy_check_mark: | ID of the parent stream | | -| `record` | [Optional](../../models/operations/Record.md) | :heavy_minus_sign: | Flag indicating if the response should only include recorded
sessions
| true | +| `record` | [Optional\](../../models/operations/Record.md) | :heavy_minus_sign: | Flag indicating if the response should only include recorded
sessions
| true | ### Response @@ -235,6 +200,6 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/stream/README.md b/docs/sdks/stream/README.md index bf313be9..0d3907d7 100644 --- a/docs/sdks/stream/README.md +++ b/docs/sdks/stream/README.md @@ -38,6 +38,7 @@ also be added upon the creation of a new stream by adding ### Example Usage + ```java package hello.world; @@ -45,40 +46,26 @@ import java.lang.Exception; import java.util.List; import java.util.Map; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.components.FfmpegProfile; -import studio.livepeer.livepeer.models.components.Location; -import studio.livepeer.livepeer.models.components.Multistream; -import studio.livepeer.livepeer.models.components.NewStreamPayload; -import studio.livepeer.livepeer.models.components.NewStreamPayloadRecordingSpec; -import studio.livepeer.livepeer.models.components.PlaybackPolicy; -import studio.livepeer.livepeer.models.components.Profile; -import studio.livepeer.livepeer.models.components.Pull; -import studio.livepeer.livepeer.models.components.Target; -import studio.livepeer.livepeer.models.components.TargetSpec; -import studio.livepeer.livepeer.models.components.TranscodeProfile; -import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; -import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; -import studio.livepeer.livepeer.models.components.Type; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.components.*; import studio.livepeer.livepeer.models.operations.CreateStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - NewStreamPayload req = NewStreamPayload.builder() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + NewStreamPayload req = NewStreamPayload.builder() .name("test_stream") .pull(Pull.builder() .source("https://myservice.com/live/stream.flv") .headers(Map.ofEntries( Map.entry("Authorization", "Bearer 123"))) .location(Location.builder() - .lat(39.739d) - .lon(-104.988d) + .lat(39.739) + .lon(-104.988) .build()) .build()) .playbackPolicy(PlaybackPolicy.builder() @@ -119,32 +106,19 @@ public class Application { .multistream(Multistream.builder() .targets(List.of( Target.builder() - .profile("720p0") - .videoOnly(false) + .profile("720p") .id("PUSH123") - .spec(TargetSpec.builder() - .url("rtmps://live.my-service.tv/channel/secretKey") - .name("My target") - .build()) .build())) .build()) .build(); - CreateStreamResponse res = sdk.stream().create() + CreateStreamResponse res = sdk.stream().create() .request(req) .call(); - if (res.stream().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.stream().isPresent()) { + // handle response } - } } ``` @@ -161,10 +135,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## getAll @@ -172,46 +145,37 @@ Retrieve streams ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetStreamsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetStreamsResponse res = sdk.stream().getAll() - .streamsonly("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetStreamsResponse res = sdk.stream().getAll() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` ### Parameters -| Parameter | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `streamsonly` | *Optional* | :heavy_minus_sign: | N/A | +| Parameter | Type | Required | Description | +| ------------------- | ------------------- | ------------------- | ------------------- | +| `streamsonly` | *Optional\* | :heavy_minus_sign: | N/A | ### Response @@ -219,10 +183,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## get @@ -230,37 +193,29 @@ Retrieve a stream ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetStreamResponse res = sdk.stream().get() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetStreamResponse res = sdk.stream().get() + .id("") .call(); - if (res.stream().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.stream().isPresent()) { + // handle response } - } } ``` @@ -277,10 +232,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## update @@ -288,50 +242,35 @@ Update a stream ### Example Usage + ```java package hello.world; import java.lang.Exception; import java.util.List; import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.components.FfmpegProfile; -import studio.livepeer.livepeer.models.components.Multistream; -import studio.livepeer.livepeer.models.components.PlaybackPolicy; -import studio.livepeer.livepeer.models.components.Profile; -import studio.livepeer.livepeer.models.components.RecordingSpec; -import studio.livepeer.livepeer.models.components.StreamPatchPayload; -import studio.livepeer.livepeer.models.components.Target; -import studio.livepeer.livepeer.models.components.TargetSpec; -import studio.livepeer.livepeer.models.components.TranscodeProfile; -import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; -import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; -import studio.livepeer.livepeer.models.components.Type; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.components.*; import studio.livepeer.livepeer.models.operations.UpdateStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - UpdateStreamResponse res = sdk.stream().update() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + UpdateStreamResponse res = sdk.stream().update() + .id("") .streamPatchPayload(StreamPatchPayload.builder() .record(false) .multistream(Multistream.builder() .targets(List.of( Target.builder() - .profile("720p0") - .videoOnly(false) + .profile("720p") .id("PUSH123") - .spec(TargetSpec.builder() - .url("rtmps://live.my-service.tv/channel/secretKey") - .name("My target") - .build()) .build())) .build()) .playbackPolicy(PlaybackPolicy.builder() @@ -341,18 +280,7 @@ public class Application { Map.entry("streamerId", "my-custom-id"))) .refreshInterval(600d) .build()) - .profiles(List.of( - FfmpegProfile.builder() - .width(1280L) - .name("720p") - .height(720L) - .bitrate(3000000L) - .fps(30L) - .fpsDen(1L) - .quality(23L) - .gop("2") - .profile(Profile.H264_BASELINE) - .build())) + .profiles(JsonNullable.of(null)) .recordingSpec(RecordingSpec.builder() .profiles(List.of( TranscodeProfile.builder() @@ -368,18 +296,13 @@ public class Application { .encoder(TranscodeProfileEncoder.H264) .build())) .build()) + .name("test_stream") .build()) .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -397,10 +320,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## delete @@ -412,35 +334,29 @@ using the PATCH stream API. ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.DeleteStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - DeleteStreamResponse res = sdk.stream().delete() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + DeleteStreamResponse res = sdk.stream().delete() + .id("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -457,10 +373,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## terminate @@ -476,35 +391,29 @@ terminated. ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.TerminateStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - TerminateStreamResponse res = sdk.stream().terminate() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + TerminateStreamResponse res = sdk.stream().terminate() + .id("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -521,10 +430,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## startPull @@ -539,35 +447,29 @@ started. ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.StartPullStreamResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - StartPullStreamResponse res = sdk.stream().startPull() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + StartPullStreamResponse res = sdk.stream().startPull() + .id("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -584,10 +486,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## createClip @@ -595,24 +496,24 @@ Create a clip ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; import studio.livepeer.livepeer.models.components.ClipPayload; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.CreateClipResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - ClipPayload req = ClipPayload.builder() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + ClipPayload req = ClipPayload.builder() .playbackId("eaw4nk06ts2d0mzb") .startTime(1587667174725d) .endTime(1587667174725d) @@ -620,21 +521,13 @@ public class Application { .sessionId("de7818e7-610a-4057-8f6f-b785dc1e6f88") .build(); - CreateClipResponse res = sdk.stream().createClip() + CreateClipResponse res = sdk.stream().createClip() .request(req) .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -651,10 +544,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## getClips @@ -662,37 +554,29 @@ Retrieve clips of a livestream ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetClipsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetClipsResponse res = sdk.stream().getClips() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetClipsResponse res = sdk.stream().getClips() + .id("") .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -709,10 +593,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## addMultistreamTarget @@ -720,6 +603,7 @@ Add a multistream target ### Example Usage + ```java package hello.world; @@ -727,22 +611,20 @@ import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; import studio.livepeer.livepeer.models.components.TargetAddPayload; import studio.livepeer.livepeer.models.components.TargetAddPayloadSpec; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.AddMultistreamTargetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - AddMultistreamTargetResponse res = sdk.stream().addMultistreamTarget() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + AddMultistreamTargetResponse res = sdk.stream().addMultistreamTarget() + .id("") .targetAddPayload(TargetAddPayload.builder() .profile("720p0") - .videoOnly(false) .id("PUSH123") .spec(TargetAddPayloadSpec.builder() .url("rtmps://live.my-service.tv/channel/secretKey") @@ -751,15 +633,9 @@ public class Application { .build()) .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -777,10 +653,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## removeMultistreamTarget @@ -788,36 +663,30 @@ Remove a multistream target ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.RemoveMultistreamTargetResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - RemoveMultistreamTargetResponse res = sdk.stream().removeMultistreamTarget() - .id("") - .targetId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + RemoveMultistreamTargetResponse res = sdk.stream().removeMultistreamTarget() + .id("") + .targetId("") .call(); + if (res.error().isPresent()) { // handle response - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; } - } } ``` @@ -835,6 +704,6 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/task/README.md b/docs/sdks/task/README.md index 7264fbca..028bfd4d 100644 --- a/docs/sdks/task/README.md +++ b/docs/sdks/task/README.md @@ -16,36 +16,28 @@ Retrieve Tasks ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetTasksResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetTasksResponse res = sdk.task().getAll() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetTasksResponse res = sdk.task().getAll() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -56,10 +48,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## get @@ -67,37 +58,29 @@ Retrieve a Task ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetTaskResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetTaskResponse res = sdk.task().get() - .taskId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetTaskResponse res = sdk.task().get() + .taskId("") .call(); - if (res.task().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.task().isPresent()) { + // handle response } - } } ``` @@ -114,6 +97,6 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/transcode/README.md b/docs/sdks/transcode/README.md index fc6c5e1d..6a5d51a7 100644 --- a/docs/sdks/transcode/README.md +++ b/docs/sdks/transcode/README.md @@ -136,61 +136,55 @@ This endpoint currently supports the following output types: ### Example Usage + ```java package hello.world; import java.lang.Exception; import java.util.List; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.components.Fmp4; -import studio.livepeer.livepeer.models.components.Hls; -import studio.livepeer.livepeer.models.components.Input1; -import studio.livepeer.livepeer.models.components.Input; -import studio.livepeer.livepeer.models.components.Mp4; -import studio.livepeer.livepeer.models.components.Outputs; -import studio.livepeer.livepeer.models.components.Storage1; -import studio.livepeer.livepeer.models.components.StorageCredentials; -import studio.livepeer.livepeer.models.components.StorageType; -import studio.livepeer.livepeer.models.components.TranscodePayload; -import studio.livepeer.livepeer.models.components.TranscodePayloadStorage; -import studio.livepeer.livepeer.models.components.TranscodeProfile; -import studio.livepeer.livepeer.models.components.TranscodeProfileEncoder; -import studio.livepeer.livepeer.models.components.TranscodeProfileProfile; -import studio.livepeer.livepeer.models.errors.SDKError; +import studio.livepeer.livepeer.models.components.*; import studio.livepeer.livepeer.models.operations.TranscodeVideoResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - TranscodePayload req = TranscodePayload.builder() - .input(Input.of(Input1.builder() - .url("https://s3.amazonaws.com/bucket/file.mp4") - .build())) + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + TranscodePayload req = TranscodePayload.builder() + .input(Input.of(Input2.builder() + .type(InputType.S3) + .endpoint("https://gateway.storjshare.io") + .bucket("inputbucket") + .path("/path/file.mp4") + .credentials(Credentials.builder() + .accessKeyId("AKIAIOSFODNN7EXAMPLE") + .secretAccessKey("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY") + .build()) + .build())) .storage(TranscodePayloadStorage.of(Storage1.builder() - .type(StorageType.S3) - .endpoint("https://gateway.storjshare.io") - .bucket("outputbucket") - .credentials(StorageCredentials.builder() - .accessKeyId("AKIAIOSFODNN7EXAMPLE") - .secretAccessKey("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY") - .build()) - .build())) + .type(StorageType.S3) + .endpoint("https://gateway.storjshare.io") + .bucket("outputbucket") + .credentials(StorageCredentials.builder() + .accessKeyId("AKIAIOSFODNN7EXAMPLE") + .secretAccessKey("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY") + .build()) + .build())) .outputs(Outputs.builder() - .hls(Hls.builder() - .path("/samplevideo/hls") - .build()) - .mp4(Mp4.builder() - .path("/samplevideo/mp4") - .build()) - .fmp4(Fmp4.builder() - .path("/samplevideo/fmp4") - .build()) + .hls(Hls.builder() + .path("/samplevideo/hls") .build()) + .mp4(Mp4.builder() + .path("/samplevideo/mp4") + .build()) + .fmp4(Fmp4.builder() + .path("/samplevideo/fmp4") + .build()) + .build()) .profiles(List.of( TranscodeProfile.builder() .bitrate(3000000L) @@ -206,21 +200,13 @@ public class Application { .build())) .build(); - TranscodeVideoResponse res = sdk.transcode().create() + TranscodeVideoResponse res = sdk.transcode().create() .request(req) .call(); - if (res.task().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.task().isPresent()) { + // handle response } - } } ``` @@ -237,6 +223,6 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/webhook/README.md b/docs/sdks/webhook/README.md index f48748e1..44f556af 100644 --- a/docs/sdks/webhook/README.md +++ b/docs/sdks/webhook/README.md @@ -22,36 +22,28 @@ Retrieve a Webhook ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetWebhooksResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetWebhooksResponse res = sdk.webhook().getAll() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetWebhooksResponse res = sdk.webhook().getAll() .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -62,10 +54,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## create @@ -74,6 +65,7 @@ To create a new webhook, you need to make an API call with the events you want t ### Example Usage + ```java package hello.world; @@ -82,18 +74,17 @@ import java.util.List; import studio.livepeer.livepeer.Livepeer; import studio.livepeer.livepeer.models.components.Events; import studio.livepeer.livepeer.models.components.WebhookInput; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.CreateWebhookResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - WebhookInput req = WebhookInput.builder() + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + WebhookInput req = WebhookInput.builder() .name("test_webhook") .url("https://my-service.com/webhook") .projectId("aac12556-4d65-4d34-9fb6-d1f0985eb0a9") @@ -104,21 +95,13 @@ public class Application { .streamId("de7818e7-610a-4057-8f6f-b785dc1e6f88") .build(); - CreateWebhookResponse res = sdk.webhook().create() + CreateWebhookResponse res = sdk.webhook().create() .request(req) .call(); - if (res.webhook().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.webhook().isPresent()) { + // handle response } - } } ``` @@ -135,10 +118,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## get @@ -146,37 +128,29 @@ Retrieve a webhook ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetWebhookResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetWebhookResponse res = sdk.webhook().get() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetWebhookResponse res = sdk.webhook().get() + .id("") .call(); - if (res.webhook().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.webhook().isPresent()) { + // handle response } - } } ``` @@ -193,10 +167,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## update @@ -204,6 +177,7 @@ Update a webhook ### Example Usage + ```java package hello.world; @@ -212,19 +186,18 @@ import java.util.List; import studio.livepeer.livepeer.Livepeer; import studio.livepeer.livepeer.models.components.Events; import studio.livepeer.livepeer.models.components.WebhookInput; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.UpdateWebhookResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - UpdateWebhookResponse res = sdk.webhook().update() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + UpdateWebhookResponse res = sdk.webhook().update() + .id("") .webhook(WebhookInput.builder() .name("test_webhook") .url("https://my-service.com/webhook") @@ -237,17 +210,9 @@ public class Application { .build()) .call(); - if (res.webhook().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.webhook().isPresent()) { + // handle response } - } } ``` @@ -265,10 +230,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## delete @@ -276,37 +240,29 @@ Delete a webhook ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.DeleteWebhookResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - DeleteWebhookResponse res = sdk.webhook().delete() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + DeleteWebhookResponse res = sdk.webhook().delete() + .id("") .call(); - if (res.webhook().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.webhook().isPresent()) { + // handle response } - } } ``` @@ -323,10 +279,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## getLogs @@ -334,37 +289,29 @@ Retrieve webhook logs ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetWebhookLogsResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetWebhookLogsResponse res = sdk.webhook().getLogs() - .id("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetWebhookLogsResponse res = sdk.webhook().getLogs() + .id("") .call(); - if (res.data().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.data().isPresent()) { + // handle response } - } } ``` @@ -381,10 +328,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## getLog @@ -392,38 +338,30 @@ Retrieve a webhook log ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetWebhookLogResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - GetWebhookLogResponse res = sdk.webhook().getLog() - .id("") - .logId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + GetWebhookLogResponse res = sdk.webhook().getLog() + .id("") + .logId("") .call(); - if (res.webhookLog().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.webhookLog().isPresent()) { + // handle response } - } } ``` @@ -441,10 +379,9 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | - +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | ## resendLog @@ -455,38 +392,30 @@ to check or fix the behaviour in your handler. ### Example Usage + ```java package hello.world; import java.lang.Exception; import studio.livepeer.livepeer.Livepeer; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.ResendWebhookResponse; public class Application { public static void main(String[] args) throws Exception { - try { - Livepeer sdk = Livepeer.builder() - .apiKey("") - .build(); - ResendWebhookResponse res = sdk.webhook().resendLog() - .id("") - .logId("") + Livepeer sdk = Livepeer.builder() + .apiKey(System.getenv().getOrDefault("API_KEY", "")) + .build(); + + ResendWebhookResponse res = sdk.webhook().resendLog() + .id("") + .logId("") .call(); - if (res.webhookLog().isPresent()) { - // handle response - } - } catch (SDKError e) { - // handle exception - throw e; - } catch (Exception e) { - // handle exception - throw e; + if (res.webhookLog().isPresent()) { + // handle response } - } } ``` @@ -504,6 +433,6 @@ public class Application { ### Errors -| Error Object | Status Code | Content Type | -| ---------------------- | ---------------------- | ---------------------- | -| models/errors/SDKError | 4xx-5xx | \*\/* | +| Error Type | Status Code | Content Type | +| -------------------------- | -------------------------- | -------------------------- | +| models/errors/SDKException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/utils/Blob.md b/docs/utils/Blob.md new file mode 100644 index 00000000..66fba1cd --- /dev/null +++ b/docs/utils/Blob.md @@ -0,0 +1,195 @@ +# Blob Utility Class + +The [`Blob`](../../src/main/java/studio/livepeer/livepeer/utils/Blob.java) utility class is a powerful tool for both sending and reading data in the SDK. It implements `HttpRequest.BodyPublisher` for sending data in HTTP requests and provides consumption methods for reading data streams. The class offers a reactive, memory-efficient approach to working with various data sources. + +## Key Benefits + +- **Dual Purpose**: Supports both sending data (via `HttpRequest.BodyPublisher`) and reading data (via consumption methods) +- **Memory Efficiency**: Streams data instead of loading entire files into memory, preventing out-of-memory errors with large files +- **Reactive Processing**: Built on Java's reactive streams (`Flow.Publisher`) for streaming+NIO operations +- **Versatile Input Sources**: Supports multiple data sources with convenient factory methods +- **HTTP Native**: Implements `HttpRequest.BodyPublisher` for seamless integration with HTTP requests +- **Single-Use Safety**: Prevents accidental reuse of consumed instances with clear error handling + +## Factory Methods + +The [`Blob`](../../src/main/java/studio/livepeer/livepeer/utils/Blob.java) class provides factory methods for various input sources: + +| Factory Method | Use Case | Memory | Underlying I/O | +|---|---|---|---| +| `Blob.from(Path)` | Large files, documents | 🟢 Streaming | Non-blocking (NIO) | +| `Blob.from(InputStream)` | Network streams, legacy APIs | 🟢 Streaming | Blocking (offloaded to threads) | +| `Blob.from(String)` | Text data, JSON | 🟡 In-memory | N/A (in-memory) | +| `Blob.from(byte[])` | Binary data, images | 🟡 In-memory | N/A (in-memory) | +| `Blob.from(ByteBuffer)` | NIO buffers | 🟡 In-memory | N/A (in-memory) | +| `Blob.from(List)` | Chunked data | 🟡 In-memory | N/A (in-memory) | +| `Blob.from(Flow.Publisher>)` | Reactive streams | 🟢 Streaming | Non-blocking (NIO) | + +## Retry Compatibility + +When using blobs in HTTP requests that may be retried, it's important to understand which blob types support retries effectively: + +| Factory Method | Retry Support | Notes | +|---|---|---| +| `Blob.from(Path)` | ✅ **Full Support** | File can be re-read for each retry attempt | +| `Blob.from(String)` | ✅ **Full Support** | Immutable data can be resent | +| `Blob.from(byte[])` | ✅ **Full Support** | In-memory data can be resent | +| `Blob.from(ByteBuffer)` | ✅ **Full Support** | Uses `duplicate()` to preserve original | +| `Blob.from(List)` | ✅ **Full Support** | Uses `duplicate()` to preserve originals | +| `Blob.from(Flow.Publisher>)` | ⚠️ **Depends on Publisher** | Stateful publishers may lose data on re-subscription | +| `Blob.from(InputStream)` | ❌ **Limited Support** | Stream gets consumed on first attempt | + +**Important**: InputStream-backed blobs and some Flow.Publisher-backed blobs do not support retries effectively. InputStreams get consumed during the first HTTP request attempt, and stateful publishers may lose data on re-subscription, causing subsequent retry attempts to send empty or incomplete request bodies. For retry-compatible scenarios, prefer file-based (`Blob.from(Path)`) or in-memory alternatives (`Blob.from(byte[])`). + +### File-Based Sources + +#### `Blob.from(Path path)` +Creates a Blob from a file path. **Recommended for large files** as it uses streaming+NIO. + +```java +Blob fileBlob = Blob.from(Paths.get("large-document.pdf")); +``` + +#### `Blob.from(InputStream inputStream)` +Creates a Blob from an InputStream that streams without buffering the whole payload; reading is blocking (performed on background threads if used asynchronously). + +```java +FileInputStream fis = new FileInputStream("data.json"); +Blob streamBlob = Blob.from(fis); +``` + +### In-Memory Sources + +#### `Blob.from(String string)` +Creates a Blob from a String using UTF-8 encoding. + +```java +Blob textBlob = Blob.from("Hello, World!"); +``` + +#### `Blob.from(byte[] data)` +Creates a Blob from a byte array. + +```java +byte[] imageData = loadImageBytes(); +Blob imageBlob = Blob.from(imageData); +``` + +### Buffer-Based Sources + +#### `Blob.from(ByteBuffer buffer)` +Creates a Blob from a single ByteBuffer. + +```java +ByteBuffer buffer = ByteBuffer.allocate(1024); +// ... populate buffer +Blob bufferBlob = Blob.from(buffer); +``` + +#### `Blob.from(List buffers)` +Creates a Blob from multiple ByteBuffers. + +```java +List buffers = Arrays.asList(buffer1, buffer2, buffer3); +Blob multiBufferBlob = Blob.from(buffers); +``` + +### Reactive Sources + +#### `Blob.from(Flow.Publisher> sourcePublisher)` +Creates a Blob from a reactive publisher that provides data as lists of ByteBuffers. + +```java +Flow.Publisher> publisher = createReactiveSource(); +Blob reactiveBlob = Blob.from(publisher); +``` + +## Consumption Methods + +The [`Blob`](../../src/main/java/studio/livepeer/livepeer/utils/Blob.java) class provides four methods for reading/consuming the data. All consumption methods use NIO and are safe to use in asynchronous contexts: + +### `asPublisher()` +Returns a `Flow.Publisher` for reactive processing. + +```java +Blob blob = Blob.from(Paths.get("data.txt")); +Flow.Publisher publisher = blob.asPublisher(); + +// Use with your preferred reactive library or custom subscriber +publisher.subscribe(myCustomSubscriber); +``` + +**Illustrative Project Reactor Integration** *(Note: The SDK uses native Java reactive streams and doesn't depend on Project Reactor)*: + +```java +// Convert to Reactor Flux for advanced reactive operations +Flux flux = Flux.from(blob.asPublisher()); + +// Transform and process the stream +Flux textChunks = flux + .map(buffer -> StandardCharsets.UTF_8.decode(buffer).toString()) + .filter(text -> !text.trim().isEmpty()) + .doOnNext(chunk -> System.out.println("Processing: " + chunk)); +``` + +### `toByteArray()` +Collects the entire stream into a byte array asynchronously. + +```java +Blob blob = Blob.from(Paths.get("small-file.txt")); +CompletableFuture future = blob.toByteArray(); + +// Basic usage with CompletableFuture +future.thenAccept(data -> { + System.out.println("Received " + data.length + " bytes"); + // Process the complete data + processData(data); +}).exceptionally(throwable -> { + System.err.println("Failed to read data: " + throwable.getMessage()); + return null; +}); +``` + +### `toInputStream()` +Converts the entire stream into an `InputStream` for traditional I/O operations. + +```java +Blob blob = Blob.from(Paths.get("data.txt")); +CompletableFuture future = blob.toInputStream(); + +// Basic usage with CompletableFuture +future.thenAccept(inputStream -> { + try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { + String line; + while ((line = reader.readLine()) != null) { + System.out.println("Read line: " + line); + } + } catch (IOException e) { + System.err.println("Error reading from InputStream: " + e.getMessage()); + } +}).exceptionally(throwable -> { + System.err.println("Failed to create InputStream: " + throwable.getMessage()); + return null; +}); +``` + +### `toFile(Path destinationPath)` +Writes the stream directly to a file asynchronously. + +```java +Blob blob = Blob.from(inputStream); +CompletableFuture future = blob.toFile(Paths.get("output.dat")); + +// Basic file writing with error handling +future.thenAccept(path -> { + System.out.println("Successfully written to: " + path); + // Verify file was created + if (Files.exists(path)) { + System.out.println("File size: " + Files.size(path) + " bytes"); + } +}).exceptionally(throwable -> { + System.err.println("Failed to write file: " + throwable.getMessage()); + return null; +}); + +``` diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..3a1d8042 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,4 @@ +groupId=studio.livepeer +artifactId=livepeer +version=0.6.0 +org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d64cd491..1b33c55b 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e093..ff23a68d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a42..23d15a93 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -112,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -203,7 +205,7 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. @@ -211,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 6689b85b..5eed7ee8 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,22 +59,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/publishing.gradle b/publishing.gradle new file mode 100644 index 00000000..e50630a2 --- /dev/null +++ b/publishing.gradle @@ -0,0 +1,91 @@ +afterEvaluate { + if (!project.ext.has('publishingConfig') + || !project.ext.publishingConfig instanceof Map) { + return + } + + def config = project.ext.publishingConfig + publishing { + + publications { + create("maven", MavenPublication) { + from(components["java"] as SoftwareComponent) + + groupId = config.groupId + artifactId = config.artifactId + version = config.version + + pom { + properties = [ + 'maven.compiler.source': '11', + 'maven.compiler.target': '11', + ] + name = config.name + description = config.description + url = 'https://github.com/owner/repo' + scm { + url = 'github.com/owner/repo' + connection = 'scm:git:ssh://git@github.com/owner/repo.git' + } + licenses { + license { + name = 'The MIT License (MIT)' + url = 'https://mit-license.org/' + } + } + developers { + developer { + name = 'My Company' + organization = 'My Company' + email = 'info@mycompany.com' + } + } + organization { + name = 'My Company' + url = 'www.mycompany.com' + } + } + } + } + + if (!project.hasProperty('skip.signing')) { + signing { + def signingKey = findProperty("signingKey") + def signingPassphrase = findProperty("signingPassphrase") + useInMemoryPgpKeys(signingKey, signingPassphrase) + sign publishing.publications.getByName("maven") + } + } + } + + + + // Configure POM file generation task after publishing is configured + tasks.named("generatePomFileForMavenPublication") { + destination = file(layout.buildDirectory.file("pom.xml")) + jar.dependsOn('generatePomFileForMavenPublication') + } +} + +// Debug task to log publishing properties before publish tasks +tasks.register('logPublishingProperties') { + doLast { + if (project.ext.has('publishingConfig')) { + def config = project.ext.publishingConfig + logger.quiet("Publishing properties for project '${project.name}':") + logger.quiet(" groupId: ${config.groupId}") + logger.quiet(" artifactId: ${config.artifactId}") + logger.quiet(" version: ${config.version}") + logger.quiet(" name: ${config.name}") + logger.quiet(" description: ${config.description}") + logger.quiet(" publicationName: maven") + } + } +} + +// Make all publish tasks depend on the logging task and POM generation +tasks.matching { it.name.startsWith('publish') + || it.name.contains('sonatypeCentralUpload') }.configureEach { + dependsOn logPublishingProperties + dependsOn 'generatePomFileForMavenPublication' +} diff --git a/settings.gradle b/settings.gradle index 12ff7d38..9a417c6e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,3 +8,14 @@ */ rootProject.name = 'openapi' + +include 'openapi-spring-boot-autoconfigure' +include 'openapi-spring-boot-starter' + +project(':openapi-spring-boot-autoconfigure').projectDir = file('spring/openapi-spring-boot-autoconfigure') +project(':openapi-spring-boot-starter').projectDir = file('spring/openapi-spring-boot-starter') + +// Apply additional settings if the file exists +if (file('settings-extra.gradle').exists()) { + apply from: 'settings-extra.gradle' +} \ No newline at end of file diff --git a/spring/openapi-spring-boot-autoconfigure/build.gradle b/spring/openapi-spring-boot-autoconfigure/build.gradle new file mode 100644 index 00000000..32e01109 --- /dev/null +++ b/spring/openapi-spring-boot-autoconfigure/build.gradle @@ -0,0 +1,35 @@ +description = 'openapi Spring Boot Auto Configuration' + +// Publishing configuration overrides +ext { + publishingConfig = [ + groupId: rootProject.group, + artifactId: 'openapi-spring-boot-autoconfigure', + version: rootProject.version, + name: 'My Company Java SDK - Spring Boot Auto Configuration', + description: 'Spring Boot auto-configuration for the My Company Java SDK.', + ] +} + +dependencies { + api project(':') + implementation 'org.springframework.boot:spring-boot-autoconfigure' + annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' +} + +test { + useJUnitPlatform() +} + +jar { + dependsOn 'generatePomFileForMavenPublication' + archiveBaseName = 'openapi-spring-boot-autoconfigure' + into("META-INF/maven/studio.livepeer/openapi-spring-boot-autoconfigure") { + from(layout.buildDirectory.file("pom.xml")) { + // Only include if it exists to avoid build ordering issues + duplicatesStrategy = DuplicatesStrategy.INCLUDE + } + } +} \ No newline at end of file diff --git a/spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/ConditionalOnPropertyPrefix.java b/spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/ConditionalOnPropertyPrefix.java new file mode 100644 index 00000000..edc2e120 --- /dev/null +++ b/spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/ConditionalOnPropertyPrefix.java @@ -0,0 +1,41 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import org.springframework.context.annotation.Conditional; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Conditional annotation that matches when any properties exist under the specified prefix. + * This is useful for conditionally creating beans only when configuration properties + * are present under a specific prefix. + * + *

Example usage: + *

+ * @Bean
+ * @ConditionalOnPropertyPrefix(prefix = "myapp.security")
+ * public SecuritySource securitySource() {
+ *     // This bean will only be created if properties like myapp.security.* exist
+ * }
+ * 
+ */ +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Conditional(OnPropertyPrefixCondition.class) +public @interface ConditionalOnPropertyPrefix { + + /** + * The property prefix to check for. Properties starting with this prefix + * (followed by a dot) will be considered when determining if the condition matches. + * + * @return the property prefix + */ + String prefix(); +} \ No newline at end of file diff --git a/spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/OnPropertyPrefixCondition.java b/spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/OnPropertyPrefixCondition.java new file mode 100644 index 00000000..5241d2c1 --- /dev/null +++ b/spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/OnPropertyPrefixCondition.java @@ -0,0 +1,68 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import org.springframework.boot.autoconfigure.condition.ConditionMessage; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.context.properties.bind.Binder; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.core.type.AnnotatedTypeMetadata; +import org.springframework.core.env.Environment; + +import java.util.Map; + +/** + * Custom condition that checks if any properties exist under a given prefix. + * This is used to conditionally create beans only when configuration properties + * are present under a specific prefix. + */ +public class OnPropertyPrefixCondition extends SpringBootCondition { + + /** + * Default constructor for OnPropertyPrefixCondition. + */ + public OnPropertyPrefixCondition() { + // Default constructor + } + + @Override + public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) { + Map attributes = metadata.getAnnotationAttributes(ConditionalOnPropertyPrefix.class.getName()); + if (attributes == null) { + return ConditionOutcome.noMatch("@ConditionalOnPropertyPrefix annotation not found"); + } + + String prefix = (String) attributes.get("prefix"); + if (prefix == null || prefix.isEmpty()) { + return ConditionOutcome.noMatch("Property prefix is empty"); + } + + Environment environment = context.getEnvironment(); + + // Check if any properties exist under the given prefix + boolean hasPropertiesUnderPrefix = hasPropertiesWithPrefix(environment, prefix); + + ConditionMessage.Builder message = ConditionMessage.forCondition(ConditionalOnPropertyPrefix.class, prefix); + + if (hasPropertiesUnderPrefix) { + return ConditionOutcome.match(message.found("properties").items(prefix + ".*")); + } else { + return ConditionOutcome.noMatch(message.didNotFind("properties").items(prefix + ".*")); + } + } + + private boolean hasPropertiesWithPrefix(Environment environment, String prefix) { + try { + // Use Spring Boot's Binder to check if any properties exist under the prefix + Binder binder = Binder.get(environment); + + // Try to bind to a Map to see if any properties exist under the prefix + return binder.bind(prefix, Map.class).isBound(); + } catch (Exception e) { + // If we can't determine, assume no properties exist + return false; + } + } +} \ No newline at end of file diff --git a/spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/OpenapiAutoConfig.java b/spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/OpenapiAutoConfig.java new file mode 100644 index 00000000..824ffe1d --- /dev/null +++ b/spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/OpenapiAutoConfig.java @@ -0,0 +1,480 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import java.util.concurrent.TimeUnit; + +import java.lang.IllegalStateException; +import java.lang.String; +import java.lang.System; +import java.util.Optional; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.function.Consumer; +import studio.livepeer.livepeer.utils.BackoffStrategy; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.RetryConfig; +import studio.livepeer.livepeer.utils.SpeakeasyHTTPClient; + + +/** + * Spring Boot Auto Configuration for openapi SDK + * This configuration class automatically configures the openapi SDK + * when Spring Boot detects it on the classpath. + */ +@AutoConfiguration +@ConditionalOnClass(Livepeer.class) +@EnableConfigurationProperties(OpenapiAutoConfigProperties.class) +public class OpenapiAutoConfig { + + /** + * Constructor. + */ + public OpenapiAutoConfig() { + } + + /** + * Creates a RetryConfig bean from properties if retry is enabled. + * + * @param properties the configuration properties + * @return A configured RetryConfig instance + */ + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(prefix = "openapi.retry-config", name = "strategy") + public RetryConfig retryConfig(OpenapiAutoConfigProperties properties) { + OpenapiAutoConfigProperties.RetryConfig retryProps = properties.getRetryConfig(); + + if (RetryConfig.Strategy.BACKOFF.equals(retryProps.getStrategy())) { + OpenapiAutoConfigProperties.RetryConfig.Backoff backoff = retryProps.getBackoff(); + return RetryConfig.builder() + .backoff( + BackoffStrategy.builder() + .initialInterval(backoff.getInitialInterval().toMillis(), TimeUnit.MILLISECONDS) + .maxInterval(backoff.getMaxInterval().toMillis(), TimeUnit.MILLISECONDS) + .maxElapsedTime(backoff.getMaxElapsedTime().toMillis(), TimeUnit.MILLISECONDS) + .baseFactor(backoff.getBaseFactor()) + .jitterFactor(backoff.getJitterFactor()) + .retryConnectError(backoff.isRetryConnectError()) + .retryReadTimeoutError(backoff.isRetryReadTimeoutError()) + .build() + ) + .build(); + } + + // Default retry config for other strategies + return RetryConfig.builder().build(); + } + + /** + * Creates a {@code Consumer} bean for HTTP debug logging if none exists. + * This logger is used by the SpeakeasyHTTPClient for debug output when debug logging is enabled. + * By default, it logs to {@code System.out}, but can be customized by providing your own {@code Consumer} bean. + * + * @return A {@code Consumer} that logs messages to {@code System.out} + */ + @Bean + @ConditionalOnMissingBean + public Consumer httpLogger() { + return System.out::println; + } + + /** + * Creates an HTTPClient bean if none exists. + * + * @param properties the configuration properties + * @param httpLogger the logger for HTTP debug output + * @return A configured HTTPClient instance + */ + @Bean + @ConditionalOnMissingBean + public HTTPClient httpClient(OpenapiAutoConfigProperties properties, Consumer httpLogger) { + OpenapiAutoConfigProperties.HttpClient httpClientProps = properties.getHttpClient(); + + // Configure the static logger + SpeakeasyHTTPClient.setLogger(httpLogger); + + if (httpClientProps != null) { + // Configure debug logging + SpeakeasyHTTPClient.setDebugLogging(httpClientProps.isEnableDebugLogging()); + + // Configure redacted headers + if (httpClientProps.getRedactedHeaders() != null && !httpClientProps.getRedactedHeaders().isEmpty()) { + SpeakeasyHTTPClient.setRedactedHeaders(httpClientProps.getRedactedHeaders()); + } + } + + return new SpeakeasyHTTPClient(); + } + /** + * Creates a SecuritySource bean if none exists and security properties are configured. + * + * @param properties the configuration properties + * @return A configured SecuritySource instance + */ + @Bean + @ConditionalOnMissingBean + @ConditionalOnPropertyPrefix(prefix = "openapi.security") + public SecuritySource securitySource(OpenapiAutoConfigProperties properties) {OpenapiAutoConfigProperties.Security securityProps = properties.getSecurity(); + studio.livepeer.livepeer.models.components.Security.Builder securityBuilder = studio.livepeer.livepeer.models.components.Security.builder(); + boolean hasAnySecurityConfiguration = false; + // Build apiKey security from direct properties (primitive value) + if (securityProps.getApiKey() != null) { + securityBuilder.apiKey(securityProps.getApiKey()); + hasAnySecurityConfiguration = true; + } + + if (!hasAnySecurityConfiguration) { + throw new IllegalStateException("Security configuration is present but no security options are configured. " + + "Please configure at least one security option in your application properties."); + } + + return SecuritySource.of(securityBuilder.build()); + } + + /** + * Creates the SDKConfiguration bean as the single source of truth for all SDK configuration. + * + * @param properties the configuration properties + * @param httpClient the HTTP client bean + * @param hooks the hooks bean + * @param asyncHooks the async hooks bean + * @param securitySource the security source bean (optional) + * @param retryConfig the retry config bean (optional) + * @return A configured SDKConfiguration instance + */ + @Bean + @ConditionalOnMissingBean + public SDKConfiguration sdkConfiguration( + OpenapiAutoConfigProperties properties, + HTTPClient httpClient, + studio.livepeer.livepeer.utils.Hooks hooks, + studio.livepeer.livepeer.utils.AsyncHooks asyncHooks, + SecuritySource securitySource, + Optional retryConfig) { + + SDKConfiguration sdkConfiguration = new SDKConfiguration(); + + sdkConfiguration.setClient(httpClient); + + sdkConfiguration.setHooks(hooks); + sdkConfiguration.setAsyncHooks(asyncHooks); + sdkConfiguration.setSecuritySource(securitySource); + + if (properties.getServerUrl() != null) { + sdkConfiguration.setServerUrl(properties.getServerUrl()); + } + sdkConfiguration.setServerIdx(properties.getServerIdx()); + + sdkConfiguration.setRetryConfig(retryConfig); + + return sdkConfiguration; + } + + /** + * Creates the main SDK bean using the configured SDKConfiguration. + * + * @param sdkConfiguration the configured SDKConfiguration bean + * @return A configured Livepeer instance + */ + @Bean + @ConditionalOnMissingBean + public Livepeer livepeer(SDKConfiguration sdkConfiguration) { + return new Livepeer(sdkConfiguration); + } + + /** + * Creates an AsyncHooks bean if none exists. + * + * @return A configured AsyncHooks instance + */ + @Bean + @ConditionalOnMissingBean + public studio.livepeer.livepeer.utils.AsyncHooks asyncHooks() { + return new studio.livepeer.livepeer.utils.AsyncHooks(); + } + + /** + * Creates a ScheduledExecutorService for async retry operations if none exists. + * + * @return A configured ScheduledExecutorService instance + */ + @Bean + @ConditionalOnMissingBean + public ScheduledExecutorService retryScheduler() { + return Executors.newSingleThreadScheduledExecutor(); + } + + /** + * Creates a Hooks configuration bean if none exists. + * + * @return A configured Hooks instance + */ + @Bean + @ConditionalOnMissingBean + public studio.livepeer.livepeer.utils.Hooks hooks() { + return new studio.livepeer.livepeer.utils.Hooks(); + } + /** + * Creates a Stream sub-SDK bean if none exists. + * + * @param livepeer the main SDK instance + * @return A configured Stream instance + */ + @Bean + @ConditionalOnMissingBean + public Stream stream(Livepeer livepeer) { + return livepeer.stream(); + } + /** + * Creates a Multistream sub-SDK bean if none exists. + * + * @param livepeer the main SDK instance + * @return A configured Multistream instance + */ + @Bean + @ConditionalOnMissingBean + public Multistream multistream(Livepeer livepeer) { + return livepeer.multistream(); + } + /** + * Creates a Webhook sub-SDK bean if none exists. + * + * @param livepeer the main SDK instance + * @return A configured Webhook instance + */ + @Bean + @ConditionalOnMissingBean + public Webhook webhook(Livepeer livepeer) { + return livepeer.webhook(); + } + /** + * Creates a Asset sub-SDK bean if none exists. + * + * @param livepeer the main SDK instance + * @return A configured Asset instance + */ + @Bean + @ConditionalOnMissingBean + public Asset asset(Livepeer livepeer) { + return livepeer.asset(); + } + /** + * Creates a Session sub-SDK bean if none exists. + * + * @param livepeer the main SDK instance + * @return A configured Session instance + */ + @Bean + @ConditionalOnMissingBean + public Session session(Livepeer livepeer) { + return livepeer.session(); + } + /** + * Creates a Room sub-SDK bean if none exists. + * + * @param livepeer the main SDK instance + * @return A configured Room instance + */ + @Bean + @ConditionalOnMissingBean + public Room room(Livepeer livepeer) { + return livepeer.room(); + } + /** + * Creates a Metrics sub-SDK bean if none exists. + * + * @param livepeer the main SDK instance + * @return A configured Metrics instance + */ + @Bean + @ConditionalOnMissingBean + public Metrics metrics(Livepeer livepeer) { + return livepeer.metrics(); + } + /** + * Creates a AccessControl sub-SDK bean if none exists. + * + * @param livepeer the main SDK instance + * @return A configured AccessControl instance + */ + @Bean + @ConditionalOnMissingBean + public AccessControl accessControl(Livepeer livepeer) { + return livepeer.accessControl(); + } + /** + * Creates a Task sub-SDK bean if none exists. + * + * @param livepeer the main SDK instance + * @return A configured Task instance + */ + @Bean + @ConditionalOnMissingBean + public Task task(Livepeer livepeer) { + return livepeer.task(); + } + /** + * Creates a Transcode sub-SDK bean if none exists. + * + * @param livepeer the main SDK instance + * @return A configured Transcode instance + */ + @Bean + @ConditionalOnMissingBean + public Transcode transcode(Livepeer livepeer) { + return livepeer.transcode(); + } + /** + * Creates a Playback sub-SDK bean if none exists. + * + * @param livepeer the main SDK instance + * @return A configured Playback instance + */ + @Bean + @ConditionalOnMissingBean + public Playback playback(Livepeer livepeer) { + return livepeer.playback(); + } + + /** + * Creates the async SDK bean if none exists. + * + * @param livepeer the main SDK instance + * @param sdkConfiguration the configured SDKConfiguration bean + * @return A configured AsyncLivepeer instance + */ + @Bean + @ConditionalOnMissingBean + public AsyncLivepeer asyncLivepeer(Livepeer livepeer, SDKConfiguration sdkConfiguration) { + return new AsyncLivepeer(livepeer, sdkConfiguration); + } + /** + * Creates an AsyncStream sub-SDK bean if none exists. + * + * @param asyncLivepeer the async SDK instance + * @return A configured AsyncStream instance + */ + @Bean + @ConditionalOnMissingBean + public AsyncStream asyncStream(AsyncLivepeer asyncLivepeer) { + return asyncLivepeer.stream(); + } + /** + * Creates an AsyncMultistream sub-SDK bean if none exists. + * + * @param asyncLivepeer the async SDK instance + * @return A configured AsyncMultistream instance + */ + @Bean + @ConditionalOnMissingBean + public AsyncMultistream asyncMultistream(AsyncLivepeer asyncLivepeer) { + return asyncLivepeer.multistream(); + } + /** + * Creates an AsyncWebhook sub-SDK bean if none exists. + * + * @param asyncLivepeer the async SDK instance + * @return A configured AsyncWebhook instance + */ + @Bean + @ConditionalOnMissingBean + public AsyncWebhook asyncWebhook(AsyncLivepeer asyncLivepeer) { + return asyncLivepeer.webhook(); + } + /** + * Creates an AsyncAsset sub-SDK bean if none exists. + * + * @param asyncLivepeer the async SDK instance + * @return A configured AsyncAsset instance + */ + @Bean + @ConditionalOnMissingBean + public AsyncAsset asyncAsset(AsyncLivepeer asyncLivepeer) { + return asyncLivepeer.asset(); + } + /** + * Creates an AsyncSession sub-SDK bean if none exists. + * + * @param asyncLivepeer the async SDK instance + * @return A configured AsyncSession instance + */ + @Bean + @ConditionalOnMissingBean + public AsyncSession asyncSession(AsyncLivepeer asyncLivepeer) { + return asyncLivepeer.session(); + } + /** + * Creates an AsyncRoom sub-SDK bean if none exists. + * + * @param asyncLivepeer the async SDK instance + * @return A configured AsyncRoom instance + */ + @Bean + @ConditionalOnMissingBean + public AsyncRoom asyncRoom(AsyncLivepeer asyncLivepeer) { + return asyncLivepeer.room(); + } + /** + * Creates an AsyncMetrics sub-SDK bean if none exists. + * + * @param asyncLivepeer the async SDK instance + * @return A configured AsyncMetrics instance + */ + @Bean + @ConditionalOnMissingBean + public AsyncMetrics asyncMetrics(AsyncLivepeer asyncLivepeer) { + return asyncLivepeer.metrics(); + } + /** + * Creates an AsyncAccessControl sub-SDK bean if none exists. + * + * @param asyncLivepeer the async SDK instance + * @return A configured AsyncAccessControl instance + */ + @Bean + @ConditionalOnMissingBean + public AsyncAccessControl asyncAccessControl(AsyncLivepeer asyncLivepeer) { + return asyncLivepeer.accessControl(); + } + /** + * Creates an AsyncTask sub-SDK bean if none exists. + * + * @param asyncLivepeer the async SDK instance + * @return A configured AsyncTask instance + */ + @Bean + @ConditionalOnMissingBean + public AsyncTask asyncTask(AsyncLivepeer asyncLivepeer) { + return asyncLivepeer.task(); + } + /** + * Creates an AsyncTranscode sub-SDK bean if none exists. + * + * @param asyncLivepeer the async SDK instance + * @return A configured AsyncTranscode instance + */ + @Bean + @ConditionalOnMissingBean + public AsyncTranscode asyncTranscode(AsyncLivepeer asyncLivepeer) { + return asyncLivepeer.transcode(); + } + /** + * Creates an AsyncPlayback sub-SDK bean if none exists. + * + * @param asyncLivepeer the async SDK instance + * @return A configured AsyncPlayback instance + */ + @Bean + @ConditionalOnMissingBean + public AsyncPlayback asyncPlayback(AsyncLivepeer asyncLivepeer) { + return asyncLivepeer.playback(); + } +} \ No newline at end of file diff --git a/spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/OpenapiAutoConfigProperties.java b/spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/OpenapiAutoConfigProperties.java new file mode 100644 index 00000000..32b6fcfa --- /dev/null +++ b/spring/openapi-spring-boot-autoconfigure/src/main/java/studio/livepeer/livepeer/OpenapiAutoConfigProperties.java @@ -0,0 +1,460 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.time.Duration; +import java.lang.String; +import java.util.Collection; +import java.util.Set; + + +/** + * Spring Boot Configuration Properties for openapi SDK + */ +@ConfigurationProperties(prefix = "openapi") +public class OpenapiAutoConfigProperties { + + /** + * Constructor. + */ + public OpenapiAutoConfigProperties() { + } + + /** + * The base URL for the API server. If not specified, the SDK will use the default server URL. + */ + private String serverUrl; + + /** + * Configuration for retry behavior when API calls fail due to transient errors. + */ + private RetryConfig retryConfig = new RetryConfig(); + + /** + * HTTP client configuration for API requests. + */ + private HttpClient httpClient = new HttpClient(); + /** + * The index of the server to use from the list of available servers (0-based). Defaults to the first server. + */ + private int serverIdx = 0; + /** + * Security configuration for API authentication. + */ + private Security security = new Security(); + + /** + * Gets the base URL for the API server. + * + * @return the base URL for the API server + */ + public String getServerUrl() { + return serverUrl; + } + + /** + * Sets the base URL for the API server. + * + * @param serverUrl the base URL for the API server + */ + public void setServerUrl(String serverUrl) { + this.serverUrl = serverUrl; + } + + /** + * Gets the retry configuration for API calls that fail due to transient errors. + * + * @return the retry configuration + */ + public RetryConfig getRetryConfig() { + return retryConfig; + } + + /** + * Sets the retry configuration for API calls that fail due to transient errors. + * + * @param retryConfig the retry configuration to use + */ + public void setRetryConfig(RetryConfig retryConfig) { + this.retryConfig = retryConfig; + } + + /** + * Gets the HTTP client configuration for API requests. + * + * @return the HTTP client configuration + */ + public HttpClient getHttpClient() { + return httpClient; + } + + /** + * Sets the HTTP client configuration for API requests. + * + * @param httpClient the HTTP client configuration to use + */ + public void setHttpClient(HttpClient httpClient) { + this.httpClient = httpClient; + } + /** + * Gets the index of the server to use from the list of available servers (0-based). + * + * @return the server index + */ + public int getServerIdx() { + return serverIdx; + } + + /** + * Sets the index of the server to use from the list of available servers (0-based). + * + * @param serverIdx the server index to use + */ + public void setServerIdx(int serverIdx) { + this.serverIdx = serverIdx; + } + /** + * Gets the security configuration for API authentication. + * + * @return the security configuration + */ + public Security getSecurity() { + return security; + } + + /** + * Sets the security configuration for API authentication. + * + * @param security the security configuration to use + */ + public void setSecurity(Security security) { + this.security = security; + } + + /** + * Retry configuration properties + */ + public static class RetryConfig { + + /** + * Constructor. + */ + public RetryConfig() { + } + + /** + * The retry strategy to use for failed requests. + */ + private studio.livepeer.livepeer.utils.RetryConfig.Strategy strategy; + + /** + * Configuration for exponential backoff retry strategy. Only used when strategy is set to BACKOFF. + */ + private Backoff backoff = new Backoff(); + + /** + * Gets the retry strategy to use for failed requests. + * + * @return the retry strategy + */ + public studio.livepeer.livepeer.utils.RetryConfig.Strategy getStrategy() { + return strategy; + } + + /** + * Sets the retry strategy to use for failed requests. + * + * @param strategy the retry strategy to use + */ + public void setStrategy(studio.livepeer.livepeer.utils.RetryConfig.Strategy strategy) { + this.strategy = strategy; + } + + /** + * Gets the backoff configuration for exponential backoff retry strategy. + * + * @return the backoff configuration + */ + public Backoff getBackoff() { + return backoff; + } + + /** + * Sets the backoff configuration for exponential backoff retry strategy. + * + * @param backoff the backoff configuration to use + */ + public void setBackoff(Backoff backoff) { + this.backoff = backoff; + } + + /** + * Backoff retry configuration matching BackoffStrategy fields + */ + public static class Backoff { + + /** + * Constructor. + */ + public Backoff() { + } + + /** + * The initial delay before the first retry attempt. Supports duration formats like "500ms", "1s", "2m". + */ + private Duration initialInterval = Duration.ofMillis(500); + + /** + * The maximum delay between retry attempts. The backoff will not exceed this value. + */ + private Duration maxInterval = Duration.ofSeconds(60); + + /** + * The maximum total time to spend on all retry attempts. Retries will stop after this duration. + */ + private Duration maxElapsedTime = Duration.ofHours(1); + + /** + * The multiplier for exponential backoff. Each retry delay is multiplied by this factor (e.g., 1.5 means 50% increase). + */ + private double baseFactor = 1.5; + + /** + * Random jitter factor to avoid thundering herd problems. Value between 0.0 (no jitter) and 1.0 (full jitter). + */ + private double jitterFactor = 0.5; + + /** + * Whether to retry requests that fail due to connection errors (e.g., connection refused, timeout). + */ + private boolean retryConnectError = false; + + /** + * Whether to retry requests that fail due to read timeout errors (server doesn't respond within timeout). + */ + private boolean retryReadTimeoutError = false; + + /** + * Gets the initial delay before the first retry attempt. + * + * @return the initial delay duration + */ + public Duration getInitialInterval() { + return initialInterval; + } + + /** + * Sets the initial delay before the first retry attempt. + * + * @param initialInterval the initial delay duration + */ + public void setInitialInterval(Duration initialInterval) { + this.initialInterval = initialInterval; + } + + /** + * Gets the maximum delay between retry attempts. + * + * @return the maximum delay duration + */ + public Duration getMaxInterval() { + return maxInterval; + } + + /** + * Sets the maximum delay between retry attempts. + * + * @param maxInterval the maximum delay duration + */ + public void setMaxInterval(Duration maxInterval) { + this.maxInterval = maxInterval; + } + + /** + * Gets the maximum total time to spend on all retry attempts. + * + * @return the maximum elapsed time duration + */ + public Duration getMaxElapsedTime() { + return maxElapsedTime; + } + + /** + * Sets the maximum total time to spend on all retry attempts. + * + * @param maxElapsedTime the maximum elapsed time duration + */ + public void setMaxElapsedTime(Duration maxElapsedTime) { + this.maxElapsedTime = maxElapsedTime; + } + + /** + * Gets the multiplier for exponential backoff. + * + * @return the base factor for exponential backoff + */ + public double getBaseFactor() { + return baseFactor; + } + + /** + * Sets the multiplier for exponential backoff. + * + * @param baseFactor the base factor for exponential backoff + */ + public void setBaseFactor(double baseFactor) { + this.baseFactor = baseFactor; + } + + /** + * Gets the random jitter factor to avoid thundering herd problems. + * + * @return the jitter factor (0.0 to 1.0) + */ + public double getJitterFactor() { + return jitterFactor; + } + + /** + * Sets the random jitter factor to avoid thundering herd problems. + * + * @param jitterFactor the jitter factor (0.0 to 1.0) + */ + public void setJitterFactor(double jitterFactor) { + this.jitterFactor = jitterFactor; + } + + /** + * Gets whether to retry requests that fail due to connection errors. + * + * @return true if connection errors should be retried, false otherwise + */ + public boolean isRetryConnectError() { + return retryConnectError; + } + + /** + * Sets whether to retry requests that fail due to connection errors. + * + * @param retryConnectError true to retry connection errors, false otherwise + */ + public void setRetryConnectError(boolean retryConnectError) { + this.retryConnectError = retryConnectError; + } + + /** + * Gets whether to retry requests that fail due to read timeout errors. + * + * @return true if read timeout errors should be retried, false otherwise + */ + public boolean isRetryReadTimeoutError() { + return retryReadTimeoutError; + } + + /** + * Sets whether to retry requests that fail due to read timeout errors. + * + * @param retryReadTimeoutError true to retry read timeout errors, false otherwise + */ + public void setRetryReadTimeoutError(boolean retryReadTimeoutError) { + this.retryReadTimeoutError = retryReadTimeoutError; + } + } + } + + /** + * HTTP client configuration properties + */ + public static class HttpClient { + + /** + * Constructor. + */ + public HttpClient() { + } + + /** + * Whether to enable debug logging for HTTP requests and responses, including JSON body content. + */ + private boolean enableDebugLogging = false; + + /** + * Collection of header names (case-insensitive) whose values will be redacted in debug logs. + * By default, Authorization and X-API-KEY headers are redacted for security. + */ + private Collection redactedHeaders = Set.of("Authorization", "X-API-KEY"); + + /** + * Gets whether debug logging is enabled for HTTP requests and responses. + * + * @return true if debug logging is enabled, false otherwise + */ + public boolean isEnableDebugLogging() { + return enableDebugLogging; + } + + /** + * Sets whether to enable debug logging for HTTP requests and responses. + * + * @param enableDebugLogging true to enable debug logging, false otherwise + */ + public void setEnableDebugLogging(boolean enableDebugLogging) { + this.enableDebugLogging = enableDebugLogging; + } + + /** + * Gets the collection of header names whose values will be redacted in debug logs. + * + * @return the collection of header names to redact + */ + public Collection getRedactedHeaders() { + return redactedHeaders; + } + + /** + * Sets the collection of header names whose values will be redacted in debug logs. + * + * @param redactedHeaders the collection of header names to redact + */ + public void setRedactedHeaders(Collection redactedHeaders) { + this.redactedHeaders = redactedHeaders; + } + } + + /** + * Security configuration properties + */ + public static class Security { + + /** + * Constructor. + */ + public Security() { + } + /** + * apiKey for authentication. + */ + private String apiKey; + + /** + * Gets the apiKey value. + * + * @return the apiKey value + */ + public String getApiKey() { + return apiKey; + } + + /** + * Sets the apiKey value. + * + * @param apiKey the apiKey value to use + */ + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + } +} \ No newline at end of file diff --git a/spring/openapi-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring/openapi-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..4ef828c6 --- /dev/null +++ b/spring/openapi-spring-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +studio.livepeer.livepeer.OpenapiAutoConfig \ No newline at end of file diff --git a/spring/openapi-spring-boot-starter/build.gradle b/spring/openapi-spring-boot-starter/build.gradle new file mode 100644 index 00000000..d3001e3c --- /dev/null +++ b/spring/openapi-spring-boot-starter/build.gradle @@ -0,0 +1,29 @@ +description = 'openapi Spring Boot Starter' + +// Publishing configuration overrides +ext { + publishingConfig = [ + groupId: rootProject.group, + artifactId: 'openapi-spring-boot-starter', + version: rootProject.version, + name: 'My Company Java SDK - Spring Boot Starter', + description: 'Spring Boot starter for the My Company Java SDK.', + ] +} + +dependencies { + api project(':') + api project(':openapi-spring-boot-autoconfigure') + api "org.springframework.boot:spring-boot-starter:${rootProject.springBootVersion}" +} + +jar { + dependsOn 'generatePomFileForMavenPublication' + archiveBaseName = 'openapi-spring-boot-starter' + into("META-INF/maven/studio.livepeer/openapi-spring-boot-starter") { + from(layout.buildDirectory.file("pom.xml")) { + // Only include if it exists to avoid build ordering issues + duplicatesStrategy = DuplicatesStrategy.INCLUDE + } + } +} \ No newline at end of file diff --git a/src/main/java/studio/livepeer/livepeer/AccessControl.java b/src/main/java/studio/livepeer/livepeer/AccessControl.java index 029ab24e..a1b04503 100644 --- a/src/main/java/studio/livepeer/livepeer/AccessControl.java +++ b/src/main/java/studio/livepeer/livepeer/AccessControl.java @@ -1,21 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; -import com.fasterxml.jackson.core.type.TypeReference; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.Object; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.List; -import java.util.Optional; -import studio.livepeer.livepeer.models.components.SigningKey; -import studio.livepeer.livepeer.models.errors.Error; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.CreateSigningKeyRequestBuilder; import studio.livepeer.livepeer.models.operations.CreateSigningKeyResponse; import studio.livepeer.livepeer.models.operations.DeleteSigningKeyRequest; @@ -26,698 +17,174 @@ import studio.livepeer.livepeer.models.operations.GetSigningKeyResponse; import studio.livepeer.livepeer.models.operations.GetSigningKeysRequestBuilder; import studio.livepeer.livepeer.models.operations.GetSigningKeysResponse; -import studio.livepeer.livepeer.models.operations.SDKMethodInterfaces.*; import studio.livepeer.livepeer.models.operations.UpdateSigningKeyRequest; import studio.livepeer.livepeer.models.operations.UpdateSigningKeyRequestBody; import studio.livepeer.livepeer.models.operations.UpdateSigningKeyRequestBuilder; import studio.livepeer.livepeer.models.operations.UpdateSigningKeyResponse; -import studio.livepeer.livepeer.utils.HTTPClient; -import studio.livepeer.livepeer.utils.HTTPRequest; -import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; -import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; -import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; -import studio.livepeer.livepeer.utils.SerializedBody; -import studio.livepeer.livepeer.utils.Utils.JsonShape; -import studio.livepeer.livepeer.utils.Utils; +import studio.livepeer.livepeer.operations.CreateSigningKey; +import studio.livepeer.livepeer.operations.DeleteSigningKey; +import studio.livepeer.livepeer.operations.GetSigningKey; +import studio.livepeer.livepeer.operations.GetSigningKeys; +import studio.livepeer.livepeer.operations.UpdateSigningKey; +import studio.livepeer.livepeer.utils.Headers; /** * Operations related to access control/signing keys api */ -public class AccessControl implements - MethodCallCreateSigningKey, - MethodCallGetSigningKeys, - MethodCallDeleteSigningKey, - MethodCallGetSigningKey, - MethodCallUpdateSigningKey { - +public class AccessControl { + private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; + private final AsyncAccessControl asyncSDK; AccessControl(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncAccessControl(this, sdkConfiguration); } + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncAccessControl async() { + return asyncSDK; + } /** * Create a signing key - * The publicKey is a representation of the public key, encoded as base 64 and is passed as a string, and the privateKey is displayed only on creation. This is the only moment where the client can save the private key, otherwise it will be lost. Remember to decode your string when signing JWTs. - * Up to 10 signing keys can be generated, after that you must delete at least one signing key to create a new one. + * + *

The publicKey is a representation of the public key, encoded as base 64 and is passed as a string, + * and the privateKey is displayed only on creation. This is the only moment where the client can save + * the private key, otherwise it will be lost. Remember to decode your string when signing JWTs. + * Up to 10 signing keys can be generated, after that you must delete at least one signing key to + * create a new one. * * @return The call builder */ public CreateSigningKeyRequestBuilder create() { - return new CreateSigningKeyRequestBuilder(this); + return new CreateSigningKeyRequestBuilder(sdkConfiguration); } /** * Create a signing key - * The publicKey is a representation of the public key, encoded as base 64 and is passed as a string, and the privateKey is displayed only on creation. This is the only moment where the client can save the private key, otherwise it will be lost. Remember to decode your string when signing JWTs. - * Up to 10 signing keys can be generated, after that you must delete at least one signing key to create a new one. + * + *

The publicKey is a representation of the public key, encoded as base 64 and is passed as a string, + * and the privateKey is displayed only on creation. This is the only moment where the client can save + * the private key, otherwise it will be lost. Remember to decode your string when signing JWTs. + * Up to 10 signing keys can be generated, after that you must delete at least one signing key to + * create a new one. * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public CreateSigningKeyResponse createDirect() throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/access-control/signing-key"); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "createSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "createSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateSigningKeyResponse.Builder _resBuilder = - CreateSigningKeyResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - CreateSigningKeyResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - SigningKey _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withSigningKey(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public CreateSigningKeyResponse createDirect() { + RequestlessOperation operation + = new CreateSigningKey.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest()); } - - /** * Retrieves signing keys + * * @return The call builder */ public GetSigningKeysRequestBuilder getAll() { - return new GetSigningKeysRequestBuilder(this); + return new GetSigningKeysRequestBuilder(sdkConfiguration); } /** * Retrieves signing keys + * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetSigningKeysResponse getAllDirect() throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/access-control/signing-key"); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getSigningKeys", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getSigningKeys", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getSigningKeys", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getSigningKeys", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetSigningKeysResponse.Builder _resBuilder = - GetSigningKeysResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetSigningKeysResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public GetSigningKeysResponse getAllDirect() { + RequestlessOperation operation + = new GetSigningKeys.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest()); } - - /** * Delete Signing Key + * * @return The call builder */ public DeleteSigningKeyRequestBuilder delete() { - return new DeleteSigningKeyRequestBuilder(this); + return new DeleteSigningKeyRequestBuilder(sdkConfiguration); } /** * Delete Signing Key + * * @param keyId ID of the signing key * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public DeleteSigningKeyResponse delete( - String keyId) throws Exception { + public DeleteSigningKeyResponse delete(String keyId) { DeleteSigningKeyRequest request = DeleteSigningKeyRequest .builder() .keyId(keyId) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - DeleteSigningKeyRequest.class, - _baseUrl, - "/access-control/signing-key/{keyId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "DELETE"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "deleteSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "deleteSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeleteSigningKeyResponse.Builder _resBuilder = - DeleteSigningKeyResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - DeleteSigningKeyResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new DeleteSigningKey.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Retrieves a signing key + * * @return The call builder */ public GetSigningKeyRequestBuilder get() { - return new GetSigningKeyRequestBuilder(this); + return new GetSigningKeyRequestBuilder(sdkConfiguration); } /** * Retrieves a signing key + * * @param keyId ID of the signing key * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetSigningKeyResponse get( - String keyId) throws Exception { + public GetSigningKeyResponse get(String keyId) { GetSigningKeyRequest request = GetSigningKeyRequest .builder() .keyId(keyId) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetSigningKeyRequest.class, - _baseUrl, - "/access-control/signing-key/{keyId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetSigningKeyResponse.Builder _resBuilder = - GetSigningKeyResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetSigningKeyResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - SigningKey _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withSigningKey(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetSigningKey.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Update a signing key + * * @return The call builder */ public UpdateSigningKeyRequestBuilder update() { - return new UpdateSigningKeyRequestBuilder(this); + return new UpdateSigningKeyRequestBuilder(sdkConfiguration); } /** * Update a signing key + * * @param keyId ID of the signing key - * @param requestBody + * @param requestBody * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public UpdateSigningKeyResponse update( - String keyId, - UpdateSigningKeyRequestBody requestBody) throws Exception { + public UpdateSigningKeyResponse update(String keyId, UpdateSigningKeyRequestBody requestBody) { UpdateSigningKeyRequest request = UpdateSigningKeyRequest .builder() .keyId(keyId) .requestBody(requestBody) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - UpdateSigningKeyRequest.class, - _baseUrl, - "/access-control/signing-key/{keyId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "PATCH"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "requestBody", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "updateSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "updateSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "updateSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "updateSigningKey", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - UpdateSigningKeyResponse.Builder _resBuilder = - UpdateSigningKeyResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - UpdateSigningKeyResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new UpdateSigningKey.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/Asset.java b/src/main/java/studio/livepeer/livepeer/Asset.java index 60a8f1f6..7b4504d1 100644 --- a/src/main/java/studio/livepeer/livepeer/Asset.java +++ b/src/main/java/studio/livepeer/livepeer/Asset.java @@ -1,23 +1,15 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; -import com.fasterxml.jackson.core.type.TypeReference; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.Object; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.List; -import java.util.Optional; import studio.livepeer.livepeer.models.components.AssetPatchPayload; import studio.livepeer.livepeer.models.components.NewAssetFromUrlPayload; import studio.livepeer.livepeer.models.components.NewAssetPayload; -import studio.livepeer.livepeer.models.errors.Error; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.DeleteAssetRequest; import studio.livepeer.livepeer.models.operations.DeleteAssetRequestBuilder; import studio.livepeer.livepeer.models.operations.DeleteAssetResponse; @@ -26,174 +18,68 @@ import studio.livepeer.livepeer.models.operations.GetAssetResponse; import studio.livepeer.livepeer.models.operations.GetAssetsRequestBuilder; import studio.livepeer.livepeer.models.operations.GetAssetsResponse; -import studio.livepeer.livepeer.models.operations.RequestUploadData; import studio.livepeer.livepeer.models.operations.RequestUploadRequestBuilder; import studio.livepeer.livepeer.models.operations.RequestUploadResponse; -import studio.livepeer.livepeer.models.operations.SDKMethodInterfaces.*; import studio.livepeer.livepeer.models.operations.UpdateAssetRequest; import studio.livepeer.livepeer.models.operations.UpdateAssetRequestBuilder; import studio.livepeer.livepeer.models.operations.UpdateAssetResponse; -import studio.livepeer.livepeer.models.operations.UploadAssetData; -import studio.livepeer.livepeer.models.operations.UploadAssetDataOutput; import studio.livepeer.livepeer.models.operations.UploadAssetRequestBuilder; import studio.livepeer.livepeer.models.operations.UploadAssetResponse; -import studio.livepeer.livepeer.utils.HTTPClient; -import studio.livepeer.livepeer.utils.HTTPRequest; -import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; -import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; -import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; -import studio.livepeer.livepeer.utils.SerializedBody; -import studio.livepeer.livepeer.utils.Utils.JsonShape; -import studio.livepeer.livepeer.utils.Utils; +import studio.livepeer.livepeer.operations.DeleteAsset; +import studio.livepeer.livepeer.operations.GetAsset; +import studio.livepeer.livepeer.operations.GetAssets; +import studio.livepeer.livepeer.operations.RequestUpload; +import studio.livepeer.livepeer.operations.UpdateAsset; +import studio.livepeer.livepeer.operations.UploadAsset; +import studio.livepeer.livepeer.utils.Headers; /** * Operations related to asset/vod api */ -public class Asset implements - MethodCallGetAssets, - MethodCallRequestUpload, - MethodCallUploadAsset, - MethodCallGetAsset, - MethodCallUpdateAsset, - MethodCallDeleteAsset { - +public class Asset { + private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; + private final AsyncAsset asyncSDK; Asset(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncAsset(this, sdkConfiguration); } + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncAsset async() { + return asyncSDK; + } /** * Retrieve assets + * * @return The call builder */ public GetAssetsRequestBuilder getAll() { - return new GetAssetsRequestBuilder(this); + return new GetAssetsRequestBuilder(sdkConfiguration); } /** * Retrieve assets + * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetAssetsResponse getAllDirect() throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/asset"); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getAssets", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getAssets", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getAssets", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getAssets", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetAssetsResponse.Builder _resBuilder = - GetAssetsResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetAssetsResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public GetAssetsResponse getAllDirect() { + RequestlessOperation operation + = new GetAssets.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest()); } - - /** * Upload an asset - * To upload an asset, your first need to request for a direct upload URL + * + *

To upload an asset, your first need to request for a direct upload URL * and only then actually upload the contents of the asset. * \ * \ @@ -203,14 +89,12 @@ public GetAssetsResponse getAllDirect() throws Exception { * connections. If you want a simpler implementation though, you should * just use a direct upload. * - * - * ## Direct Upload + *

## Direct Upload * For a direct upload, make a PUT request to the URL received in the url * field of the response above, with the raw video file as the request * body. response above: * - * - * ## Resumable Upload + *

## Resumable Upload * Livepeer supports resumable uploads via Tus. This section provides a * simple example of how to use tus-js-client to upload a video file. * \ @@ -220,46 +104,45 @@ public GetAssetsResponse getAllDirect() throws Exception { * tusEndpoint field of the response to upload the video file and track the * progress: * - * ``` + *

``` * # This assumes there is an `input` element of `type="file"` with id * `fileInput` in the HTML * + *

const input = document.getElementById('fileInput'); * - * const input = document.getElementById('fileInput'); - * - * const file = input.files[0]; + *

const file = input.files[0]; * - * const upload = new tus.Upload(file, { - * endpoint: tusEndpoint, // URL from `tusEndpoint` field in the + *

const upload = new tus.Upload(file, { + * endpoint: tusEndpoint, // URL from `tusEndpoint` field in the * `/request-upload` response - * metadata: { - * filename, - * filetype: 'video/mp4', - * }, - * uploadSize: file.size, - * onError(err) { - * console.error('Error uploading file:', err); - * }, - * onProgress(bytesUploaded, bytesTotal) { - * const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2); - * console.log('Uploaded ' + percentage + '%'); - * }, - * onSuccess() { - * console.log('Upload finished:', upload.url); - * }, + * metadata: { + * filename, + * filetype: 'video/mp4', + * }, + * uploadSize: file.size, + * onError(err) { + * console.error('Error uploading file:', err); + * }, + * onProgress(bytesUploaded, bytesTotal) { + * const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2); + * console.log('Uploaded ' + percentage + '%'); + * }, + * onSuccess() { + * console.log('Upload finished:', upload.url); + * }, * }); * - * const previousUploads = await upload.findPreviousUploads(); + *

const previousUploads = await upload.findPreviousUploads(); * - * if (previousUploads.length > 0) { - * upload.resumeFromPreviousUpload(previousUploads[0]); + *

if (previousUploads.length > 0) { + * upload.resumeFromPreviousUpload(previousUploads[0]); * } * - * upload.start(); + *

upload.start(); * - * ``` + *

``` * - * > Note: If you are using tus from node.js, you need to add a custom URL + *

> Note: If you are using tus from node.js, you need to add a custom URL * storage to enable resuming from previous uploads. On the browser, this * is enabled by default using local storage. In node.js, add urlStorage: * new tus.FileUrlStorage("path/to/tmp/file"), to the UploadFile object @@ -268,12 +151,13 @@ public GetAssetsResponse getAllDirect() throws Exception { * @return The call builder */ public RequestUploadRequestBuilder create() { - return new RequestUploadRequestBuilder(this); + return new RequestUploadRequestBuilder(sdkConfiguration); } /** * Upload an asset - * To upload an asset, your first need to request for a direct upload URL + * + *

To upload an asset, your first need to request for a direct upload URL * and only then actually upload the contents of the asset. * \ * \ @@ -283,14 +167,12 @@ public RequestUploadRequestBuilder create() { * connections. If you want a simpler implementation though, you should * just use a direct upload. * - * - * ## Direct Upload + *

## Direct Upload * For a direct upload, make a PUT request to the URL received in the url * field of the response above, with the raw video file as the request * body. response above: * - * - * ## Resumable Upload + *

## Resumable Upload * Livepeer supports resumable uploads via Tus. This section provides a * simple example of how to use tus-js-client to upload a video file. * \ @@ -300,752 +182,163 @@ public RequestUploadRequestBuilder create() { * tusEndpoint field of the response to upload the video file and track the * progress: * - * ``` + *

``` * # This assumes there is an `input` element of `type="file"` with id * `fileInput` in the HTML * + *

const input = document.getElementById('fileInput'); * - * const input = document.getElementById('fileInput'); - * - * const file = input.files[0]; + *

const file = input.files[0]; * - * const upload = new tus.Upload(file, { - * endpoint: tusEndpoint, // URL from `tusEndpoint` field in the + *

const upload = new tus.Upload(file, { + * endpoint: tusEndpoint, // URL from `tusEndpoint` field in the * `/request-upload` response - * metadata: { - * filename, - * filetype: 'video/mp4', - * }, - * uploadSize: file.size, - * onError(err) { - * console.error('Error uploading file:', err); - * }, - * onProgress(bytesUploaded, bytesTotal) { - * const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2); - * console.log('Uploaded ' + percentage + '%'); - * }, - * onSuccess() { - * console.log('Upload finished:', upload.url); - * }, + * metadata: { + * filename, + * filetype: 'video/mp4', + * }, + * uploadSize: file.size, + * onError(err) { + * console.error('Error uploading file:', err); + * }, + * onProgress(bytesUploaded, bytesTotal) { + * const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2); + * console.log('Uploaded ' + percentage + '%'); + * }, + * onSuccess() { + * console.log('Upload finished:', upload.url); + * }, * }); * - * const previousUploads = await upload.findPreviousUploads(); + *

const previousUploads = await upload.findPreviousUploads(); * - * if (previousUploads.length > 0) { - * upload.resumeFromPreviousUpload(previousUploads[0]); + *

if (previousUploads.length > 0) { + * upload.resumeFromPreviousUpload(previousUploads[0]); * } * - * upload.start(); + *

upload.start(); * - * ``` + *

``` * - * > Note: If you are using tus from node.js, you need to add a custom URL + *

> Note: If you are using tus from node.js, you need to add a custom URL * storage to enable resuming from previous uploads. On the browser, this * is enabled by default using local storage. In node.js, add urlStorage: * new tus.FileUrlStorage("path/to/tmp/file"), to the UploadFile object * definition above. * - * @param request The request object containing all of the parameters for the API call. + * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public RequestUploadResponse create( - NewAssetPayload request) throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/asset/request-upload"); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "request", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "requestUpload", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "requestUpload", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "requestUpload", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "requestUpload", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - RequestUploadResponse.Builder _resBuilder = - RequestUploadResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - RequestUploadResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - RequestUploadData _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public RequestUploadResponse create(NewAssetPayload request) { + RequestOperation operation + = new RequestUpload.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Upload asset via URL + * * @return The call builder */ public UploadAssetRequestBuilder createViaUrl() { - return new UploadAssetRequestBuilder(this); + return new UploadAssetRequestBuilder(sdkConfiguration); } /** * Upload asset via URL - * @param request The request object containing all of the parameters for the API call. + * + * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public UploadAssetResponse createViaUrl( - NewAssetFromUrlPayload request) throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/asset/upload/url"); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "request", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "uploadAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "uploadAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "uploadAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "uploadAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - UploadAssetResponse.Builder _resBuilder = - UploadAssetResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - UploadAssetResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - UploadAssetData _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withTwoHundredApplicationJsonData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "201")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - UploadAssetDataOutput _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withTwoHundredAndOneApplicationJsonData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public UploadAssetResponse createViaUrl(NewAssetFromUrlPayload request) { + RequestOperation operation + = new UploadAsset.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Retrieves an asset + * * @return The call builder */ public GetAssetRequestBuilder get() { - return new GetAssetRequestBuilder(this); + return new GetAssetRequestBuilder(sdkConfiguration); } /** * Retrieves an asset + * * @param assetId ID of the asset * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetAssetResponse get( - String assetId) throws Exception { + public GetAssetResponse get(String assetId) { GetAssetRequest request = GetAssetRequest .builder() .assetId(assetId) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetAssetRequest.class, - _baseUrl, - "/asset/{assetId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetAssetResponse.Builder _resBuilder = - GetAssetResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetAssetResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.Asset _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withAsset(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetAsset.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Patch an asset + * * @return The call builder */ public UpdateAssetRequestBuilder update() { - return new UpdateAssetRequestBuilder(this); + return new UpdateAssetRequestBuilder(sdkConfiguration); } /** * Patch an asset + * * @param assetId ID of the asset - * @param assetPatchPayload + * @param assetPatchPayload * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public UpdateAssetResponse update( - String assetId, - AssetPatchPayload assetPatchPayload) throws Exception { + public UpdateAssetResponse update(String assetId, AssetPatchPayload assetPatchPayload) { UpdateAssetRequest request = UpdateAssetRequest .builder() .assetId(assetId) .assetPatchPayload(assetPatchPayload) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - UpdateAssetRequest.class, - _baseUrl, - "/asset/{assetId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "PATCH"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "assetPatchPayload", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "updateAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "updateAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "updateAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "updateAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - UpdateAssetResponse.Builder _resBuilder = - UpdateAssetResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - UpdateAssetResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.Asset _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withAsset(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new UpdateAsset.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Delete an asset + * * @return The call builder */ public DeleteAssetRequestBuilder delete() { - return new DeleteAssetRequestBuilder(this); + return new DeleteAssetRequestBuilder(sdkConfiguration); } /** * Delete an asset + * * @param assetId ID of the asset * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public DeleteAssetResponse delete( - String assetId) throws Exception { + public DeleteAssetResponse delete(String assetId) { DeleteAssetRequest request = DeleteAssetRequest .builder() .assetId(assetId) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - DeleteAssetRequest.class, - _baseUrl, - "/asset/{assetId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "DELETE"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "deleteAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "deleteAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteAsset", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeleteAssetResponse.Builder _resBuilder = - DeleteAssetResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - DeleteAssetResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new DeleteAsset.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/AsyncAccessControl.java b/src/main/java/studio/livepeer/livepeer/AsyncAccessControl.java new file mode 100644 index 00000000..71c10178 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/AsyncAccessControl.java @@ -0,0 +1,196 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.models.operations.DeleteSigningKeyRequest; +import studio.livepeer.livepeer.models.operations.GetSigningKeyRequest; +import studio.livepeer.livepeer.models.operations.UpdateSigningKeyRequest; +import studio.livepeer.livepeer.models.operations.UpdateSigningKeyRequestBody; +import studio.livepeer.livepeer.models.operations.async.CreateSigningKeyRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.CreateSigningKeyResponse; +import studio.livepeer.livepeer.models.operations.async.DeleteSigningKeyRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.DeleteSigningKeyResponse; +import studio.livepeer.livepeer.models.operations.async.GetSigningKeyRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetSigningKeyResponse; +import studio.livepeer.livepeer.models.operations.async.GetSigningKeysRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetSigningKeysResponse; +import studio.livepeer.livepeer.models.operations.async.UpdateSigningKeyRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.UpdateSigningKeyResponse; +import studio.livepeer.livepeer.operations.CreateSigningKey; +import studio.livepeer.livepeer.operations.DeleteSigningKey; +import studio.livepeer.livepeer.operations.GetSigningKey; +import studio.livepeer.livepeer.operations.GetSigningKeys; +import studio.livepeer.livepeer.operations.UpdateSigningKey; +import studio.livepeer.livepeer.utils.Headers; + +/** + * Operations related to access control/signing keys api + */ +public class AsyncAccessControl { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final AccessControl syncSDK; + + AsyncAccessControl(AccessControl syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public AccessControl sync() { + return syncSDK; + } + + + /** + * Create a signing key + * + *

The publicKey is a representation of the public key, encoded as base 64 and is passed as a string, + * and the privateKey is displayed only on creation. This is the only moment where the client can save + * the private key, otherwise it will be lost. Remember to decode your string when signing JWTs. + * Up to 10 signing keys can be generated, after that you must delete at least one signing key to + * create a new one. + * + * @return The async call builder + */ + public CreateSigningKeyRequestBuilder create() { + return new CreateSigningKeyRequestBuilder(sdkConfiguration); + } + + /** + * Create a signing key + * + *

The publicKey is a representation of the public key, encoded as base 64 and is passed as a string, + * and the privateKey is displayed only on creation. This is the only moment where the client can save + * the private key, otherwise it will be lost. Remember to decode your string when signing JWTs. + * Up to 10 signing keys can be generated, after that you must delete at least one signing key to + * create a new one. + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture createDirect() { + AsyncRequestlessOperation operation + = new CreateSigningKey.Async(sdkConfiguration, _headers); + return operation.doRequest() + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieves signing keys + * + * @return The async call builder + */ + public GetSigningKeysRequestBuilder getAll() { + return new GetSigningKeysRequestBuilder(sdkConfiguration); + } + + /** + * Retrieves signing keys + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getAllDirect() { + AsyncRequestlessOperation operation + = new GetSigningKeys.Async(sdkConfiguration, _headers); + return operation.doRequest() + .thenCompose(operation::handleResponse); + } + + + /** + * Delete Signing Key + * + * @return The async call builder + */ + public DeleteSigningKeyRequestBuilder delete() { + return new DeleteSigningKeyRequestBuilder(sdkConfiguration); + } + + /** + * Delete Signing Key + * + * @param keyId ID of the signing key + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture delete(String keyId) { + DeleteSigningKeyRequest request = + DeleteSigningKeyRequest + .builder() + .keyId(keyId) + .build(); + AsyncRequestOperation operation + = new DeleteSigningKey.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieves a signing key + * + * @return The async call builder + */ + public GetSigningKeyRequestBuilder get() { + return new GetSigningKeyRequestBuilder(sdkConfiguration); + } + + /** + * Retrieves a signing key + * + * @param keyId ID of the signing key + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture get(String keyId) { + GetSigningKeyRequest request = + GetSigningKeyRequest + .builder() + .keyId(keyId) + .build(); + AsyncRequestOperation operation + = new GetSigningKey.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Update a signing key + * + * @return The async call builder + */ + public UpdateSigningKeyRequestBuilder update() { + return new UpdateSigningKeyRequestBuilder(sdkConfiguration); + } + + /** + * Update a signing key + * + * @param keyId ID of the signing key + * @param requestBody + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture update(String keyId, UpdateSigningKeyRequestBody requestBody) { + UpdateSigningKeyRequest request = + UpdateSigningKeyRequest + .builder() + .keyId(keyId) + .requestBody(requestBody) + .build(); + AsyncRequestOperation operation + = new UpdateSigningKey.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/AsyncAsset.java b/src/main/java/studio/livepeer/livepeer/AsyncAsset.java new file mode 100644 index 00000000..15b9552e --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/AsyncAsset.java @@ -0,0 +1,351 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.models.components.AssetPatchPayload; +import studio.livepeer.livepeer.models.components.NewAssetFromUrlPayload; +import studio.livepeer.livepeer.models.components.NewAssetPayload; +import studio.livepeer.livepeer.models.operations.DeleteAssetRequest; +import studio.livepeer.livepeer.models.operations.GetAssetRequest; +import studio.livepeer.livepeer.models.operations.UpdateAssetRequest; +import studio.livepeer.livepeer.models.operations.async.DeleteAssetRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.DeleteAssetResponse; +import studio.livepeer.livepeer.models.operations.async.GetAssetRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetAssetResponse; +import studio.livepeer.livepeer.models.operations.async.GetAssetsRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetAssetsResponse; +import studio.livepeer.livepeer.models.operations.async.RequestUploadRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.RequestUploadResponse; +import studio.livepeer.livepeer.models.operations.async.UpdateAssetRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.UpdateAssetResponse; +import studio.livepeer.livepeer.models.operations.async.UploadAssetRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.UploadAssetResponse; +import studio.livepeer.livepeer.operations.DeleteAsset; +import studio.livepeer.livepeer.operations.GetAsset; +import studio.livepeer.livepeer.operations.GetAssets; +import studio.livepeer.livepeer.operations.RequestUpload; +import studio.livepeer.livepeer.operations.UpdateAsset; +import studio.livepeer.livepeer.operations.UploadAsset; +import studio.livepeer.livepeer.utils.Headers; + +/** + * Operations related to asset/vod api + */ +public class AsyncAsset { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final Asset syncSDK; + + AsyncAsset(Asset syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public Asset sync() { + return syncSDK; + } + + + /** + * Retrieve assets + * + * @return The async call builder + */ + public GetAssetsRequestBuilder getAll() { + return new GetAssetsRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve assets + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getAllDirect() { + AsyncRequestlessOperation operation + = new GetAssets.Async(sdkConfiguration, _headers); + return operation.doRequest() + .thenCompose(operation::handleResponse); + } + + + /** + * Upload an asset + * + *

To upload an asset, your first need to request for a direct upload URL + * and only then actually upload the contents of the asset. + * \ + * \ + * Once you created a upload link, you have 2 options, resumable or direct + * upload. For a more reliable experience, you should use resumable uploads + * which will work better for users with unreliable or slow network + * connections. If you want a simpler implementation though, you should + * just use a direct upload. + * + *

## Direct Upload + * For a direct upload, make a PUT request to the URL received in the url + * field of the response above, with the raw video file as the request + * body. response above: + * + *

## Resumable Upload + * Livepeer supports resumable uploads via Tus. This section provides a + * simple example of how to use tus-js-client to upload a video file. + * \ + * \ + * From the previous section, we generated a URL to upload a video file to + * Livepeer on POST /api/asset/request-upload. You should use the + * tusEndpoint field of the response to upload the video file and track the + * progress: + * + *

``` + * # This assumes there is an `input` element of `type="file"` with id + * `fileInput` in the HTML + * + *

const input = document.getElementById('fileInput'); + * + *

const file = input.files[0]; + * + *

const upload = new tus.Upload(file, { + * endpoint: tusEndpoint, // URL from `tusEndpoint` field in the + * `/request-upload` response + * metadata: { + * filename, + * filetype: 'video/mp4', + * }, + * uploadSize: file.size, + * onError(err) { + * console.error('Error uploading file:', err); + * }, + * onProgress(bytesUploaded, bytesTotal) { + * const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2); + * console.log('Uploaded ' + percentage + '%'); + * }, + * onSuccess() { + * console.log('Upload finished:', upload.url); + * }, + * }); + * + *

const previousUploads = await upload.findPreviousUploads(); + * + *

if (previousUploads.length > 0) { + * upload.resumeFromPreviousUpload(previousUploads[0]); + * } + * + *

upload.start(); + * + *

``` + * + *

> Note: If you are using tus from node.js, you need to add a custom URL + * storage to enable resuming from previous uploads. On the browser, this + * is enabled by default using local storage. In node.js, add urlStorage: + * new tus.FileUrlStorage("path/to/tmp/file"), to the UploadFile object + * definition above. + * + * @return The async call builder + */ + public RequestUploadRequestBuilder create() { + return new RequestUploadRequestBuilder(sdkConfiguration); + } + + /** + * Upload an asset + * + *

To upload an asset, your first need to request for a direct upload URL + * and only then actually upload the contents of the asset. + * \ + * \ + * Once you created a upload link, you have 2 options, resumable or direct + * upload. For a more reliable experience, you should use resumable uploads + * which will work better for users with unreliable or slow network + * connections. If you want a simpler implementation though, you should + * just use a direct upload. + * + *

## Direct Upload + * For a direct upload, make a PUT request to the URL received in the url + * field of the response above, with the raw video file as the request + * body. response above: + * + *

## Resumable Upload + * Livepeer supports resumable uploads via Tus. This section provides a + * simple example of how to use tus-js-client to upload a video file. + * \ + * \ + * From the previous section, we generated a URL to upload a video file to + * Livepeer on POST /api/asset/request-upload. You should use the + * tusEndpoint field of the response to upload the video file and track the + * progress: + * + *

``` + * # This assumes there is an `input` element of `type="file"` with id + * `fileInput` in the HTML + * + *

const input = document.getElementById('fileInput'); + * + *

const file = input.files[0]; + * + *

const upload = new tus.Upload(file, { + * endpoint: tusEndpoint, // URL from `tusEndpoint` field in the + * `/request-upload` response + * metadata: { + * filename, + * filetype: 'video/mp4', + * }, + * uploadSize: file.size, + * onError(err) { + * console.error('Error uploading file:', err); + * }, + * onProgress(bytesUploaded, bytesTotal) { + * const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2); + * console.log('Uploaded ' + percentage + '%'); + * }, + * onSuccess() { + * console.log('Upload finished:', upload.url); + * }, + * }); + * + *

const previousUploads = await upload.findPreviousUploads(); + * + *

if (previousUploads.length > 0) { + * upload.resumeFromPreviousUpload(previousUploads[0]); + * } + * + *

upload.start(); + * + *

``` + * + *

> Note: If you are using tus from node.js, you need to add a custom URL + * storage to enable resuming from previous uploads. On the browser, this + * is enabled by default using local storage. In node.js, add urlStorage: + * new tus.FileUrlStorage("path/to/tmp/file"), to the UploadFile object + * definition above. + * + * @param request The request object containing all the parameters for the API call. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture create(NewAssetPayload request) { + AsyncRequestOperation operation + = new RequestUpload.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Upload asset via URL + * + * @return The async call builder + */ + public UploadAssetRequestBuilder createViaUrl() { + return new UploadAssetRequestBuilder(sdkConfiguration); + } + + /** + * Upload asset via URL + * + * @param request The request object containing all the parameters for the API call. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture createViaUrl(NewAssetFromUrlPayload request) { + AsyncRequestOperation operation + = new UploadAsset.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieves an asset + * + * @return The async call builder + */ + public GetAssetRequestBuilder get() { + return new GetAssetRequestBuilder(sdkConfiguration); + } + + /** + * Retrieves an asset + * + * @param assetId ID of the asset + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture get(String assetId) { + GetAssetRequest request = + GetAssetRequest + .builder() + .assetId(assetId) + .build(); + AsyncRequestOperation operation + = new GetAsset.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Patch an asset + * + * @return The async call builder + */ + public UpdateAssetRequestBuilder update() { + return new UpdateAssetRequestBuilder(sdkConfiguration); + } + + /** + * Patch an asset + * + * @param assetId ID of the asset + * @param assetPatchPayload + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture update(String assetId, AssetPatchPayload assetPatchPayload) { + UpdateAssetRequest request = + UpdateAssetRequest + .builder() + .assetId(assetId) + .assetPatchPayload(assetPatchPayload) + .build(); + AsyncRequestOperation operation + = new UpdateAsset.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Delete an asset + * + * @return The async call builder + */ + public DeleteAssetRequestBuilder delete() { + return new DeleteAssetRequestBuilder(sdkConfiguration); + } + + /** + * Delete an asset + * + * @param assetId ID of the asset + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture delete(String assetId) { + DeleteAssetRequest request = + DeleteAssetRequest + .builder() + .assetId(assetId) + .build(); + AsyncRequestOperation operation + = new DeleteAsset.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/AsyncLivepeer.java b/src/main/java/studio/livepeer/livepeer/AsyncLivepeer.java new file mode 100644 index 00000000..58112e2b --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/AsyncLivepeer.java @@ -0,0 +1,153 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import studio.livepeer.livepeer.utils.Headers; + +/** + * Livepeer API Reference: Welcome to the Livepeer API reference docs. Here you will find all the + * endpoints exposed on the standard Livepeer API, learn how to use them and + * what they return. + */ +public class AsyncLivepeer { + private static final Headers _headers = Headers.EMPTY; + /** + * Operations related to livestream api + */ + private final AsyncStream stream; + /** + * Operations related to multistream api + */ + private final AsyncMultistream multistream; + /** + * Operations related to webhook api + */ + private final AsyncWebhook webhook; + /** + * Operations related to asset/vod api + */ + private final AsyncAsset asset; + /** + * Operations related to session api + */ + private final AsyncSession session; + /** + * Operations related to rooms api + */ + private final AsyncRoom room; + /** + * Operations related to metrics api + */ + private final AsyncMetrics metrics; + /** + * Operations related to access control/signing keys api + */ + private final AsyncAccessControl accessControl; + /** + * Operations related to tasks api + */ + private final AsyncTask task; + /** + * Operations related to transcode api + */ + private final AsyncTranscode transcode; + /** + * Operations related to playback api + */ + private final AsyncPlayback playback; + /** + * Operations related to livestream api + */ + public AsyncStream stream() { + return stream; + } + /** + * Operations related to multistream api + */ + public AsyncMultistream multistream() { + return multistream; + } + /** + * Operations related to webhook api + */ + public AsyncWebhook webhook() { + return webhook; + } + /** + * Operations related to asset/vod api + */ + public AsyncAsset asset() { + return asset; + } + /** + * Operations related to session api + */ + public AsyncSession session() { + return session; + } + /** + * Operations related to rooms api + */ + public AsyncRoom room() { + return room; + } + /** + * Operations related to metrics api + */ + public AsyncMetrics metrics() { + return metrics; + } + /** + * Operations related to access control/signing keys api + */ + public AsyncAccessControl accessControl() { + return accessControl; + } + /** + * Operations related to tasks api + */ + public AsyncTask task() { + return task; + } + /** + * Operations related to transcode api + */ + public AsyncTranscode transcode() { + return transcode; + } + /** + * Operations related to playback api + */ + public AsyncPlayback playback() { + return playback; + } + + private final SDKConfiguration sdkConfiguration; + private final Livepeer syncSDK; + + AsyncLivepeer(Livepeer syncSDK, SDKConfiguration sdkConfiguration) { + this.syncSDK = syncSDK; + this.sdkConfiguration = sdkConfiguration; + this.stream = new AsyncStream(syncSDK.stream(), sdkConfiguration); + this.multistream = new AsyncMultistream(syncSDK.multistream(), sdkConfiguration); + this.webhook = new AsyncWebhook(syncSDK.webhook(), sdkConfiguration); + this.asset = new AsyncAsset(syncSDK.asset(), sdkConfiguration); + this.session = new AsyncSession(syncSDK.session(), sdkConfiguration); + this.room = new AsyncRoom(syncSDK.room(), sdkConfiguration); + this.metrics = new AsyncMetrics(syncSDK.metrics(), sdkConfiguration); + this.accessControl = new AsyncAccessControl(syncSDK.accessControl(), sdkConfiguration); + this.task = new AsyncTask(syncSDK.task(), sdkConfiguration); + this.transcode = new AsyncTranscode(syncSDK.transcode(), sdkConfiguration); + this.playback = new AsyncPlayback(syncSDK.playback(), sdkConfiguration); + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public Livepeer sync() { + return syncSDK; + } +} diff --git a/src/main/java/studio/livepeer/livepeer/AsyncMetrics.java b/src/main/java/studio/livepeer/livepeer/AsyncMetrics.java new file mode 100644 index 00000000..069ee9e0 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/AsyncMetrics.java @@ -0,0 +1,229 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.models.operations.BreakdownBy; +import studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsRequest; +import studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsRequest; +import studio.livepeer.livepeer.models.operations.GetRealtimeViewershipNowRequest; +import studio.livepeer.livepeer.models.operations.GetUsageMetricsRequest; +import studio.livepeer.livepeer.models.operations.GetViewershipMetricsRequest; +import studio.livepeer.livepeer.models.operations.async.GetCreatorViewershipMetricsRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetCreatorViewershipMetricsResponse; +import studio.livepeer.livepeer.models.operations.async.GetPublicViewershipMetricsRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetPublicViewershipMetricsResponse; +import studio.livepeer.livepeer.models.operations.async.GetRealtimeViewershipNowRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetRealtimeViewershipNowResponse; +import studio.livepeer.livepeer.models.operations.async.GetUsageMetricsRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetUsageMetricsResponse; +import studio.livepeer.livepeer.models.operations.async.GetViewershipMetricsRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetViewershipMetricsResponse; +import studio.livepeer.livepeer.operations.GetCreatorViewershipMetrics; +import studio.livepeer.livepeer.operations.GetPublicViewershipMetrics; +import studio.livepeer.livepeer.operations.GetRealtimeViewershipNow; +import studio.livepeer.livepeer.operations.GetUsageMetrics; +import studio.livepeer.livepeer.operations.GetViewershipMetrics; +import studio.livepeer.livepeer.utils.Headers; + +/** + * Operations related to metrics api + */ +public class AsyncMetrics { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final Metrics syncSDK; + + AsyncMetrics(Metrics syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public Metrics sync() { + return syncSDK; + } + + + /** + * Query realtime viewership + * + *

Requires a private (non-CORS) API key to be used. + * + * @return The async call builder + */ + public GetRealtimeViewershipNowRequestBuilder getRealtimeViewership() { + return new GetRealtimeViewershipNowRequestBuilder(sdkConfiguration); + } + + /** + * Query realtime viewership + * + *

Requires a private (non-CORS) API key to be used. + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getRealtimeViewershipDirect() { + return getRealtimeViewership(Optional.empty(), Optional.empty(), Optional.empty()); + } + + /** + * Query realtime viewership + * + *

Requires a private (non-CORS) API key to be used. + * + * @param playbackId The playback ID to filter the query results. This can be a canonical + * playback ID from Livepeer assets or streams, or dStorage identifiers + * for assets + * + * @param creatorId The creator ID to filter the query results + * @param breakdownBy The list of fields to break down the query results. Specify this + * query-string multiple times to break down by multiple fields. + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getRealtimeViewership( + Optional playbackId, Optional creatorId, + Optional> breakdownBy) { + GetRealtimeViewershipNowRequest request = + GetRealtimeViewershipNowRequest + .builder() + .playbackId(playbackId) + .creatorId(creatorId) + .breakdownBy(breakdownBy) + .build(); + AsyncRequestOperation operation + = new GetRealtimeViewershipNow.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Query viewership metrics + * + *

Requires a private (non-CORS) API key to be used. + * + * @return The async call builder + */ + public GetViewershipMetricsRequestBuilder getViewership() { + return new GetViewershipMetricsRequestBuilder(sdkConfiguration); + } + + /** + * Query viewership metrics + * + *

Requires a private (non-CORS) API key to be used. + * + * @param request The request object containing all the parameters for the API call. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getViewership(GetViewershipMetricsRequest request) { + AsyncRequestOperation operation + = new GetViewershipMetrics.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Query creator viewership metrics + * + *

Requires a proof of ownership to be sent in the request, which for now is just the assetId or + * streamId parameters (1 of those must be in the query-string). + * + * @return The async call builder + */ + public GetCreatorViewershipMetricsRequestBuilder getCreatorViewership() { + return new GetCreatorViewershipMetricsRequestBuilder(sdkConfiguration); + } + + /** + * Query creator viewership metrics + * + *

Requires a proof of ownership to be sent in the request, which for now is just the assetId or + * streamId parameters (1 of those must be in the query-string). + * + * @param request The request object containing all the parameters for the API call. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getCreatorViewership(GetCreatorViewershipMetricsRequest request) { + AsyncRequestOperation operation + = new GetCreatorViewershipMetrics.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Query public total views metrics + * + *

Allows querying for the public metrics for viewership about a video. + * This can be called from the frontend with a CORS key, or even + * unauthenticated. + * + * @return The async call builder + */ + public GetPublicViewershipMetricsRequestBuilder getPublicViewership() { + return new GetPublicViewershipMetricsRequestBuilder(sdkConfiguration); + } + + /** + * Query public total views metrics + * + *

Allows querying for the public metrics for viewership about a video. + * This can be called from the frontend with a CORS key, or even + * unauthenticated. + * + * @param playbackId The playback ID to filter the query results. This can be a canonical + * playback ID from Livepeer assets or streams, or dStorage identifiers + * for assets + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getPublicViewership(String playbackId) { + GetPublicViewershipMetricsRequest request = + GetPublicViewershipMetricsRequest + .builder() + .playbackId(playbackId) + .build(); + AsyncRequestOperation operation + = new GetPublicViewershipMetrics.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Query usage metrics + * + * @return The async call builder + */ + public GetUsageMetricsRequestBuilder getUsage() { + return new GetUsageMetricsRequestBuilder(sdkConfiguration); + } + + /** + * Query usage metrics + * + * @param request The request object containing all the parameters for the API call. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getUsage(GetUsageMetricsRequest request) { + AsyncRequestOperation operation + = new GetUsageMetrics.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/AsyncMultistream.java b/src/main/java/studio/livepeer/livepeer/AsyncMultistream.java new file mode 100644 index 00000000..3193a321 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/AsyncMultistream.java @@ -0,0 +1,191 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.models.components.MultistreamTargetInput; +import studio.livepeer.livepeer.models.operations.DeleteMultistreamTargetRequest; +import studio.livepeer.livepeer.models.operations.GetMultistreamTargetRequest; +import studio.livepeer.livepeer.models.operations.UpdateMultistreamTargetRequest; +import studio.livepeer.livepeer.models.operations.async.CreateMultistreamTargetRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.CreateMultistreamTargetResponse; +import studio.livepeer.livepeer.models.operations.async.DeleteMultistreamTargetRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.DeleteMultistreamTargetResponse; +import studio.livepeer.livepeer.models.operations.async.GetMultistreamTargetRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetMultistreamTargetResponse; +import studio.livepeer.livepeer.models.operations.async.GetMultistreamTargetsRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetMultistreamTargetsResponse; +import studio.livepeer.livepeer.models.operations.async.UpdateMultistreamTargetRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.UpdateMultistreamTargetResponse; +import studio.livepeer.livepeer.operations.CreateMultistreamTarget; +import studio.livepeer.livepeer.operations.DeleteMultistreamTarget; +import studio.livepeer.livepeer.operations.GetMultistreamTarget; +import studio.livepeer.livepeer.operations.GetMultistreamTargets; +import studio.livepeer.livepeer.operations.UpdateMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; + +/** + * Operations related to multistream api + */ +public class AsyncMultistream { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final Multistream syncSDK; + + AsyncMultistream(Multistream syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public Multistream sync() { + return syncSDK; + } + + + /** + * Retrieve Multistream Targets + * + * @return The async call builder + */ + public GetMultistreamTargetsRequestBuilder getAll() { + return new GetMultistreamTargetsRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve Multistream Targets + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getAllDirect() { + AsyncRequestlessOperation operation + = new GetMultistreamTargets.Async(sdkConfiguration, _headers); + return operation.doRequest() + .thenCompose(operation::handleResponse); + } + + + /** + * Create a multistream target + * + * @return The async call builder + */ + public CreateMultistreamTargetRequestBuilder create() { + return new CreateMultistreamTargetRequestBuilder(sdkConfiguration); + } + + /** + * Create a multistream target + * + * @param request The request object containing all the parameters for the API call. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture create(MultistreamTargetInput request) { + AsyncRequestOperation operation + = new CreateMultistreamTarget.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieve a multistream target + * + * @return The async call builder + */ + public GetMultistreamTargetRequestBuilder get() { + return new GetMultistreamTargetRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve a multistream target + * + * @param id ID of the multistream target + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture get(String id) { + GetMultistreamTargetRequest request = + GetMultistreamTargetRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new GetMultistreamTarget.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Update Multistream Target + * + * @return The async call builder + */ + public UpdateMultistreamTargetRequestBuilder update() { + return new UpdateMultistreamTargetRequestBuilder(sdkConfiguration); + } + + /** + * Update Multistream Target + * + * @param id ID of the multistream target + * @param multistreamTarget + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture update(String id, MultistreamTargetInput multistreamTarget) { + UpdateMultistreamTargetRequest request = + UpdateMultistreamTargetRequest + .builder() + .id(id) + .multistreamTarget(multistreamTarget) + .build(); + AsyncRequestOperation operation + = new UpdateMultistreamTarget.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Delete a multistream target + * + *

Make sure to remove any references to the target on existing + * streams before actually deleting it from the API. + * + * @return The async call builder + */ + public DeleteMultistreamTargetRequestBuilder delete() { + return new DeleteMultistreamTargetRequestBuilder(sdkConfiguration); + } + + /** + * Delete a multistream target + * + *

Make sure to remove any references to the target on existing + * streams before actually deleting it from the API. + * + * @param id ID of the multistream target + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture delete(String id) { + DeleteMultistreamTargetRequest request = + DeleteMultistreamTargetRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new DeleteMultistreamTarget.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/AsyncPlayback.java b/src/main/java/studio/livepeer/livepeer/AsyncPlayback.java new file mode 100644 index 00000000..7faf9722 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/AsyncPlayback.java @@ -0,0 +1,66 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.models.operations.GetPlaybackInfoRequest; +import studio.livepeer.livepeer.models.operations.async.GetPlaybackInfoRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetPlaybackInfoResponse; +import studio.livepeer.livepeer.operations.GetPlaybackInfo; +import studio.livepeer.livepeer.utils.Headers; + +/** + * Operations related to playback api + */ +public class AsyncPlayback { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final Playback syncSDK; + + AsyncPlayback(Playback syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public Playback sync() { + return syncSDK; + } + + + /** + * Retrieve Playback Info + * + * @return The async call builder + */ + public GetPlaybackInfoRequestBuilder get() { + return new GetPlaybackInfoRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve Playback Info + * + * @param id The playback ID from the asset or livestream, e.g. `eaw4nk06ts2d0mzb`. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture get(String id) { + GetPlaybackInfoRequest request = + GetPlaybackInfoRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new GetPlaybackInfo.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/AsyncRoom.java b/src/main/java/studio/livepeer/livepeer/AsyncRoom.java new file mode 100644 index 00000000..6241cc35 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/AsyncRoom.java @@ -0,0 +1,392 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.Deprecated; +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.models.components.RoomEgressPayload; +import studio.livepeer.livepeer.models.components.RoomUserPayload; +import studio.livepeer.livepeer.models.components.RoomUserUpdatePayload; +import studio.livepeer.livepeer.models.operations.CreateRoomUserRequest; +import studio.livepeer.livepeer.models.operations.DeleteRoomRequest; +import studio.livepeer.livepeer.models.operations.DeleteRoomUserRequest; +import studio.livepeer.livepeer.models.operations.GetRoomRequest; +import studio.livepeer.livepeer.models.operations.GetRoomUserRequest; +import studio.livepeer.livepeer.models.operations.StartRoomEgressRequest; +import studio.livepeer.livepeer.models.operations.StopRoomEgressRequest; +import studio.livepeer.livepeer.models.operations.UpdateRoomUserRequest; +import studio.livepeer.livepeer.models.operations.async.CreateRoomRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.CreateRoomResponse; +import studio.livepeer.livepeer.models.operations.async.CreateRoomUserRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.CreateRoomUserResponse; +import studio.livepeer.livepeer.models.operations.async.DeleteRoomRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.DeleteRoomResponse; +import studio.livepeer.livepeer.models.operations.async.DeleteRoomUserRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.DeleteRoomUserResponse; +import studio.livepeer.livepeer.models.operations.async.GetRoomRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetRoomResponse; +import studio.livepeer.livepeer.models.operations.async.GetRoomUserRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetRoomUserResponse; +import studio.livepeer.livepeer.models.operations.async.StartRoomEgressRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.StartRoomEgressResponse; +import studio.livepeer.livepeer.models.operations.async.StopRoomEgressRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.StopRoomEgressResponse; +import studio.livepeer.livepeer.models.operations.async.UpdateRoomUserRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.UpdateRoomUserResponse; +import studio.livepeer.livepeer.operations.CreateRoom; +import studio.livepeer.livepeer.operations.CreateRoomUser; +import studio.livepeer.livepeer.operations.DeleteRoom; +import studio.livepeer.livepeer.operations.DeleteRoomUser; +import studio.livepeer.livepeer.operations.GetRoom; +import studio.livepeer.livepeer.operations.GetRoomUser; +import studio.livepeer.livepeer.operations.StartRoomEgress; +import studio.livepeer.livepeer.operations.StopRoomEgress; +import studio.livepeer.livepeer.operations.UpdateRoomUser; +import studio.livepeer.livepeer.utils.Headers; + +/** + * Operations related to rooms api + */ +public class AsyncRoom { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final Room syncSDK; + + AsyncRoom(Room syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public Room sync() { + return syncSDK; + } + + + /** + * Create a room + * + *

Create a multiparticipant livestreaming room. + * + * @return The async call builder + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public CreateRoomRequestBuilder create() { + return new CreateRoomRequestBuilder(sdkConfiguration); + } + + /** + * Create a room + * + *

Create a multiparticipant livestreaming room. + * + * @return {@code CompletableFuture} - The async response + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public CompletableFuture createDirect() { + AsyncRequestlessOperation operation + = new CreateRoom.Async(sdkConfiguration, _headers); + return operation.doRequest() + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieve a room + * + * @return The async call builder + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public GetRoomRequestBuilder get() { + return new GetRoomRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve a room + * + * @param id + * @return {@code CompletableFuture} - The async response + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public CompletableFuture get(String id) { + GetRoomRequest request = + GetRoomRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new GetRoom.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Delete a room + * + * @return The async call builder + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public DeleteRoomRequestBuilder delete() { + return new DeleteRoomRequestBuilder(sdkConfiguration); + } + + /** + * Delete a room + * + * @param id + * @return {@code CompletableFuture} - The async response + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public CompletableFuture delete(String id) { + DeleteRoomRequest request = + DeleteRoomRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new DeleteRoom.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Start room RTMP egress + * + *

Create a livestream for your room. + * This allows you to leverage livestreaming features like recording and HLS output. + * + * @return The async call builder + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public StartRoomEgressRequestBuilder startEgress() { + return new StartRoomEgressRequestBuilder(sdkConfiguration); + } + + /** + * Start room RTMP egress + * + *

Create a livestream for your room. + * This allows you to leverage livestreaming features like recording and HLS output. + * + * @param id + * @param roomEgressPayload + * @return {@code CompletableFuture} - The async response + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public CompletableFuture startEgress(String id, RoomEgressPayload roomEgressPayload) { + StartRoomEgressRequest request = + StartRoomEgressRequest + .builder() + .id(id) + .roomEgressPayload(roomEgressPayload) + .build(); + AsyncRequestOperation operation + = new StartRoomEgress.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Stop room RTMP egress + * + * @return The async call builder + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public StopRoomEgressRequestBuilder stopEgress() { + return new StopRoomEgressRequestBuilder(sdkConfiguration); + } + + /** + * Stop room RTMP egress + * + * @param id + * @return {@code CompletableFuture} - The async response + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public CompletableFuture stopEgress(String id) { + StopRoomEgressRequest request = + StopRoomEgressRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new StopRoomEgress.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Create a room user + * + *

Call this endpoint to add a user to a room, specifying a display name at a minimum. + * The response will contain a joining URL for Livepeer's default meeting app. + * Alternatively the joining token can be used with a custom app. + * + * @return The async call builder + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public CreateRoomUserRequestBuilder createUser() { + return new CreateRoomUserRequestBuilder(sdkConfiguration); + } + + /** + * Create a room user + * + *

Call this endpoint to add a user to a room, specifying a display name at a minimum. + * The response will contain a joining URL for Livepeer's default meeting app. + * Alternatively the joining token can be used with a custom app. + * + * @param id + * @param roomUserPayload + * @return {@code CompletableFuture} - The async response + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public CompletableFuture createUser(String id, RoomUserPayload roomUserPayload) { + CreateRoomUserRequest request = + CreateRoomUserRequest + .builder() + .id(id) + .roomUserPayload(roomUserPayload) + .build(); + AsyncRequestOperation operation + = new CreateRoomUser.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Get user details + * + * @return The async call builder + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public GetRoomUserRequestBuilder getUser() { + return new GetRoomUserRequestBuilder(sdkConfiguration); + } + + /** + * Get user details + * + * @param id + * @param userId + * @return {@code CompletableFuture} - The async response + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public CompletableFuture getUser(String id, String userId) { + GetRoomUserRequest request = + GetRoomUserRequest + .builder() + .id(id) + .userId(userId) + .build(); + AsyncRequestOperation operation + = new GetRoomUser.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Update a room user + * + *

Update properties for a user. + * + * @return The async call builder + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public UpdateRoomUserRequestBuilder updateUser() { + return new UpdateRoomUserRequestBuilder(sdkConfiguration); + } + + /** + * Update a room user + * + *

Update properties for a user. + * + * @param id + * @param userId + * @param roomUserUpdatePayload + * @return {@code CompletableFuture} - The async response + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public CompletableFuture updateUser( + String id, String userId, + RoomUserUpdatePayload roomUserUpdatePayload) { + UpdateRoomUserRequest request = + UpdateRoomUserRequest + .builder() + .id(id) + .userId(userId) + .roomUserUpdatePayload(roomUserUpdatePayload) + .build(); + AsyncRequestOperation operation + = new UpdateRoomUser.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Remove a user from the room + * + * @return The async call builder + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public DeleteRoomUserRequestBuilder deleteUser() { + return new DeleteRoomUserRequestBuilder(sdkConfiguration); + } + + /** + * Remove a user from the room + * + * @param id + * @param userId + * @return {@code CompletableFuture} - The async response + * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public CompletableFuture deleteUser(String id, String userId) { + DeleteRoomUserRequest request = + DeleteRoomUserRequest + .builder() + .id(id) + .userId(userId) + .build(); + AsyncRequestOperation operation + = new DeleteRoomUser.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/AsyncSession.java b/src/main/java/studio/livepeer/livepeer/AsyncSession.java new file mode 100644 index 00000000..9b12daa6 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/AsyncSession.java @@ -0,0 +1,172 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import java.lang.String; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.models.operations.GetRecordedSessionsRequest; +import studio.livepeer.livepeer.models.operations.GetSessionClipsRequest; +import studio.livepeer.livepeer.models.operations.GetSessionRequest; +import studio.livepeer.livepeer.models.operations.Record; +import studio.livepeer.livepeer.models.operations.async.GetRecordedSessionsRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetRecordedSessionsResponse; +import studio.livepeer.livepeer.models.operations.async.GetSessionClipsRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetSessionClipsResponse; +import studio.livepeer.livepeer.models.operations.async.GetSessionRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetSessionResponse; +import studio.livepeer.livepeer.models.operations.async.GetSessionsRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetSessionsResponse; +import studio.livepeer.livepeer.operations.GetRecordedSessions; +import studio.livepeer.livepeer.operations.GetSession; +import studio.livepeer.livepeer.operations.GetSessionClips; +import studio.livepeer.livepeer.operations.GetSessions; +import studio.livepeer.livepeer.utils.Headers; + +/** + * Operations related to session api + */ +public class AsyncSession { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final Session syncSDK; + + AsyncSession(Session syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public Session sync() { + return syncSDK; + } + + + /** + * Retrieve clips of a session + * + * @return The async call builder + */ + public GetSessionClipsRequestBuilder getClips() { + return new GetSessionClipsRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve clips of a session + * + * @param id ID of the parent session + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getClips(String id) { + GetSessionClipsRequest request = + GetSessionClipsRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new GetSessionClips.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieve sessions + * + * @return The async call builder + */ + public GetSessionsRequestBuilder getAll() { + return new GetSessionsRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve sessions + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getAllDirect() { + AsyncRequestlessOperation operation + = new GetSessions.Async(sdkConfiguration, _headers); + return operation.doRequest() + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieve a session + * + * @return The async call builder + */ + public GetSessionRequestBuilder get() { + return new GetSessionRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve a session + * + * @param id ID of the session + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture get(String id) { + GetSessionRequest request = + GetSessionRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new GetSession.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieve Recorded Sessions + * + * @return The async call builder + */ + public GetRecordedSessionsRequestBuilder getRecorded() { + return new GetRecordedSessionsRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve Recorded Sessions + * + * @param parentId ID of the parent stream + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getRecorded(String parentId) { + return getRecorded(parentId, Optional.empty()); + } + + /** + * Retrieve Recorded Sessions + * + * @param parentId ID of the parent stream + * @param record Flag indicating if the response should only include recorded + * sessions + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getRecorded(String parentId, Optional record) { + GetRecordedSessionsRequest request = + GetRecordedSessionsRequest + .builder() + .parentId(parentId) + .record(record) + .build(); + AsyncRequestOperation operation + = new GetRecordedSessions.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/AsyncStream.java b/src/main/java/studio/livepeer/livepeer/AsyncStream.java new file mode 100644 index 00000000..36b972e9 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/AsyncStream.java @@ -0,0 +1,466 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.models.components.ClipPayload; +import studio.livepeer.livepeer.models.components.NewStreamPayload; +import studio.livepeer.livepeer.models.components.StreamPatchPayload; +import studio.livepeer.livepeer.models.components.TargetAddPayload; +import studio.livepeer.livepeer.models.operations.AddMultistreamTargetRequest; +import studio.livepeer.livepeer.models.operations.DeleteStreamRequest; +import studio.livepeer.livepeer.models.operations.GetClipsRequest; +import studio.livepeer.livepeer.models.operations.GetStreamRequest; +import studio.livepeer.livepeer.models.operations.GetStreamsRequest; +import studio.livepeer.livepeer.models.operations.RemoveMultistreamTargetRequest; +import studio.livepeer.livepeer.models.operations.StartPullStreamRequest; +import studio.livepeer.livepeer.models.operations.TerminateStreamRequest; +import studio.livepeer.livepeer.models.operations.UpdateStreamRequest; +import studio.livepeer.livepeer.models.operations.async.AddMultistreamTargetRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.AddMultistreamTargetResponse; +import studio.livepeer.livepeer.models.operations.async.CreateClipRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.CreateClipResponse; +import studio.livepeer.livepeer.models.operations.async.CreateStreamRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.CreateStreamResponse; +import studio.livepeer.livepeer.models.operations.async.DeleteStreamRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.DeleteStreamResponse; +import studio.livepeer.livepeer.models.operations.async.GetClipsRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetClipsResponse; +import studio.livepeer.livepeer.models.operations.async.GetStreamRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetStreamResponse; +import studio.livepeer.livepeer.models.operations.async.GetStreamsRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetStreamsResponse; +import studio.livepeer.livepeer.models.operations.async.RemoveMultistreamTargetRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.RemoveMultistreamTargetResponse; +import studio.livepeer.livepeer.models.operations.async.StartPullStreamRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.StartPullStreamResponse; +import studio.livepeer.livepeer.models.operations.async.TerminateStreamRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.TerminateStreamResponse; +import studio.livepeer.livepeer.models.operations.async.UpdateStreamRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.UpdateStreamResponse; +import studio.livepeer.livepeer.operations.AddMultistreamTarget; +import studio.livepeer.livepeer.operations.CreateClip; +import studio.livepeer.livepeer.operations.CreateStream; +import studio.livepeer.livepeer.operations.DeleteStream; +import studio.livepeer.livepeer.operations.GetClips; +import studio.livepeer.livepeer.operations.GetStream; +import studio.livepeer.livepeer.operations.GetStreams; +import studio.livepeer.livepeer.operations.RemoveMultistreamTarget; +import studio.livepeer.livepeer.operations.StartPullStream; +import studio.livepeer.livepeer.operations.TerminateStream; +import studio.livepeer.livepeer.operations.UpdateStream; +import studio.livepeer.livepeer.utils.Headers; + +/** + * Operations related to livestream api + */ +public class AsyncStream { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final Stream syncSDK; + + AsyncStream(Stream syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public Stream sync() { + return syncSDK; + } + + + /** + * Create a stream + * + *

The only parameter you are required to set is the name of your stream, + * but we also highly recommend that you define transcoding profiles + * parameter that suits your specific broadcasting configuration. + * \ + * \ + * If you do not define transcoding rendition profiles when creating the + * stream, a default set of profiles will be used. These profiles include + * 240p, 360p, 480p and 720p. + * \ + * \ + * The playback policy is set to public by default for new streams. It can + * also be added upon the creation of a new stream by adding + * `"playbackPolicy": {"type": "jwt"}` + * + * @return The async call builder + */ + public CreateStreamRequestBuilder create() { + return new CreateStreamRequestBuilder(sdkConfiguration); + } + + /** + * Create a stream + * + *

The only parameter you are required to set is the name of your stream, + * but we also highly recommend that you define transcoding profiles + * parameter that suits your specific broadcasting configuration. + * \ + * \ + * If you do not define transcoding rendition profiles when creating the + * stream, a default set of profiles will be used. These profiles include + * 240p, 360p, 480p and 720p. + * \ + * \ + * The playback policy is set to public by default for new streams. It can + * also be added upon the creation of a new stream by adding + * `"playbackPolicy": {"type": "jwt"}` + * + * @param request The request object containing all the parameters for the API call. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture create(NewStreamPayload request) { + AsyncRequestOperation operation + = new CreateStream.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieve streams + * + * @return The async call builder + */ + public GetStreamsRequestBuilder getAll() { + return new GetStreamsRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve streams + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getAllDirect() { + return getAll(Optional.empty()); + } + + /** + * Retrieve streams + * + * @param streamsonly + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getAll(Optional streamsonly) { + GetStreamsRequest request = + GetStreamsRequest + .builder() + .streamsonly(streamsonly) + .build(); + AsyncRequestOperation operation + = new GetStreams.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieve a stream + * + * @return The async call builder + */ + public GetStreamRequestBuilder get() { + return new GetStreamRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve a stream + * + * @param id ID of the stream + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture get(String id) { + GetStreamRequest request = + GetStreamRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new GetStream.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Update a stream + * + * @return The async call builder + */ + public UpdateStreamRequestBuilder update() { + return new UpdateStreamRequestBuilder(sdkConfiguration); + } + + /** + * Update a stream + * + * @param id ID of the stream + * @param streamPatchPayload + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture update(String id, StreamPatchPayload streamPatchPayload) { + UpdateStreamRequest request = + UpdateStreamRequest + .builder() + .id(id) + .streamPatchPayload(streamPatchPayload) + .build(); + AsyncRequestOperation operation + = new UpdateStream.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Delete a stream + * + *

This will also suspend any active stream sessions, so make sure to wait + * until the stream has finished. To explicitly interrupt an active + * session, consider instead updating the suspended field in the stream + * using the PATCH stream API. + * + * @return The async call builder + */ + public DeleteStreamRequestBuilder delete() { + return new DeleteStreamRequestBuilder(sdkConfiguration); + } + + /** + * Delete a stream + * + *

This will also suspend any active stream sessions, so make sure to wait + * until the stream has finished. To explicitly interrupt an active + * session, consider instead updating the suspended field in the stream + * using the PATCH stream API. + * + * @param id ID of the stream + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture delete(String id) { + DeleteStreamRequest request = + DeleteStreamRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new DeleteStream.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Terminates a live stream + * + *

`DELETE /stream/{id}/terminate` can be used to terminate an ongoing + * session on a live stream. Unlike suspending the stream, it allows the + * streamer to restart streaming even immediately, but it will force + * terminate the current session and stop the recording. + * \ + * \ + * A 204 No Content status response indicates the stream was successfully + * terminated. + * + * @return The async call builder + */ + public TerminateStreamRequestBuilder terminate() { + return new TerminateStreamRequestBuilder(sdkConfiguration); + } + + /** + * Terminates a live stream + * + *

`DELETE /stream/{id}/terminate` can be used to terminate an ongoing + * session on a live stream. Unlike suspending the stream, it allows the + * streamer to restart streaming even immediately, but it will force + * terminate the current session and stop the recording. + * \ + * \ + * A 204 No Content status response indicates the stream was successfully + * terminated. + * + * @param id ID of the stream + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture terminate(String id) { + TerminateStreamRequest request = + TerminateStreamRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new TerminateStream.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Start ingest for a pull stream + * + *

`POST /stream/{id}/start-pull` can be used to start ingest for a stream + * configured with a pull source. If the stream has recording configured, + * it will also start recording. + * \ + * \ + * A 204 No Content status response indicates the stream was successfully + * started. + * + * @return The async call builder + */ + public StartPullStreamRequestBuilder startPull() { + return new StartPullStreamRequestBuilder(sdkConfiguration); + } + + /** + * Start ingest for a pull stream + * + *

`POST /stream/{id}/start-pull` can be used to start ingest for a stream + * configured with a pull source. If the stream has recording configured, + * it will also start recording. + * \ + * \ + * A 204 No Content status response indicates the stream was successfully + * started. + * + * @param id ID of the stream + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture startPull(String id) { + StartPullStreamRequest request = + StartPullStreamRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new StartPullStream.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Create a clip + * + * @return The async call builder + */ + public CreateClipRequestBuilder createClip() { + return new CreateClipRequestBuilder(sdkConfiguration); + } + + /** + * Create a clip + * + * @param request The request object containing all the parameters for the API call. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture createClip(ClipPayload request) { + AsyncRequestOperation operation + = new CreateClip.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieve clips of a livestream + * + * @return The async call builder + */ + public GetClipsRequestBuilder getClips() { + return new GetClipsRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve clips of a livestream + * + * @param id ID of the parent stream or playbackId of parent stream + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getClips(String id) { + GetClipsRequest request = + GetClipsRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new GetClips.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Add a multistream target + * + * @return The async call builder + */ + public AddMultistreamTargetRequestBuilder addMultistreamTarget() { + return new AddMultistreamTargetRequestBuilder(sdkConfiguration); + } + + /** + * Add a multistream target + * + * @param id ID of the parent stream + * @param targetAddPayload + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture addMultistreamTarget(String id, TargetAddPayload targetAddPayload) { + AddMultistreamTargetRequest request = + AddMultistreamTargetRequest + .builder() + .id(id) + .targetAddPayload(targetAddPayload) + .build(); + AsyncRequestOperation operation + = new AddMultistreamTarget.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Remove a multistream target + * + * @return The async call builder + */ + public RemoveMultistreamTargetRequestBuilder removeMultistreamTarget() { + return new RemoveMultistreamTargetRequestBuilder(sdkConfiguration); + } + + /** + * Remove a multistream target + * + * @param id ID of the parent stream + * @param targetId ID of the multistream target + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture removeMultistreamTarget(String id, String targetId) { + RemoveMultistreamTargetRequest request = + RemoveMultistreamTargetRequest + .builder() + .id(id) + .targetId(targetId) + .build(); + AsyncRequestOperation operation + = new RemoveMultistreamTarget.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/AsyncTask.java b/src/main/java/studio/livepeer/livepeer/AsyncTask.java new file mode 100644 index 00000000..203b267f --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/AsyncTask.java @@ -0,0 +1,92 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.models.operations.GetTaskRequest; +import studio.livepeer.livepeer.models.operations.async.GetTaskRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetTaskResponse; +import studio.livepeer.livepeer.models.operations.async.GetTasksRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetTasksResponse; +import studio.livepeer.livepeer.operations.GetTask; +import studio.livepeer.livepeer.operations.GetTasks; +import studio.livepeer.livepeer.utils.Headers; + +/** + * Operations related to tasks api + */ +public class AsyncTask { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final Task syncSDK; + + AsyncTask(Task syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public Task sync() { + return syncSDK; + } + + + /** + * Retrieve Tasks + * + * @return The async call builder + */ + public GetTasksRequestBuilder getAll() { + return new GetTasksRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve Tasks + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getAllDirect() { + AsyncRequestlessOperation operation + = new GetTasks.Async(sdkConfiguration, _headers); + return operation.doRequest() + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieve a Task + * + * @return The async call builder + */ + public GetTaskRequestBuilder get() { + return new GetTaskRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve a Task + * + * @param taskId ID of the task + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture get(String taskId) { + GetTaskRequest request = + GetTaskRequest + .builder() + .taskId(taskId) + .build(); + AsyncRequestOperation operation + = new GetTask.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/AsyncTranscode.java b/src/main/java/studio/livepeer/livepeer/AsyncTranscode.java new file mode 100644 index 00000000..e46f9431 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/AsyncTranscode.java @@ -0,0 +1,296 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.models.components.TranscodePayload; +import studio.livepeer.livepeer.models.operations.async.TranscodeVideoRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.TranscodeVideoResponse; +import studio.livepeer.livepeer.operations.TranscodeVideo; +import studio.livepeer.livepeer.utils.Headers; + +/** + * Operations related to transcode api + */ +public class AsyncTranscode { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final Transcode syncSDK; + + AsyncTranscode(Transcode syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public Transcode sync() { + return syncSDK; + } + + + /** + * Transcode a video + * + *

`POST /transcode` transcodes a video file and uploads the results to the + * specified storage service. + * \ + * \ + * Transcoding is asynchronous so you will need to check the status of the + * task in order to determine when transcoding is complete. The `id` field + * in the response is the unique ID for the transcoding `Task`. The task + * status can be queried using the [GET tasks + * endpoint](https://docs.livepeer.org/reference/api/get-tasks): + * \ + * \ + * When `status.phase` is `completed`, transcoding will be complete and + * the results will be stored in the storage service and the specified + * output location. + * \ + * \ + * The results will be available under `params.outputs.hls.path` and + * `params.outputs.mp4.path` in the specified storage service. + * ## Input + * \ + * This endpoint currently supports the following inputs: + * - HTTP + * - S3 API Compatible Service + * \ + * \ + * **HTTP** + * \ + * A public HTTP URL can be used to read a video file. + * ```json + * { + * "url": "https://www.example.com/video.mp4" + * } + * ``` + * | Name | Type | Description | + * | ---- | ------ | ------------------------------------ | + * | url | string | A public HTTP URL for the video file. | + * + *

Note: For IPFS HTTP gateway URLs, the API currently only supports “path + * style” URLs and does not support “subdomain style” URLs. The API will + * support both styles of URLs in a future update. + * \ + * \ + * **S3 API Compatible Service** + * \ + * \ + * S3 credentials can be used to authenticate with a S3 API compatible + * service to read a video file. + * + *

```json + * { + * "type": "s3", + * "endpoint": "https://gateway.storjshare.io", + * "credentials": { + * "accessKeyId": "$ACCESS_KEY_ID", + * "secretAccessKey": "$SECRET_ACCESS_KEY" + * }, + * "bucket": "inbucket", + * "path": "/video/source.mp4" + * } + * ``` + * + *

## Storage + * \ + * This endpoint currently supports the following storage services: + * - S3 API Compatible Service + * - Web3 Storage + * \ + * \ + * **S3 API Compatible Service** + * ```json + * { + * "type": "s3", + * "endpoint": "https://gateway.storjshare.io", + * "credentials": { + * "accessKeyId": "$ACCESS_KEY_ID", + * "secretAccessKey": "$SECRET_ACCESS_KEY" + * }, + * "bucket": "mybucket" + * } + * ``` + * + *

**Web3 Storage** + * + *

```json + * { + * "type": "web3.storage", + * "credentials": { + * "proof": "$UCAN_DELEGATION_PROOF", + * } + * } + * ``` + * + *

## Outputs + * \ + * This endpoint currently supports the following output types: + * - HLS + * - MP4 + * + *

**HLS** + * + *

```json + * { + * "hls": { + * "path": "/samplevideo/hls" + * } + * } + * ``` + * + *

**MP4** + * + *

```json + * { + * "mp4": { + * "path": "/samplevideo/mp4" + * } + * } + * ``` + * + * @return The async call builder + */ + public TranscodeVideoRequestBuilder create() { + return new TranscodeVideoRequestBuilder(sdkConfiguration); + } + + /** + * Transcode a video + * + *

`POST /transcode` transcodes a video file and uploads the results to the + * specified storage service. + * \ + * \ + * Transcoding is asynchronous so you will need to check the status of the + * task in order to determine when transcoding is complete. The `id` field + * in the response is the unique ID for the transcoding `Task`. The task + * status can be queried using the [GET tasks + * endpoint](https://docs.livepeer.org/reference/api/get-tasks): + * \ + * \ + * When `status.phase` is `completed`, transcoding will be complete and + * the results will be stored in the storage service and the specified + * output location. + * \ + * \ + * The results will be available under `params.outputs.hls.path` and + * `params.outputs.mp4.path` in the specified storage service. + * ## Input + * \ + * This endpoint currently supports the following inputs: + * - HTTP + * - S3 API Compatible Service + * \ + * \ + * **HTTP** + * \ + * A public HTTP URL can be used to read a video file. + * ```json + * { + * "url": "https://www.example.com/video.mp4" + * } + * ``` + * | Name | Type | Description | + * | ---- | ------ | ------------------------------------ | + * | url | string | A public HTTP URL for the video file. | + * + *

Note: For IPFS HTTP gateway URLs, the API currently only supports “path + * style” URLs and does not support “subdomain style” URLs. The API will + * support both styles of URLs in a future update. + * \ + * \ + * **S3 API Compatible Service** + * \ + * \ + * S3 credentials can be used to authenticate with a S3 API compatible + * service to read a video file. + * + *

```json + * { + * "type": "s3", + * "endpoint": "https://gateway.storjshare.io", + * "credentials": { + * "accessKeyId": "$ACCESS_KEY_ID", + * "secretAccessKey": "$SECRET_ACCESS_KEY" + * }, + * "bucket": "inbucket", + * "path": "/video/source.mp4" + * } + * ``` + * + *

## Storage + * \ + * This endpoint currently supports the following storage services: + * - S3 API Compatible Service + * - Web3 Storage + * \ + * \ + * **S3 API Compatible Service** + * ```json + * { + * "type": "s3", + * "endpoint": "https://gateway.storjshare.io", + * "credentials": { + * "accessKeyId": "$ACCESS_KEY_ID", + * "secretAccessKey": "$SECRET_ACCESS_KEY" + * }, + * "bucket": "mybucket" + * } + * ``` + * + *

**Web3 Storage** + * + *

```json + * { + * "type": "web3.storage", + * "credentials": { + * "proof": "$UCAN_DELEGATION_PROOF", + * } + * } + * ``` + * + *

## Outputs + * \ + * This endpoint currently supports the following output types: + * - HLS + * - MP4 + * + *

**HLS** + * + *

```json + * { + * "hls": { + * "path": "/samplevideo/hls" + * } + * } + * ``` + * + *

**MP4** + * + *

```json + * { + * "mp4": { + * "path": "/samplevideo/mp4" + * } + * } + * ``` + * + * @param request The request object containing all the parameters for the API call. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture create(TranscodePayload request) { + AsyncRequestOperation operation + = new TranscodeVideo.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/AsyncWebhook.java b/src/main/java/studio/livepeer/livepeer/AsyncWebhook.java new file mode 100644 index 00000000..db15c81b --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/AsyncWebhook.java @@ -0,0 +1,299 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.models.components.WebhookInput; +import studio.livepeer.livepeer.models.operations.DeleteWebhookRequest; +import studio.livepeer.livepeer.models.operations.GetWebhookLogRequest; +import studio.livepeer.livepeer.models.operations.GetWebhookLogsRequest; +import studio.livepeer.livepeer.models.operations.GetWebhookRequest; +import studio.livepeer.livepeer.models.operations.ResendWebhookRequest; +import studio.livepeer.livepeer.models.operations.UpdateWebhookRequest; +import studio.livepeer.livepeer.models.operations.async.CreateWebhookRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.CreateWebhookResponse; +import studio.livepeer.livepeer.models.operations.async.DeleteWebhookRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.DeleteWebhookResponse; +import studio.livepeer.livepeer.models.operations.async.GetWebhookLogRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetWebhookLogResponse; +import studio.livepeer.livepeer.models.operations.async.GetWebhookLogsRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetWebhookLogsResponse; +import studio.livepeer.livepeer.models.operations.async.GetWebhookRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetWebhookResponse; +import studio.livepeer.livepeer.models.operations.async.GetWebhooksRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.GetWebhooksResponse; +import studio.livepeer.livepeer.models.operations.async.ResendWebhookRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.ResendWebhookResponse; +import studio.livepeer.livepeer.models.operations.async.UpdateWebhookRequestBuilder; +import studio.livepeer.livepeer.models.operations.async.UpdateWebhookResponse; +import studio.livepeer.livepeer.operations.CreateWebhook; +import studio.livepeer.livepeer.operations.DeleteWebhook; +import studio.livepeer.livepeer.operations.GetWebhook; +import studio.livepeer.livepeer.operations.GetWebhookLog; +import studio.livepeer.livepeer.operations.GetWebhookLogs; +import studio.livepeer.livepeer.operations.GetWebhooks; +import studio.livepeer.livepeer.operations.ResendWebhook; +import studio.livepeer.livepeer.operations.UpdateWebhook; +import studio.livepeer.livepeer.utils.Headers; + +/** + * Operations related to webhook api + */ +public class AsyncWebhook { + private static final Headers _headers = Headers.EMPTY; + private final SDKConfiguration sdkConfiguration; + private final Webhook syncSDK; + + AsyncWebhook(Webhook syncSDK, SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.syncSDK = syncSDK; + } + + /** + * Switches to the sync SDK. + * + * @return The sync SDK + */ + public Webhook sync() { + return syncSDK; + } + + + /** + * Retrieve a Webhook + * + * @return The async call builder + */ + public GetWebhooksRequestBuilder getAll() { + return new GetWebhooksRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve a Webhook + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getAllDirect() { + AsyncRequestlessOperation operation + = new GetWebhooks.Async(sdkConfiguration, _headers); + return operation.doRequest() + .thenCompose(operation::handleResponse); + } + + + /** + * Create a webhook + * + *

To create a new webhook, you need to make an API call with the events you want to listen for and the + * URL that will be called when those events occur. + * + * @return The async call builder + */ + public CreateWebhookRequestBuilder create() { + return new CreateWebhookRequestBuilder(sdkConfiguration); + } + + /** + * Create a webhook + * + *

To create a new webhook, you need to make an API call with the events you want to listen for and the + * URL that will be called when those events occur. + * + * @param request The request object containing all the parameters for the API call. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture create(WebhookInput request) { + AsyncRequestOperation operation + = new CreateWebhook.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieve a webhook + * + * @return The async call builder + */ + public GetWebhookRequestBuilder get() { + return new GetWebhookRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve a webhook + * + * @param id + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture get(String id) { + GetWebhookRequest request = + GetWebhookRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new GetWebhook.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Update a webhook + * + * @return The async call builder + */ + public UpdateWebhookRequestBuilder update() { + return new UpdateWebhookRequestBuilder(sdkConfiguration); + } + + /** + * Update a webhook + * + * @param id + * @param webhook + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture update(String id, WebhookInput webhook) { + UpdateWebhookRequest request = + UpdateWebhookRequest + .builder() + .id(id) + .webhook(webhook) + .build(); + AsyncRequestOperation operation + = new UpdateWebhook.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Delete a webhook + * + * @return The async call builder + */ + public DeleteWebhookRequestBuilder delete() { + return new DeleteWebhookRequestBuilder(sdkConfiguration); + } + + /** + * Delete a webhook + * + * @param id + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture delete(String id) { + DeleteWebhookRequest request = + DeleteWebhookRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new DeleteWebhook.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieve webhook logs + * + * @return The async call builder + */ + public GetWebhookLogsRequestBuilder getLogs() { + return new GetWebhookLogsRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve webhook logs + * + * @param id + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getLogs(String id) { + GetWebhookLogsRequest request = + GetWebhookLogsRequest + .builder() + .id(id) + .build(); + AsyncRequestOperation operation + = new GetWebhookLogs.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Retrieve a webhook log + * + * @return The async call builder + */ + public GetWebhookLogRequestBuilder getLog() { + return new GetWebhookLogRequestBuilder(sdkConfiguration); + } + + /** + * Retrieve a webhook log + * + * @param id + * @param logId + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getLog(String id, String logId) { + GetWebhookLogRequest request = + GetWebhookLogRequest + .builder() + .id(id) + .logId(logId) + .build(); + AsyncRequestOperation operation + = new GetWebhookLog.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + + + /** + * Resend a webhook + * + *

Use this API to resend the same webhook request. This is useful when + * developing and debugging, allowing you to easily repeat the same webhook + * to check or fix the behaviour in your handler. + * + * @return The async call builder + */ + public ResendWebhookRequestBuilder resendLog() { + return new ResendWebhookRequestBuilder(sdkConfiguration); + } + + /** + * Resend a webhook + * + *

Use this API to resend the same webhook request. This is useful when + * developing and debugging, allowing you to easily repeat the same webhook + * to check or fix the behaviour in your handler. + * + * @param id + * @param logId + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture resendLog(String id, String logId) { + ResendWebhookRequest request = + ResendWebhookRequest + .builder() + .id(id) + .logId(logId) + .build(); + AsyncRequestOperation operation + = new ResendWebhook.Async(sdkConfiguration, _headers); + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/Livepeer.java b/src/main/java/studio/livepeer/livepeer/Livepeer.java index 9a962cc9..ce6f676d 100644 --- a/src/main/java/studio/livepeer/livepeer/Livepeer.java +++ b/src/main/java/studio/livepeer/livepeer/Livepeer.java @@ -7,24 +7,28 @@ import java.lang.String; import java.util.Map; import java.util.Optional; -import studio.livepeer.livepeer.models.operations.SDKMethodInterfaces.*; +import java.util.function.Consumer; import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.SdkInitData; import studio.livepeer.livepeer.utils.RetryConfig; import studio.livepeer.livepeer.utils.SpeakeasyHTTPClient; +import studio.livepeer.livepeer.utils.Utils; /** * Livepeer API Reference: Welcome to the Livepeer API reference docs. Here you will find all the * endpoints exposed on the standard Livepeer API, learn how to use them and * what they return. - * */ public class Livepeer { + private static final Headers _headers = Headers.EMPTY; /** * SERVERS contains the list of server urls available to the SDK. */ public static final String[] SERVERS = { + "https://livepeer.studio/api", }; @@ -159,8 +163,7 @@ public Transcode transcode() { public Playback playback() { return playback; } - - private final SDKConfiguration sdkConfiguration; + private final AsyncLivepeer asyncSDK; /** * The Builder class allows the configuration of a new instance of the SDK. @@ -168,6 +171,9 @@ public Playback playback() { public static class Builder { private final SDKConfiguration sdkConfiguration = new SDKConfiguration(); + private String serverUrl; + private String server; + private Builder() { } @@ -179,7 +185,7 @@ private Builder() { * @return The builder instance. */ public Builder client(HTTPClient client) { - this.sdkConfiguration.defaultClient = client; + this.sdkConfiguration.setClient(client); return this; } /** @@ -189,19 +195,21 @@ public Builder client(HTTPClient client) { * @return The builder instance. */ public Builder apiKey(String apiKey) { - this.sdkConfiguration.securitySource = SecuritySource.of(studio.livepeer.livepeer.models.components.Security.builder() + this.sdkConfiguration.setSecuritySource(SecuritySource.of(studio.livepeer.livepeer.models.components.Security.builder() .apiKey(apiKey) - .build()); + .build())); return this; } /** * Configures the SDK to use a custom security source. + * * @param securitySource The security source to use for all requests. * @return The builder instance. */ public Builder securitySource(SecuritySource securitySource) { - this.sdkConfiguration.securitySource = securitySource; + Utils.checkNotNull(securitySource, "securitySource"); + this.sdkConfiguration.setSecuritySource(securitySource); return this; } @@ -212,19 +220,19 @@ public Builder securitySource(SecuritySource securitySource) { * @return The builder instance. */ public Builder serverURL(String serverUrl) { - this.sdkConfiguration.serverUrl = serverUrl; + this.serverUrl = serverUrl; return this; } /** - * Overrides the default server URL with a templated URL populated with the provided parameters. + * Overrides the default server URL with a templated URL populated with the provided parameters. * * @param serverUrl The server URL to use for all requests. * @param params The parameters to use when templating the URL. * @return The builder instance. */ public Builder serverURL(String serverUrl, Map params) { - this.sdkConfiguration.serverUrl = studio.livepeer.livepeer.utils.Utils.templateUrl(serverUrl, params); + this.serverUrl = Utils.templateUrl(serverUrl, params); return this; } @@ -235,8 +243,8 @@ public Builder serverURL(String serverUrl, Map params) { * @return The builder instance. */ public Builder serverIndex(int serverIdx) { - this.sdkConfiguration.serverIdx = serverIdx; - this.sdkConfiguration.serverUrl = SERVERS[serverIdx]; + this.sdkConfiguration.setServerIdx(serverIdx); + this.serverUrl= SERVERS[serverIdx]; return this; } @@ -247,46 +255,64 @@ public Builder serverIndex(int serverIdx) { * @return The builder instance. */ public Builder retryConfig(RetryConfig retryConfig) { - this.sdkConfiguration.retryConfig = Optional.of(retryConfig); + this.sdkConfiguration.setRetryConfig(Optional.of(retryConfig)); + return this; + } + + /** + * Enables debug logging for HTTP requests and responses, including JSON body content. + *

+ * Convenience method that calls {@link HTTPClient#enableDebugLogging(boolean)}. + * {@link SpeakeasyHTTPClient} honors this setting. If you are using a custom HTTP client, + * it is up to the custom client to honor this setting. + *

+ * + * @param enabled Whether to enable debug logging. + * @return The builder instance. + */ + public Builder enableHTTPDebugLogging(boolean enabled) { + this.sdkConfiguration.client().enableDebugLogging(enabled); return this; } - // Visible for testing, will be accessed via reflection - void _hooks(studio.livepeer.livepeer.utils.Hooks hooks) { - sdkConfiguration.setHooks(hooks); + + // Visible for testing, may be accessed via reflection in tests + Builder _hooks(studio.livepeer.livepeer.utils.Hooks hooks) { + sdkConfiguration.setHooks(hooks); + return this; } + // Visible for testing, may be accessed via reflection in tests + Builder _hooks(Consumer consumer) { + consumer.accept(sdkConfiguration.hooks()); + return this; + } + /** * Builds a new instance of the SDK. + * * @return The SDK instance. */ public Livepeer build() { - if (sdkConfiguration.defaultClient == null) { - sdkConfiguration.defaultClient = new SpeakeasyHTTPClient(); - } - if (sdkConfiguration.securitySource == null) { - sdkConfiguration.securitySource = SecuritySource.of(null); - } - if (sdkConfiguration.serverUrl == null || sdkConfiguration.serverUrl.isBlank()) { - sdkConfiguration.serverUrl = SERVERS[0]; - sdkConfiguration.serverIdx = 0; - } - if (sdkConfiguration.serverUrl.endsWith("/")) { - sdkConfiguration.serverUrl = sdkConfiguration.serverUrl.substring(0, sdkConfiguration.serverUrl.length() - 1); + if (serverUrl == null || serverUrl.isBlank()) { + serverUrl = SERVERS[0]; + sdkConfiguration.setServerIdx(0); } + sdkConfiguration.setServerUrl(serverUrl); return new Livepeer(sdkConfiguration); } } - + /** * Get a new instance of the SDK builder to configure a new instance of the SDK. + * * @return The SDK builder instance. */ public static Builder builder() { return new Builder(); } - private Livepeer(SDKConfiguration sdkConfiguration) { - this.sdkConfiguration = sdkConfiguration; + public Livepeer(SDKConfiguration sdkConfiguration) { + sdkConfiguration.initialize(); this.stream = new Stream(sdkConfiguration); this.multistream = new Multistream(sdkConfiguration); this.webhook = new Webhook(sdkConfiguration); @@ -298,5 +324,22 @@ private Livepeer(SDKConfiguration sdkConfiguration) { this.task = new Task(sdkConfiguration); this.transcode = new Transcode(sdkConfiguration); this.playback = new Playback(sdkConfiguration); - this.sdkConfiguration.initialize(); - }} + SdkInitData data = sdkConfiguration.hooks().sdkInit( + new SdkInitData( + sdkConfiguration.resolvedServerUrl(), + sdkConfiguration.client())); + sdkConfiguration.setServerUrl(data.baseUrl()); + sdkConfiguration.setClient(data.client()); + this.asyncSDK = new AsyncLivepeer(this, sdkConfiguration); + } + + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncLivepeer async() { + return asyncSDK; + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/Metrics.java b/src/main/java/studio/livepeer/livepeer/Metrics.java index 6f1c074c..2a79ab41 100644 --- a/src/main/java/studio/livepeer/livepeer/Metrics.java +++ b/src/main/java/studio/livepeer/livepeer/Metrics.java @@ -1,27 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; -import com.fasterxml.jackson.core.type.TypeReference; -import java.io.InputStream; -import java.lang.Exception; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; import java.util.List; import java.util.Optional; -import studio.livepeer.livepeer.models.components.RealtimeViewershipMetric; -import studio.livepeer.livepeer.models.components.UsageMetric; -import studio.livepeer.livepeer.models.components.ViewershipMetric; -import studio.livepeer.livepeer.models.errors.Error; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.BreakdownBy; import studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsRequest; import studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsRequestBuilder; import studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsResponse; -import studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsData; import studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsRequest; import studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsRequestBuilder; import studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsResponse; @@ -34,71 +24,77 @@ import studio.livepeer.livepeer.models.operations.GetViewershipMetricsRequest; import studio.livepeer.livepeer.models.operations.GetViewershipMetricsRequestBuilder; import studio.livepeer.livepeer.models.operations.GetViewershipMetricsResponse; -import studio.livepeer.livepeer.models.operations.SDKMethodInterfaces.*; -import studio.livepeer.livepeer.utils.HTTPClient; -import studio.livepeer.livepeer.utils.HTTPRequest; -import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; -import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; -import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; -import studio.livepeer.livepeer.utils.Utils; +import studio.livepeer.livepeer.operations.GetCreatorViewershipMetrics; +import studio.livepeer.livepeer.operations.GetPublicViewershipMetrics; +import studio.livepeer.livepeer.operations.GetRealtimeViewershipNow; +import studio.livepeer.livepeer.operations.GetUsageMetrics; +import studio.livepeer.livepeer.operations.GetViewershipMetrics; +import studio.livepeer.livepeer.utils.Headers; /** * Operations related to metrics api */ -public class Metrics implements - MethodCallGetRealtimeViewershipNow, - MethodCallGetViewershipMetrics, - MethodCallGetCreatorViewershipMetrics, - MethodCallGetPublicViewershipMetrics, - MethodCallGetUsageMetrics { - +public class Metrics { + private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; + private final AsyncMetrics asyncSDK; Metrics(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncMetrics(this, sdkConfiguration); } + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncMetrics async() { + return asyncSDK; + } /** * Query realtime viewership - * Requires a private (non-CORS) API key to be used. + * + *

Requires a private (non-CORS) API key to be used. * * @return The call builder */ public GetRealtimeViewershipNowRequestBuilder getRealtimeViewership() { - return new GetRealtimeViewershipNowRequestBuilder(this); + return new GetRealtimeViewershipNowRequestBuilder(sdkConfiguration); } /** * Query realtime viewership - * Requires a private (non-CORS) API key to be used. + * + *

Requires a private (non-CORS) API key to be used. * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetRealtimeViewershipNowResponse getRealtimeViewershipDirect() throws Exception { + public GetRealtimeViewershipNowResponse getRealtimeViewershipDirect() { return getRealtimeViewership(Optional.empty(), Optional.empty(), Optional.empty()); } - + /** * Query realtime viewership - * Requires a private (non-CORS) API key to be used. + * + *

Requires a private (non-CORS) API key to be used. * * @param playbackId The playback ID to filter the query results. This can be a canonical - playback ID from Livepeer assets or streams, or dStorage identifiers - for assets - + * playback ID from Livepeer assets or streams, or dStorage identifiers + * for assets + * * @param creatorId The creator ID to filter the query results * @param breakdownBy The list of fields to break down the query results. Specify this - query-string multiple times to break down by multiple fields. - + * query-string multiple times to break down by multiple fields. + * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ public GetRealtimeViewershipNowResponse getRealtimeViewership( - Optional playbackId, - Optional creatorId, - Optional> breakdownBy) throws Exception { + Optional playbackId, Optional creatorId, + Optional> breakdownBy) { GetRealtimeViewershipNowRequest request = GetRealtimeViewershipNowRequest .builder() @@ -106,679 +102,123 @@ public GetRealtimeViewershipNowResponse getRealtimeViewership( .creatorId(creatorId) .breakdownBy(breakdownBy) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/data/views/now"); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - _req.addQueryParams(Utils.getQueryParams( - GetRealtimeViewershipNowRequest.class, - request, - null)); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getRealtimeViewershipNow", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getRealtimeViewershipNow", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getRealtimeViewershipNow", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getRealtimeViewershipNow", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetRealtimeViewershipNowResponse.Builder _resBuilder = - GetRealtimeViewershipNowResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetRealtimeViewershipNowResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetRealtimeViewershipNow.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Query viewership metrics - * Requires a private (non-CORS) API key to be used. + * + *

Requires a private (non-CORS) API key to be used. * * @return The call builder */ public GetViewershipMetricsRequestBuilder getViewership() { - return new GetViewershipMetricsRequestBuilder(this); + return new GetViewershipMetricsRequestBuilder(sdkConfiguration); } /** * Query viewership metrics - * Requires a private (non-CORS) API key to be used. * - * @param request The request object containing all of the parameters for the API call. + *

Requires a private (non-CORS) API key to be used. + * + * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetViewershipMetricsResponse getViewership( - GetViewershipMetricsRequest request) throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/data/views/query"); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - _req.addQueryParams(Utils.getQueryParams( - GetViewershipMetricsRequest.class, - request, - null)); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getViewershipMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getViewershipMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getViewershipMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getViewershipMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetViewershipMetricsResponse.Builder _resBuilder = - GetViewershipMetricsResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetViewershipMetricsResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public GetViewershipMetricsResponse getViewership(GetViewershipMetricsRequest request) { + RequestOperation operation + = new GetViewershipMetrics.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Query creator viewership metrics - * Requires a proof of ownership to be sent in the request, which for now is just the assetId or streamId parameters (1 of those must be in the query-string). + * + *

Requires a proof of ownership to be sent in the request, which for now is just the assetId or + * streamId parameters (1 of those must be in the query-string). * * @return The call builder */ public GetCreatorViewershipMetricsRequestBuilder getCreatorViewership() { - return new GetCreatorViewershipMetricsRequestBuilder(this); + return new GetCreatorViewershipMetricsRequestBuilder(sdkConfiguration); } /** * Query creator viewership metrics - * Requires a proof of ownership to be sent in the request, which for now is just the assetId or streamId parameters (1 of those must be in the query-string). * - * @param request The request object containing all of the parameters for the API call. + *

Requires a proof of ownership to be sent in the request, which for now is just the assetId or + * streamId parameters (1 of those must be in the query-string). + * + * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetCreatorViewershipMetricsResponse getCreatorViewership( - GetCreatorViewershipMetricsRequest request) throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/data/views/query/creator"); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - _req.addQueryParams(Utils.getQueryParams( - GetCreatorViewershipMetricsRequest.class, - request, - null)); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getCreatorViewershipMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getCreatorViewershipMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getCreatorViewershipMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getCreatorViewershipMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetCreatorViewershipMetricsResponse.Builder _resBuilder = - GetCreatorViewershipMetricsResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetCreatorViewershipMetricsResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public GetCreatorViewershipMetricsResponse getCreatorViewership(GetCreatorViewershipMetricsRequest request) { + RequestOperation operation + = new GetCreatorViewershipMetrics.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Query public total views metrics - * Allows querying for the public metrics for viewership about a video. + * + *

Allows querying for the public metrics for viewership about a video. * This can be called from the frontend with a CORS key, or even * unauthenticated. * * @return The call builder */ public GetPublicViewershipMetricsRequestBuilder getPublicViewership() { - return new GetPublicViewershipMetricsRequestBuilder(this); + return new GetPublicViewershipMetricsRequestBuilder(sdkConfiguration); } /** * Query public total views metrics - * Allows querying for the public metrics for viewership about a video. + * + *

Allows querying for the public metrics for viewership about a video. * This can be called from the frontend with a CORS key, or even * unauthenticated. * * @param playbackId The playback ID to filter the query results. This can be a canonical - playback ID from Livepeer assets or streams, or dStorage identifiers - for assets - + * playback ID from Livepeer assets or streams, or dStorage identifiers + * for assets + * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetPublicViewershipMetricsResponse getPublicViewership( - String playbackId) throws Exception { + public GetPublicViewershipMetricsResponse getPublicViewership(String playbackId) { GetPublicViewershipMetricsRequest request = GetPublicViewershipMetricsRequest .builder() .playbackId(playbackId) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetPublicViewershipMetricsRequest.class, - _baseUrl, - "/data/views/query/total/{playbackId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getPublicViewershipMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getPublicViewershipMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getPublicViewershipMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getPublicViewershipMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetPublicViewershipMetricsResponse.Builder _resBuilder = - GetPublicViewershipMetricsResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetPublicViewershipMetricsResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - GetPublicViewershipMetricsData _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetPublicViewershipMetrics.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Query usage metrics + * * @return The call builder */ public GetUsageMetricsRequestBuilder getUsage() { - return new GetUsageMetricsRequestBuilder(this); + return new GetUsageMetricsRequestBuilder(sdkConfiguration); } /** * Query usage metrics - * @param request The request object containing all of the parameters for the API call. + * + * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetUsageMetricsResponse getUsage( - GetUsageMetricsRequest request) throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/data/usage/query"); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - _req.addQueryParams(Utils.getQueryParams( - GetUsageMetricsRequest.class, - request, - null)); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getUsageMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getUsageMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getUsageMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getUsageMetrics", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetUsageMetricsResponse.Builder _resBuilder = - GetUsageMetricsResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetUsageMetricsResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - UsageMetric _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withUsageMetric(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public GetUsageMetricsResponse getUsage(GetUsageMetricsRequest request) { + RequestOperation operation + = new GetUsageMetrics.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/Multistream.java b/src/main/java/studio/livepeer/livepeer/Multistream.java index 6315f4a5..bc261a7f 100644 --- a/src/main/java/studio/livepeer/livepeer/Multistream.java +++ b/src/main/java/studio/livepeer/livepeer/Multistream.java @@ -1,23 +1,13 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; -import com.fasterxml.jackson.core.type.TypeReference; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.Object; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.List; -import java.util.Optional; -import studio.livepeer.livepeer.models.components.MultistreamTarget; import studio.livepeer.livepeer.models.components.MultistreamTargetInput; -import studio.livepeer.livepeer.models.components.MultistreamTargetPatchPayload; -import studio.livepeer.livepeer.models.errors.Error; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.CreateMultistreamTargetRequestBuilder; import studio.livepeer.livepeer.models.operations.CreateMultistreamTargetResponse; import studio.livepeer.livepeer.models.operations.DeleteMultistreamTargetRequest; @@ -28,712 +18,168 @@ import studio.livepeer.livepeer.models.operations.GetMultistreamTargetResponse; import studio.livepeer.livepeer.models.operations.GetMultistreamTargetsRequestBuilder; import studio.livepeer.livepeer.models.operations.GetMultistreamTargetsResponse; -import studio.livepeer.livepeer.models.operations.SDKMethodInterfaces.*; import studio.livepeer.livepeer.models.operations.UpdateMultistreamTargetRequest; import studio.livepeer.livepeer.models.operations.UpdateMultistreamTargetRequestBuilder; import studio.livepeer.livepeer.models.operations.UpdateMultistreamTargetResponse; -import studio.livepeer.livepeer.utils.HTTPClient; -import studio.livepeer.livepeer.utils.HTTPRequest; -import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; -import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; -import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; -import studio.livepeer.livepeer.utils.SerializedBody; -import studio.livepeer.livepeer.utils.Utils.JsonShape; -import studio.livepeer.livepeer.utils.Utils; +import studio.livepeer.livepeer.operations.CreateMultistreamTarget; +import studio.livepeer.livepeer.operations.DeleteMultistreamTarget; +import studio.livepeer.livepeer.operations.GetMultistreamTarget; +import studio.livepeer.livepeer.operations.GetMultistreamTargets; +import studio.livepeer.livepeer.operations.UpdateMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; /** * Operations related to multistream api */ -public class Multistream implements - MethodCallGetMultistreamTargets, - MethodCallCreateMultistreamTarget, - MethodCallGetMultistreamTarget, - MethodCallUpdateMultistreamTarget, - MethodCallDeleteMultistreamTarget { - +public class Multistream { + private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; + private final AsyncMultistream asyncSDK; Multistream(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncMultistream(this, sdkConfiguration); } + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncMultistream async() { + return asyncSDK; + } /** * Retrieve Multistream Targets + * * @return The call builder */ public GetMultistreamTargetsRequestBuilder getAll() { - return new GetMultistreamTargetsRequestBuilder(this); + return new GetMultistreamTargetsRequestBuilder(sdkConfiguration); } /** * Retrieve Multistream Targets + * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetMultistreamTargetsResponse getAllDirect() throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/multistream/target"); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getMultistreamTargets", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getMultistreamTargets", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getMultistreamTargets", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getMultistreamTargets", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetMultistreamTargetsResponse.Builder _resBuilder = - GetMultistreamTargetsResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetMultistreamTargetsResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public GetMultistreamTargetsResponse getAllDirect() { + RequestlessOperation operation + = new GetMultistreamTargets.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest()); } - - /** * Create a multistream target + * * @return The call builder */ public CreateMultistreamTargetRequestBuilder create() { - return new CreateMultistreamTargetRequestBuilder(this); + return new CreateMultistreamTargetRequestBuilder(sdkConfiguration); } /** * Create a multistream target - * @param request The request object containing all of the parameters for the API call. + * + * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public CreateMultistreamTargetResponse create( - MultistreamTargetInput request) throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/multistream/target"); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "request", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "createMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "createMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateMultistreamTargetResponse.Builder _resBuilder = - CreateMultistreamTargetResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - CreateMultistreamTargetResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "201")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - MultistreamTarget _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withMultistreamTarget(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public CreateMultistreamTargetResponse create(MultistreamTargetInput request) { + RequestOperation operation + = new CreateMultistreamTarget.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Retrieve a multistream target + * * @return The call builder */ public GetMultistreamTargetRequestBuilder get() { - return new GetMultistreamTargetRequestBuilder(this); + return new GetMultistreamTargetRequestBuilder(sdkConfiguration); } /** * Retrieve a multistream target + * * @param id ID of the multistream target * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetMultistreamTargetResponse get( - String id) throws Exception { + public GetMultistreamTargetResponse get(String id) { GetMultistreamTargetRequest request = GetMultistreamTargetRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetMultistreamTargetRequest.class, - _baseUrl, - "/multistream/target/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetMultistreamTargetResponse.Builder _resBuilder = - GetMultistreamTargetResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetMultistreamTargetResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - MultistreamTarget _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withMultistreamTarget(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetMultistreamTarget.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Update Multistream Target + * * @return The call builder */ public UpdateMultistreamTargetRequestBuilder update() { - return new UpdateMultistreamTargetRequestBuilder(this); + return new UpdateMultistreamTargetRequestBuilder(sdkConfiguration); } /** * Update Multistream Target + * * @param id ID of the multistream target - * @param multistreamTargetPatchPayload + * @param multistreamTarget * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public UpdateMultistreamTargetResponse update( - String id, - MultistreamTargetPatchPayload multistreamTargetPatchPayload) throws Exception { + public UpdateMultistreamTargetResponse update(String id, MultistreamTargetInput multistreamTarget) { UpdateMultistreamTargetRequest request = UpdateMultistreamTargetRequest .builder() .id(id) - .multistreamTargetPatchPayload(multistreamTargetPatchPayload) + .multistreamTarget(multistreamTarget) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - UpdateMultistreamTargetRequest.class, - _baseUrl, - "/multistream/target/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "PATCH"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "multistreamTargetPatchPayload", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "updateMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "updateMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "updateMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "updateMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - UpdateMultistreamTargetResponse.Builder _resBuilder = - UpdateMultistreamTargetResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - UpdateMultistreamTargetResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new UpdateMultistreamTarget.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Delete a multistream target - * Make sure to remove any references to the target on existing + * + *

Make sure to remove any references to the target on existing * streams before actually deleting it from the API. * * @return The call builder */ public DeleteMultistreamTargetRequestBuilder delete() { - return new DeleteMultistreamTargetRequestBuilder(this); + return new DeleteMultistreamTargetRequestBuilder(sdkConfiguration); } /** * Delete a multistream target - * Make sure to remove any references to the target on existing + * + *

Make sure to remove any references to the target on existing * streams before actually deleting it from the API. * * @param id ID of the multistream target * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public DeleteMultistreamTargetResponse delete( - String id) throws Exception { + public DeleteMultistreamTargetResponse delete(String id) { DeleteMultistreamTargetRequest request = DeleteMultistreamTargetRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - DeleteMultistreamTargetRequest.class, - _baseUrl, - "/multistream/target/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "DELETE"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "deleteMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "deleteMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeleteMultistreamTargetResponse.Builder _resBuilder = - DeleteMultistreamTargetResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - DeleteMultistreamTargetResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new DeleteMultistreamTarget.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/Playback.java b/src/main/java/studio/livepeer/livepeer/Playback.java index e6f8a7e9..0a6c9220 100644 --- a/src/main/java/studio/livepeer/livepeer/Playback.java +++ b/src/main/java/studio/livepeer/livepeer/Playback.java @@ -1,176 +1,64 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; -import com.fasterxml.jackson.core.type.TypeReference; -import java.io.InputStream; -import java.lang.Exception; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.List; -import java.util.Optional; -import studio.livepeer.livepeer.models.components.PlaybackInfo; -import studio.livepeer.livepeer.models.errors.Error; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetPlaybackInfoRequest; import studio.livepeer.livepeer.models.operations.GetPlaybackInfoRequestBuilder; import studio.livepeer.livepeer.models.operations.GetPlaybackInfoResponse; -import studio.livepeer.livepeer.models.operations.SDKMethodInterfaces.*; -import studio.livepeer.livepeer.utils.HTTPClient; -import studio.livepeer.livepeer.utils.HTTPRequest; -import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; -import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; -import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; -import studio.livepeer.livepeer.utils.Utils; +import studio.livepeer.livepeer.operations.GetPlaybackInfo; +import studio.livepeer.livepeer.utils.Headers; /** * Operations related to playback api */ -public class Playback implements - MethodCallGetPlaybackInfo { - +public class Playback { + private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; + private final AsyncPlayback asyncSDK; Playback(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncPlayback(this, sdkConfiguration); } + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncPlayback async() { + return asyncSDK; + } /** * Retrieve Playback Info + * * @return The call builder */ public GetPlaybackInfoRequestBuilder get() { - return new GetPlaybackInfoRequestBuilder(this); + return new GetPlaybackInfoRequestBuilder(sdkConfiguration); } /** * Retrieve Playback Info + * * @param id The playback ID from the asset or livestream, e.g. `eaw4nk06ts2d0mzb`. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetPlaybackInfoResponse get( - String id) throws Exception { + public GetPlaybackInfoResponse get(String id) { GetPlaybackInfoRequest request = GetPlaybackInfoRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetPlaybackInfoRequest.class, - _baseUrl, - "/playback/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getPlaybackInfo", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "404", "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getPlaybackInfo", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getPlaybackInfo", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getPlaybackInfo", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetPlaybackInfoResponse.Builder _resBuilder = - GetPlaybackInfoResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetPlaybackInfoResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - PlaybackInfo _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withPlaybackInfo(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - throw _out; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetPlaybackInfo.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/Room.java b/src/main/java/studio/livepeer/livepeer/Room.java index 42b6847e..0b873035 100644 --- a/src/main/java/studio/livepeer/livepeer/Room.java +++ b/src/main/java/studio/livepeer/livepeer/Room.java @@ -1,25 +1,16 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; -import com.fasterxml.jackson.core.type.TypeReference; -import java.io.InputStream; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.Deprecated; -import java.lang.Exception; -import java.lang.Object; import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.List; -import java.util.Optional; import studio.livepeer.livepeer.models.components.RoomEgressPayload; import studio.livepeer.livepeer.models.components.RoomUserPayload; -import studio.livepeer.livepeer.models.components.RoomUserResponse; import studio.livepeer.livepeer.models.components.RoomUserUpdatePayload; -import studio.livepeer.livepeer.models.errors.Error; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.CreateRoomRequestBuilder; import studio.livepeer.livepeer.models.operations.CreateRoomResponse; import studio.livepeer.livepeer.models.operations.CreateRoomUserRequest; @@ -37,7 +28,6 @@ import studio.livepeer.livepeer.models.operations.GetRoomUserRequest; import studio.livepeer.livepeer.models.operations.GetRoomUserRequestBuilder; import studio.livepeer.livepeer.models.operations.GetRoomUserResponse; -import studio.livepeer.livepeer.models.operations.SDKMethodInterfaces.*; import studio.livepeer.livepeer.models.operations.StartRoomEgressRequest; import studio.livepeer.livepeer.models.operations.StartRoomEgressRequestBuilder; import studio.livepeer.livepeer.models.operations.StartRoomEgressResponse; @@ -47,445 +37,134 @@ import studio.livepeer.livepeer.models.operations.UpdateRoomUserRequest; import studio.livepeer.livepeer.models.operations.UpdateRoomUserRequestBuilder; import studio.livepeer.livepeer.models.operations.UpdateRoomUserResponse; -import studio.livepeer.livepeer.utils.HTTPClient; -import studio.livepeer.livepeer.utils.HTTPRequest; -import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; -import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; -import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; -import studio.livepeer.livepeer.utils.SerializedBody; -import studio.livepeer.livepeer.utils.Utils.JsonShape; -import studio.livepeer.livepeer.utils.Utils; +import studio.livepeer.livepeer.operations.CreateRoom; +import studio.livepeer.livepeer.operations.CreateRoomUser; +import studio.livepeer.livepeer.operations.DeleteRoom; +import studio.livepeer.livepeer.operations.DeleteRoomUser; +import studio.livepeer.livepeer.operations.GetRoom; +import studio.livepeer.livepeer.operations.GetRoomUser; +import studio.livepeer.livepeer.operations.StartRoomEgress; +import studio.livepeer.livepeer.operations.StopRoomEgress; +import studio.livepeer.livepeer.operations.UpdateRoomUser; +import studio.livepeer.livepeer.utils.Headers; /** * Operations related to rooms api */ -public class Room implements - MethodCallCreateRoom, - MethodCallGetRoom, - MethodCallDeleteRoom, - MethodCallStartRoomEgress, - MethodCallStopRoomEgress, - MethodCallCreateRoomUser, - MethodCallGetRoomUser, - MethodCallUpdateRoomUser, - MethodCallDeleteRoomUser { - +public class Room { + private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; + private final AsyncRoom asyncSDK; Room(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncRoom(this, sdkConfiguration); } + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncRoom async() { + return asyncSDK; + } /** * Create a room - * Create a multiparticipant livestreaming room. + * + *

Create a multiparticipant livestreaming room. * * @return The call builder * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated public CreateRoomRequestBuilder create() { - return new CreateRoomRequestBuilder(this); + return new CreateRoomRequestBuilder(sdkConfiguration); } /** * Create a room - * Create a multiparticipant livestreaming room. + * + *

Create a multiparticipant livestreaming room. * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated - public CreateRoomResponse createDirect() throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/room"); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "createRoom", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createRoom", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "createRoom", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createRoom", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateRoomResponse.Builder _resBuilder = - CreateRoomResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - CreateRoomResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.CreateRoomResponse _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withCreateRoomResponse(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public CreateRoomResponse createDirect() { + RequestlessOperation operation + = new CreateRoom.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest()); } - - /** * Retrieve a room + * * @return The call builder * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated public GetRoomRequestBuilder get() { - return new GetRoomRequestBuilder(this); + return new GetRoomRequestBuilder(sdkConfiguration); } /** * Retrieve a room - * @param id + * + * @param id * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated - public GetRoomResponse get( - String id) throws Exception { + public GetRoomResponse get(String id) { GetRoomRequest request = GetRoomRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetRoomRequest.class, - _baseUrl, - "/room/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getRoom", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getRoom", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getRoom", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getRoom", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetRoomResponse.Builder _resBuilder = - GetRoomResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetRoomResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.Room _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withRoom(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetRoom.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Delete a room + * * @return The call builder * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated public DeleteRoomRequestBuilder delete() { - return new DeleteRoomRequestBuilder(this); + return new DeleteRoomRequestBuilder(sdkConfiguration); } /** * Delete a room - * @param id + * + * @param id * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated - public DeleteRoomResponse delete( - String id) throws Exception { + public DeleteRoomResponse delete(String id) { DeleteRoomRequest request = DeleteRoomRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - DeleteRoomRequest.class, - _baseUrl, - "/room/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "DELETE"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "deleteRoom", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteRoom", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "deleteRoom", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteRoom", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeleteRoomResponse.Builder _resBuilder = - DeleteRoomResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - DeleteRoomResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new DeleteRoom.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Start room RTMP egress - * Create a livestream for your room. + * + *

Create a livestream for your room. * This allows you to leverage livestreaming features like recording and HLS output. * * @return The call builder @@ -493,281 +172,69 @@ public DeleteRoomResponse delete( */ @Deprecated public StartRoomEgressRequestBuilder startEgress() { - return new StartRoomEgressRequestBuilder(this); + return new StartRoomEgressRequestBuilder(sdkConfiguration); } /** * Start room RTMP egress - * Create a livestream for your room. + * + *

Create a livestream for your room. * This allows you to leverage livestreaming features like recording and HLS output. * - * @param id - * @param roomEgressPayload + * @param id + * @param roomEgressPayload * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated - public StartRoomEgressResponse startEgress( - String id, - RoomEgressPayload roomEgressPayload) throws Exception { + public StartRoomEgressResponse startEgress(String id, RoomEgressPayload roomEgressPayload) { StartRoomEgressRequest request = StartRoomEgressRequest .builder() .id(id) .roomEgressPayload(roomEgressPayload) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - StartRoomEgressRequest.class, - _baseUrl, - "/room/{id}/egress", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "roomEgressPayload", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "startRoomEgress", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "startRoomEgress", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "startRoomEgress", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "startRoomEgress", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - StartRoomEgressResponse.Builder _resBuilder = - StartRoomEgressResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - StartRoomEgressResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new StartRoomEgress.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Stop room RTMP egress + * * @return The call builder * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated public StopRoomEgressRequestBuilder stopEgress() { - return new StopRoomEgressRequestBuilder(this); + return new StopRoomEgressRequestBuilder(sdkConfiguration); } /** * Stop room RTMP egress - * @param id + * + * @param id * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated - public StopRoomEgressResponse stopEgress( - String id) throws Exception { + public StopRoomEgressResponse stopEgress(String id) { StopRoomEgressRequest request = StopRoomEgressRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - StopRoomEgressRequest.class, - _baseUrl, - "/room/{id}/egress", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "DELETE"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "stopRoomEgress", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "stopRoomEgress", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "stopRoomEgress", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "stopRoomEgress", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - StopRoomEgressResponse.Builder _resBuilder = - StopRoomEgressResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - StopRoomEgressResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new StopRoomEgress.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Create a room user - * Call this endpoint to add a user to a room, specifying a display name at a minimum. + * + *

Call this endpoint to add a user to a room, specifying a display name at a minimum. * The response will contain a joining URL for Livepeer's default meeting app. * Alternatively the joining token can be used with a custom app. * @@ -776,330 +243,97 @@ public StopRoomEgressResponse stopEgress( */ @Deprecated public CreateRoomUserRequestBuilder createUser() { - return new CreateRoomUserRequestBuilder(this); + return new CreateRoomUserRequestBuilder(sdkConfiguration); } /** * Create a room user - * Call this endpoint to add a user to a room, specifying a display name at a minimum. + * + *

Call this endpoint to add a user to a room, specifying a display name at a minimum. * The response will contain a joining URL for Livepeer's default meeting app. * Alternatively the joining token can be used with a custom app. * - * @param id - * @param roomUserPayload + * @param id + * @param roomUserPayload * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated - public CreateRoomUserResponse createUser( - String id, - RoomUserPayload roomUserPayload) throws Exception { + public CreateRoomUserResponse createUser(String id, RoomUserPayload roomUserPayload) { CreateRoomUserRequest request = CreateRoomUserRequest .builder() .id(id) .roomUserPayload(roomUserPayload) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - CreateRoomUserRequest.class, - _baseUrl, - "/room/{id}/user", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "roomUserPayload", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "createRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "createRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateRoomUserResponse.Builder _resBuilder = - CreateRoomUserResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - CreateRoomUserResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "201")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - RoomUserResponse _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withRoomUserResponse(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new CreateRoomUser.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Get user details + * * @return The call builder * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated public GetRoomUserRequestBuilder getUser() { - return new GetRoomUserRequestBuilder(this); + return new GetRoomUserRequestBuilder(sdkConfiguration); } /** * Get user details - * @param id - * @param userId + * + * @param id + * @param userId * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated - public GetRoomUserResponse getUser( - String id, - String userId) throws Exception { + public GetRoomUserResponse getUser(String id, String userId) { GetRoomUserRequest request = GetRoomUserRequest .builder() .id(id) .userId(userId) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetRoomUserRequest.class, - _baseUrl, - "/room/{id}/user/{userId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetRoomUserResponse.Builder _resBuilder = - GetRoomUserResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetRoomUserResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.GetRoomUserResponse _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withGetRoomUserResponse(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetRoomUser.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Update a room user - * Update properties for a user. + * + *

Update properties for a user. + * * @return The call builder * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated public UpdateRoomUserRequestBuilder updateUser() { - return new UpdateRoomUserRequestBuilder(this); + return new UpdateRoomUserRequestBuilder(sdkConfiguration); } /** * Update a room user - * Update properties for a user. - * @param id - * @param userId - * @param roomUserUpdatePayload + * + *

Update properties for a user. + * + * @param id + * @param userId + * @param roomUserUpdatePayload * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated public UpdateRoomUserResponse updateUser( - String id, - String userId, - RoomUserUpdatePayload roomUserUpdatePayload) throws Exception { + String id, String userId, + RoomUserUpdatePayload roomUserUpdatePayload) { UpdateRoomUserRequest request = UpdateRoomUserRequest .builder() @@ -1107,253 +341,42 @@ public UpdateRoomUserResponse updateUser( .userId(userId) .roomUserUpdatePayload(roomUserUpdatePayload) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - UpdateRoomUserRequest.class, - _baseUrl, - "/room/{id}/user/{userId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "PUT"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "roomUserUpdatePayload", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "updateRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "updateRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "updateRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "updateRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - UpdateRoomUserResponse.Builder _resBuilder = - UpdateRoomUserResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - UpdateRoomUserResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new UpdateRoomUser.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Remove a user from the room + * * @return The call builder * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated public DeleteRoomUserRequestBuilder deleteUser() { - return new DeleteRoomUserRequestBuilder(this); + return new DeleteRoomUserRequestBuilder(sdkConfiguration); } /** * Remove a user from the room - * @param id - * @param userId + * + * @param id + * @param userId * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated - public DeleteRoomUserResponse deleteUser( - String id, - String userId) throws Exception { + public DeleteRoomUserResponse deleteUser(String id, String userId) { DeleteRoomUserRequest request = DeleteRoomUserRequest .builder() .id(id) .userId(userId) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - DeleteRoomUserRequest.class, - _baseUrl, - "/room/{id}/user/{userId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "DELETE"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "deleteRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "deleteRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteRoomUser", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeleteRoomUserResponse.Builder _resBuilder = - DeleteRoomUserResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - DeleteRoomUserResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new DeleteRoomUser.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/SDKConfiguration.java b/src/main/java/studio/livepeer/livepeer/SDKConfiguration.java index a9cb585f..d5273229 100644 --- a/src/main/java/studio/livepeer/livepeer/SDKConfiguration.java +++ b/src/main/java/studio/livepeer/livepeer/SDKConfiguration.java @@ -1,32 +1,89 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; import java.lang.String; import java.util.Optional; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; import studio.livepeer.livepeer.hooks.SDKHooks; +import studio.livepeer.livepeer.utils.AsyncHooks; import studio.livepeer.livepeer.utils.HTTPClient; -import studio.livepeer.livepeer.utils.Hook.SdkInitData; import studio.livepeer.livepeer.utils.Hooks; import studio.livepeer.livepeer.utils.RetryConfig; +import studio.livepeer.livepeer.utils.SpeakeasyHTTPClient; +import studio.livepeer.livepeer.utils.Utils; + +public class SDKConfiguration { + + private static final String LANGUAGE = "java"; + public static final String OPENAPI_DOC_VERSION = "1.0.0"; + public static final String SDK_VERSION = "0.6.0"; + public static final String GEN_VERSION = "2.730.5"; + private static final String BASE_PACKAGE = "studio.livepeer.livepeer"; + public static final String USER_AGENT = + String.format("speakeasy-sdk/%s %s %s %s %s", + LANGUAGE, SDK_VERSION, GEN_VERSION, OPENAPI_DOC_VERSION, BASE_PACKAGE); -class SDKConfiguration { - public SecuritySource securitySource; + private SecuritySource securitySource = SecuritySource.of(null); - public Optional securitySource() { - return Optional.ofNullable(securitySource); + public SecuritySource securitySource() { + return securitySource; } - public HTTPClient defaultClient; - public String serverUrl; - public int serverIdx = 0; - public String language = "java"; - public String openapiDocVersion = "1.0.0"; - public String sdkVersion = "0.5.0"; - public String genVersion = "2.404.1"; - public String userAgent = "speakeasy-sdk/java 0.5.0 2.404.1 1.0.0 studio.livepeer.livepeer"; - + + public void setSecuritySource(SecuritySource securitySource) { + Utils.checkNotNull(securitySource, "securitySource"); + this.securitySource = securitySource; + } + + private HTTPClient client = new SpeakeasyHTTPClient(); + + public HTTPClient client() { + return client; + } + + public void setClient(HTTPClient client) { + Utils.checkNotNull(client, "client"); + this.client = client; + } + + private String serverUrl; + + public String serverUrl() { + return serverUrl; + } + + public void setServerUrl(String serverUrl) { + Utils.checkNotNull(serverUrl, "serverUrl"); + this.serverUrl = trimFinalSlash(serverUrl); + } + + private static String trimFinalSlash(String url) { + if (url == null) { + return null; + } else if (url.endsWith("/")) { + return url.substring(0, url.length() - 1); + } else { + return url; + } + } + + public String resolvedServerUrl() { + return serverUrl; + } + + private int serverIdx = 0; + + public void setServerIdx(int serverIdx) { + this.serverIdx = serverIdx; + } + + public int serverIdx() { + return serverIdx; + } + + private Hooks _hooks = createHooks(); private static Hooks createHooks() { @@ -42,18 +99,45 @@ public void setHooks(Hooks hooks) { this._hooks = hooks; } - /** + /** * Initializes state (for example hooks). **/ public void initialize() { SDKHooks.initialize(_hooks); - // apply the sdk init hook immediately - SdkInitData data = _hooks.sdkInit(new SdkInitData(serverUrl, defaultClient)); - this.serverUrl = data.baseUrl(); - this.defaultClient = data.client(); + SDKHooks.initialize(_asyncHooks); } - public Optional retryConfig = Optional.empty(); + private Optional retryConfig = Optional.empty(); + + public Optional retryConfig() { + return retryConfig; + } + + public void setRetryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + } + private ScheduledExecutorService retryScheduler = Executors.newSingleThreadScheduledExecutor(); + + public ScheduledExecutorService retryScheduler() { + return retryScheduler; + } + + public void setAsyncRetryScheduler(ScheduledExecutorService retryScheduler) { + Utils.checkNotNull(retryScheduler, "retryScheduler"); + this.retryScheduler = retryScheduler; + } + + private AsyncHooks _asyncHooks = new AsyncHooks(); + + public AsyncHooks asyncHooks() { + return _asyncHooks; + } + + public void setAsyncHooks(AsyncHooks asyncHooks) { + Utils.checkNotNull(asyncHooks, "asyncHooks"); + this._asyncHooks = asyncHooks; + } } diff --git a/src/main/java/studio/livepeer/livepeer/SecuritySource.java b/src/main/java/studio/livepeer/livepeer/SecuritySource.java index a8176b58..d87c43cf 100644 --- a/src/main/java/studio/livepeer/livepeer/SecuritySource.java +++ b/src/main/java/studio/livepeer/livepeer/SecuritySource.java @@ -1,27 +1,26 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; -import studio.livepeer.livepeer.models.components.Security; +import studio.livepeer.livepeer.utils.HasSecurity; public interface SecuritySource { - Security getSecurity(); + HasSecurity getSecurity(); - public static SecuritySource of(Security security) { + public static SecuritySource of(HasSecurity security) { return new DefaultSecuritySource(security); } public static class DefaultSecuritySource implements SecuritySource { - private Security security; + private HasSecurity security; - public DefaultSecuritySource(Security security) { + public DefaultSecuritySource(HasSecurity security) { this.security = security; } - public Security getSecurity() { + public HasSecurity getSecurity() { return security; } } diff --git a/src/main/java/studio/livepeer/livepeer/Session.java b/src/main/java/studio/livepeer/livepeer/Session.java index 04836d1f..350cd1f5 100644 --- a/src/main/java/studio/livepeer/livepeer/Session.java +++ b/src/main/java/studio/livepeer/livepeer/Session.java @@ -1,20 +1,13 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; -import com.fasterxml.jackson.core.type.TypeReference; -import java.io.InputStream; -import java.lang.Exception; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; + import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.List; import java.util.Optional; -import studio.livepeer.livepeer.models.components.Asset; -import studio.livepeer.livepeer.models.errors.Error; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetRecordedSessionsRequest; import studio.livepeer.livepeer.models.operations.GetRecordedSessionsRequestBuilder; import studio.livepeer.livepeer.models.operations.GetRecordedSessionsResponse; @@ -27,585 +20,149 @@ import studio.livepeer.livepeer.models.operations.GetSessionsRequestBuilder; import studio.livepeer.livepeer.models.operations.GetSessionsResponse; import studio.livepeer.livepeer.models.operations.Record; -import studio.livepeer.livepeer.models.operations.SDKMethodInterfaces.*; -import studio.livepeer.livepeer.utils.HTTPClient; -import studio.livepeer.livepeer.utils.HTTPRequest; -import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; -import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; -import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; -import studio.livepeer.livepeer.utils.Utils; +import studio.livepeer.livepeer.operations.GetRecordedSessions; +import studio.livepeer.livepeer.operations.GetSession; +import studio.livepeer.livepeer.operations.GetSessionClips; +import studio.livepeer.livepeer.operations.GetSessions; +import studio.livepeer.livepeer.utils.Headers; /** * Operations related to session api */ -public class Session implements - MethodCallGetSessionClips, - MethodCallGetSessions, - MethodCallGetSession, - MethodCallGetRecordedSessions { - +public class Session { + private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; + private final AsyncSession asyncSDK; Session(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncSession(this, sdkConfiguration); } + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncSession async() { + return asyncSDK; + } /** * Retrieve clips of a session + * * @return The call builder */ public GetSessionClipsRequestBuilder getClips() { - return new GetSessionClipsRequestBuilder(this); + return new GetSessionClipsRequestBuilder(sdkConfiguration); } /** * Retrieve clips of a session + * * @param id ID of the parent session * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetSessionClipsResponse getClips( - String id) throws Exception { + public GetSessionClipsResponse getClips(String id) { GetSessionClipsRequest request = GetSessionClipsRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetSessionClipsRequest.class, - _baseUrl, - "/session/{id}/clips", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getSessionClips", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getSessionClips", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getSessionClips", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getSessionClips", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetSessionClipsResponse.Builder _resBuilder = - GetSessionClipsResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetSessionClipsResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetSessionClips.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Retrieve sessions + * * @return The call builder */ public GetSessionsRequestBuilder getAll() { - return new GetSessionsRequestBuilder(this); + return new GetSessionsRequestBuilder(sdkConfiguration); } /** * Retrieve sessions + * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetSessionsResponse getAllDirect() throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/session"); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getSessions", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getSessions", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getSessions", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getSessions", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetSessionsResponse.Builder _resBuilder = - GetSessionsResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetSessionsResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public GetSessionsResponse getAllDirect() { + RequestlessOperation operation + = new GetSessions.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest()); } - - /** * Retrieve a session + * * @return The call builder */ public GetSessionRequestBuilder get() { - return new GetSessionRequestBuilder(this); + return new GetSessionRequestBuilder(sdkConfiguration); } /** * Retrieve a session + * * @param id ID of the session * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetSessionResponse get( - String id) throws Exception { + public GetSessionResponse get(String id) { GetSessionRequest request = GetSessionRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetSessionRequest.class, - _baseUrl, - "/session/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getSession", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getSession", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getSession", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getSession", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetSessionResponse.Builder _resBuilder = - GetSessionResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetSessionResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.Session _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withSession(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetSession.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Retrieve Recorded Sessions + * * @return The call builder */ public GetRecordedSessionsRequestBuilder getRecorded() { - return new GetRecordedSessionsRequestBuilder(this); + return new GetRecordedSessionsRequestBuilder(sdkConfiguration); } /** * Retrieve Recorded Sessions + * * @param parentId ID of the parent stream * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetRecordedSessionsResponse getRecorded( - String parentId) throws Exception { + public GetRecordedSessionsResponse getRecorded(String parentId) { return getRecorded(parentId, Optional.empty()); } - + /** * Retrieve Recorded Sessions + * * @param parentId ID of the parent stream * @param record Flag indicating if the response should only include recorded - sessions - + * sessions + * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetRecordedSessionsResponse getRecorded( - String parentId, - Optional record) throws Exception { + public GetRecordedSessionsResponse getRecorded(String parentId, Optional record) { GetRecordedSessionsRequest request = GetRecordedSessionsRequest .builder() .parentId(parentId) .record(record) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetRecordedSessionsRequest.class, - _baseUrl, - "/stream/{parentId}/sessions", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - _req.addQueryParams(Utils.getQueryParams( - GetRecordedSessionsRequest.class, - request, - null)); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getRecordedSessions", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getRecordedSessions", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getRecordedSessions", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getRecordedSessions", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetRecordedSessionsResponse.Builder _resBuilder = - GetRecordedSessionsResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetRecordedSessionsResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetRecordedSessions.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/Stream.java b/src/main/java/studio/livepeer/livepeer/Stream.java index ef77c0f9..b0e53ced 100644 --- a/src/main/java/studio/livepeer/livepeer/Stream.java +++ b/src/main/java/studio/livepeer/livepeer/Stream.java @@ -1,29 +1,19 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; -import com.fasterxml.jackson.core.type.TypeReference; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.Object; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.List; import java.util.Optional; -import studio.livepeer.livepeer.models.components.Asset; import studio.livepeer.livepeer.models.components.ClipPayload; import studio.livepeer.livepeer.models.components.NewStreamPayload; import studio.livepeer.livepeer.models.components.StreamPatchPayload; import studio.livepeer.livepeer.models.components.TargetAddPayload; -import studio.livepeer.livepeer.models.errors.Error; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.AddMultistreamTargetRequest; import studio.livepeer.livepeer.models.operations.AddMultistreamTargetRequestBuilder; import studio.livepeer.livepeer.models.operations.AddMultistreamTargetResponse; -import studio.livepeer.livepeer.models.operations.CreateClipData; import studio.livepeer.livepeer.models.operations.CreateClipRequestBuilder; import studio.livepeer.livepeer.models.operations.CreateClipResponse; import studio.livepeer.livepeer.models.operations.CreateStreamRequestBuilder; @@ -43,7 +33,6 @@ import studio.livepeer.livepeer.models.operations.RemoveMultistreamTargetRequest; import studio.livepeer.livepeer.models.operations.RemoveMultistreamTargetRequestBuilder; import studio.livepeer.livepeer.models.operations.RemoveMultistreamTargetResponse; -import studio.livepeer.livepeer.models.operations.SDKMethodInterfaces.*; import studio.livepeer.livepeer.models.operations.StartPullStreamRequest; import studio.livepeer.livepeer.models.operations.StartPullStreamRequestBuilder; import studio.livepeer.livepeer.models.operations.StartPullStreamResponse; @@ -53,41 +42,45 @@ import studio.livepeer.livepeer.models.operations.UpdateStreamRequest; import studio.livepeer.livepeer.models.operations.UpdateStreamRequestBuilder; import studio.livepeer.livepeer.models.operations.UpdateStreamResponse; -import studio.livepeer.livepeer.utils.HTTPClient; -import studio.livepeer.livepeer.utils.HTTPRequest; -import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; -import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; -import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; -import studio.livepeer.livepeer.utils.SerializedBody; -import studio.livepeer.livepeer.utils.Utils.JsonShape; -import studio.livepeer.livepeer.utils.Utils; +import studio.livepeer.livepeer.operations.AddMultistreamTarget; +import studio.livepeer.livepeer.operations.CreateClip; +import studio.livepeer.livepeer.operations.CreateStream; +import studio.livepeer.livepeer.operations.DeleteStream; +import studio.livepeer.livepeer.operations.GetClips; +import studio.livepeer.livepeer.operations.GetStream; +import studio.livepeer.livepeer.operations.GetStreams; +import studio.livepeer.livepeer.operations.RemoveMultistreamTarget; +import studio.livepeer.livepeer.operations.StartPullStream; +import studio.livepeer.livepeer.operations.TerminateStream; +import studio.livepeer.livepeer.operations.UpdateStream; +import studio.livepeer.livepeer.utils.Headers; /** * Operations related to livestream api */ -public class Stream implements - MethodCallCreateStream, - MethodCallGetStreams, - MethodCallGetStream, - MethodCallUpdateStream, - MethodCallDeleteStream, - MethodCallTerminateStream, - MethodCallStartPullStream, - MethodCallCreateClip, - MethodCallGetClips, - MethodCallAddMultistreamTarget, - MethodCallRemoveMultistreamTarget { - +public class Stream { + private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; + private final AsyncStream asyncSDK; Stream(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncStream(this, sdkConfiguration); } + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncStream async() { + return asyncSDK; + } /** * Create a stream - * The only parameter you are required to set is the name of your stream, + * + *

The only parameter you are required to set is the name of your stream, * but we also highly recommend that you define transcoding profiles * parameter that suits your specific broadcasting configuration. * \ @@ -104,12 +97,13 @@ public class Stream implements * @return The call builder */ public CreateStreamRequestBuilder create() { - return new CreateStreamRequestBuilder(this); + return new CreateStreamRequestBuilder(sdkConfiguration); } /** * Create a stream - * The only parameter you are required to set is the name of your stream, + * + *

The only parameter you are required to set is the name of your stream, * but we also highly recommend that you define transcoding profiles * parameter that suits your specific broadcasting configuration. * \ @@ -123,569 +117,113 @@ public CreateStreamRequestBuilder create() { * also be added upon the creation of a new stream by adding * `"playbackPolicy": {"type": "jwt"}` * - * @param request The request object containing all of the parameters for the API call. + * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public CreateStreamResponse create( - NewStreamPayload request) throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/stream"); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "request", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "createStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "createStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateStreamResponse.Builder _resBuilder = - CreateStreamResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - CreateStreamResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "201")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.Stream _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withStream(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public CreateStreamResponse create(NewStreamPayload request) { + RequestOperation operation + = new CreateStream.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Retrieve streams + * * @return The call builder */ public GetStreamsRequestBuilder getAll() { - return new GetStreamsRequestBuilder(this); + return new GetStreamsRequestBuilder(sdkConfiguration); } /** * Retrieve streams + * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetStreamsResponse getAllDirect() throws Exception { + public GetStreamsResponse getAllDirect() { return getAll(Optional.empty()); } - + /** * Retrieve streams - * @param streamsonly + * + * @param streamsonly * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetStreamsResponse getAll( - Optional streamsonly) throws Exception { + public GetStreamsResponse getAll(Optional streamsonly) { GetStreamsRequest request = GetStreamsRequest .builder() .streamsonly(streamsonly) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/stream"); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - _req.addQueryParams(Utils.getQueryParams( - GetStreamsRequest.class, - request, - null)); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getStreams", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getStreams", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getStreams", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getStreams", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetStreamsResponse.Builder _resBuilder = - GetStreamsResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetStreamsResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetStreams.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Retrieve a stream + * * @return The call builder */ public GetStreamRequestBuilder get() { - return new GetStreamRequestBuilder(this); + return new GetStreamRequestBuilder(sdkConfiguration); } /** * Retrieve a stream + * * @param id ID of the stream * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetStreamResponse get( - String id) throws Exception { + public GetStreamResponse get(String id) { GetStreamRequest request = GetStreamRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetStreamRequest.class, - _baseUrl, - "/stream/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetStreamResponse.Builder _resBuilder = - GetStreamResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetStreamResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.Stream _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withStream(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetStream.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Update a stream + * * @return The call builder */ public UpdateStreamRequestBuilder update() { - return new UpdateStreamRequestBuilder(this); + return new UpdateStreamRequestBuilder(sdkConfiguration); } /** * Update a stream + * * @param id ID of the stream - * @param streamPatchPayload + * @param streamPatchPayload * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public UpdateStreamResponse update( - String id, - StreamPatchPayload streamPatchPayload) throws Exception { + public UpdateStreamResponse update(String id, StreamPatchPayload streamPatchPayload) { UpdateStreamRequest request = UpdateStreamRequest .builder() .id(id) .streamPatchPayload(streamPatchPayload) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - UpdateStreamRequest.class, - _baseUrl, - "/stream/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "PATCH"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "streamPatchPayload", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "updateStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "updateStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "updateStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "updateStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - UpdateStreamResponse.Builder _resBuilder = - UpdateStreamResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - UpdateStreamResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new UpdateStream.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Delete a stream - * This will also suspend any active stream sessions, so make sure to wait + * + *

This will also suspend any active stream sessions, so make sure to wait * until the stream has finished. To explicitly interrupt an active * session, consider instead updating the suspended field in the stream * using the PATCH stream API. @@ -693,135 +231,36 @@ public UpdateStreamResponse update( * @return The call builder */ public DeleteStreamRequestBuilder delete() { - return new DeleteStreamRequestBuilder(this); + return new DeleteStreamRequestBuilder(sdkConfiguration); } /** * Delete a stream - * This will also suspend any active stream sessions, so make sure to wait + * + *

This will also suspend any active stream sessions, so make sure to wait * until the stream has finished. To explicitly interrupt an active * session, consider instead updating the suspended field in the stream * using the PATCH stream API. * * @param id ID of the stream * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public DeleteStreamResponse delete( - String id) throws Exception { + public DeleteStreamResponse delete(String id) { DeleteStreamRequest request = DeleteStreamRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - DeleteStreamRequest.class, - _baseUrl, - "/stream/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "DELETE"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "deleteStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "deleteStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeleteStreamResponse.Builder _resBuilder = - DeleteStreamResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - DeleteStreamResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new DeleteStream.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Terminates a live stream - * `DELETE /stream/{id}/terminate` can be used to terminate an ongoing + * + *

`DELETE /stream/{id}/terminate` can be used to terminate an ongoing * session on a live stream. Unlike suspending the stream, it allows the * streamer to restart streaming even immediately, but it will force * terminate the current session and stop the recording. @@ -833,12 +272,13 @@ public DeleteStreamResponse delete( * @return The call builder */ public TerminateStreamRequestBuilder terminate() { - return new TerminateStreamRequestBuilder(this); + return new TerminateStreamRequestBuilder(sdkConfiguration); } /** * Terminates a live stream - * `DELETE /stream/{id}/terminate` can be used to terminate an ongoing + * + *

`DELETE /stream/{id}/terminate` can be used to terminate an ongoing * session on a live stream. Unlike suspending the stream, it allows the * streamer to restart streaming even immediately, but it will force * terminate the current session and stop the recording. @@ -849,123 +289,23 @@ public TerminateStreamRequestBuilder terminate() { * * @param id ID of the stream * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public TerminateStreamResponse terminate( - String id) throws Exception { + public TerminateStreamResponse terminate(String id) { TerminateStreamRequest request = TerminateStreamRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - TerminateStreamRequest.class, - _baseUrl, - "/stream/{id}/terminate", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "DELETE"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "terminateStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "terminateStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "terminateStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "terminateStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - TerminateStreamResponse.Builder _resBuilder = - TerminateStreamResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - TerminateStreamResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new TerminateStream.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Start ingest for a pull stream - * `POST /stream/{id}/start-pull` can be used to start ingest for a stream + * + *

`POST /stream/{id}/start-pull` can be used to start ingest for a stream * configured with a pull source. If the stream has recording configured, * it will also start recording. * \ @@ -976,12 +316,13 @@ public TerminateStreamResponse terminate( * @return The call builder */ public StartPullStreamRequestBuilder startPull() { - return new StartPullStreamRequestBuilder(this); + return new StartPullStreamRequestBuilder(sdkConfiguration); } /** * Start ingest for a pull stream - * `POST /stream/{id}/start-pull` can be used to start ingest for a stream + * + *

`POST /stream/{id}/start-pull` can be used to start ingest for a stream * configured with a pull source. If the stream has recording configured, * it will also start recording. * \ @@ -991,666 +332,124 @@ public StartPullStreamRequestBuilder startPull() { * * @param id ID of the stream * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public StartPullStreamResponse startPull( - String id) throws Exception { + public StartPullStreamResponse startPull(String id) { StartPullStreamRequest request = StartPullStreamRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - StartPullStreamRequest.class, - _baseUrl, - "/stream/{id}/start-pull", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "startPullStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "startPullStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "startPullStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "startPullStream", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - StartPullStreamResponse.Builder _resBuilder = - StartPullStreamResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - StartPullStreamResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new StartPullStream.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Create a clip + * * @return The call builder */ public CreateClipRequestBuilder createClip() { - return new CreateClipRequestBuilder(this); + return new CreateClipRequestBuilder(sdkConfiguration); } /** * Create a clip - * @param request The request object containing all of the parameters for the API call. + * + * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public CreateClipResponse createClip( - ClipPayload request) throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/clip"); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "request", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "createClip", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createClip", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "createClip", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createClip", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateClipResponse.Builder _resBuilder = - CreateClipResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - CreateClipResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - CreateClipData _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public CreateClipResponse createClip(ClipPayload request) { + RequestOperation operation + = new CreateClip.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Retrieve clips of a livestream + * * @return The call builder */ public GetClipsRequestBuilder getClips() { - return new GetClipsRequestBuilder(this); + return new GetClipsRequestBuilder(sdkConfiguration); } /** * Retrieve clips of a livestream + * * @param id ID of the parent stream or playbackId of parent stream * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetClipsResponse getClips( - String id) throws Exception { + public GetClipsResponse getClips(String id) { GetClipsRequest request = GetClipsRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetClipsRequest.class, - _baseUrl, - "/stream/{id}/clips", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getClips", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getClips", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getClips", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getClips", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetClipsResponse.Builder _resBuilder = - GetClipsResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetClipsResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetClips.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Add a multistream target + * * @return The call builder */ public AddMultistreamTargetRequestBuilder addMultistreamTarget() { - return new AddMultistreamTargetRequestBuilder(this); + return new AddMultistreamTargetRequestBuilder(sdkConfiguration); } /** * Add a multistream target + * * @param id ID of the parent stream - * @param targetAddPayload + * @param targetAddPayload * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public AddMultistreamTargetResponse addMultistreamTarget( - String id, - TargetAddPayload targetAddPayload) throws Exception { + public AddMultistreamTargetResponse addMultistreamTarget(String id, TargetAddPayload targetAddPayload) { AddMultistreamTargetRequest request = AddMultistreamTargetRequest .builder() .id(id) .targetAddPayload(targetAddPayload) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - AddMultistreamTargetRequest.class, - _baseUrl, - "/stream/{id}/create-multistream-target", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "targetAddPayload", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "addMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "addMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "addMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "addMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - AddMultistreamTargetResponse.Builder _resBuilder = - AddMultistreamTargetResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - AddMultistreamTargetResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new AddMultistreamTarget.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Remove a multistream target + * * @return The call builder */ public RemoveMultistreamTargetRequestBuilder removeMultistreamTarget() { - return new RemoveMultistreamTargetRequestBuilder(this); + return new RemoveMultistreamTargetRequestBuilder(sdkConfiguration); } /** * Remove a multistream target + * * @param id ID of the parent stream * @param targetId ID of the multistream target * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public RemoveMultistreamTargetResponse removeMultistreamTarget( - String id, - String targetId) throws Exception { + public RemoveMultistreamTargetResponse removeMultistreamTarget(String id, String targetId) { RemoveMultistreamTargetRequest request = RemoveMultistreamTargetRequest .builder() .id(id) .targetId(targetId) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - RemoveMultistreamTargetRequest.class, - _baseUrl, - "/stream/{id}/multistream/{targetId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "DELETE"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "removeMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "removeMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "removeMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "removeMultistreamTarget", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - RemoveMultistreamTargetResponse.Builder _resBuilder = - RemoveMultistreamTargetResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - RemoveMultistreamTargetResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) { - // no content - return _res; - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new RemoveMultistreamTarget.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/Task.java b/src/main/java/studio/livepeer/livepeer/Task.java index fd634d91..ce893076 100644 --- a/src/main/java/studio/livepeer/livepeer/Task.java +++ b/src/main/java/studio/livepeer/livepeer/Task.java @@ -1,295 +1,89 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; -import com.fasterxml.jackson.core.type.TypeReference; -import java.io.InputStream; -import java.lang.Exception; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.List; -import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.GetTaskRequest; import studio.livepeer.livepeer.models.operations.GetTaskRequestBuilder; import studio.livepeer.livepeer.models.operations.GetTaskResponse; import studio.livepeer.livepeer.models.operations.GetTasksRequestBuilder; import studio.livepeer.livepeer.models.operations.GetTasksResponse; -import studio.livepeer.livepeer.models.operations.SDKMethodInterfaces.*; -import studio.livepeer.livepeer.utils.HTTPClient; -import studio.livepeer.livepeer.utils.HTTPRequest; -import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; -import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; -import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; -import studio.livepeer.livepeer.utils.Utils; +import studio.livepeer.livepeer.operations.GetTask; +import studio.livepeer.livepeer.operations.GetTasks; +import studio.livepeer.livepeer.utils.Headers; /** * Operations related to tasks api */ -public class Task implements - MethodCallGetTasks, - MethodCallGetTask { - +public class Task { + private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; + private final AsyncTask asyncSDK; Task(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncTask(this, sdkConfiguration); } + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncTask async() { + return asyncSDK; + } /** * Retrieve Tasks + * * @return The call builder */ public GetTasksRequestBuilder getAll() { - return new GetTasksRequestBuilder(this); + return new GetTasksRequestBuilder(sdkConfiguration); } /** * Retrieve Tasks + * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetTasksResponse getAllDirect() throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/task"); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getTasks", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getTasks", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getTasks", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getTasks", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetTasksResponse.Builder _resBuilder = - GetTasksResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetTasksResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public GetTasksResponse getAllDirect() { + RequestlessOperation operation + = new GetTasks.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest()); } - - /** * Retrieve a Task + * * @return The call builder */ public GetTaskRequestBuilder get() { - return new GetTaskRequestBuilder(this); + return new GetTaskRequestBuilder(sdkConfiguration); } /** * Retrieve a Task + * * @param taskId ID of the task * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetTaskResponse get( - String taskId) throws Exception { + public GetTaskResponse get(String taskId) { GetTaskRequest request = GetTaskRequest .builder() .taskId(taskId) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetTaskRequest.class, - _baseUrl, - "/task/{taskId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getTask", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getTask", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getTask", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getTask", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetTaskResponse.Builder _resBuilder = - GetTaskResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetTaskResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.Task _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withTask(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - // no content - return _res; - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetTask.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/Transcode.java b/src/main/java/studio/livepeer/livepeer/Transcode.java index c6b66686..ceec6fb4 100644 --- a/src/main/java/studio/livepeer/livepeer/Transcode.java +++ b/src/main/java/studio/livepeer/livepeer/Transcode.java @@ -1,50 +1,42 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; -import com.fasterxml.jackson.core.type.TypeReference; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.Object; -import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.List; -import java.util.Optional; -import studio.livepeer.livepeer.models.components.Task; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import studio.livepeer.livepeer.models.components.TranscodePayload; -import studio.livepeer.livepeer.models.errors.Error; -import studio.livepeer.livepeer.models.errors.SDKError; -import studio.livepeer.livepeer.models.operations.SDKMethodInterfaces.*; import studio.livepeer.livepeer.models.operations.TranscodeVideoRequestBuilder; import studio.livepeer.livepeer.models.operations.TranscodeVideoResponse; -import studio.livepeer.livepeer.utils.HTTPClient; -import studio.livepeer.livepeer.utils.HTTPRequest; -import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; -import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; -import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; -import studio.livepeer.livepeer.utils.SerializedBody; -import studio.livepeer.livepeer.utils.Utils.JsonShape; -import studio.livepeer.livepeer.utils.Utils; +import studio.livepeer.livepeer.operations.TranscodeVideo; +import studio.livepeer.livepeer.utils.Headers; /** * Operations related to transcode api */ -public class Transcode implements - MethodCallTranscodeVideo { - +public class Transcode { + private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; + private final AsyncTranscode asyncSDK; Transcode(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncTranscode(this, sdkConfiguration); } + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncTranscode async() { + return asyncSDK; + } /** * Transcode a video - * `POST /transcode` transcodes a video file and uploads the results to the + * + *

`POST /transcode` transcodes a video file and uploads the results to the * specified storage service. * \ * \ @@ -74,14 +66,14 @@ public class Transcode implements * A public HTTP URL can be used to read a video file. * ```json * { - * "url": "https://www.example.com/video.mp4" + * "url": "https://www.example.com/video.mp4" * } * ``` * | Name | Type | Description | * | ---- | ------ | ------------------------------------ | * | url | string | A public HTTP URL for the video file. | * - * Note: For IPFS HTTP gateway URLs, the API currently only supports “path + *

Note: For IPFS HTTP gateway URLs, the API currently only supports “path * style” URLs and does not support “subdomain style” URLs. The API will * support both styles of URLs in a future update. * \ @@ -92,21 +84,20 @@ public class Transcode implements * S3 credentials can be used to authenticate with a S3 API compatible * service to read a video file. * - * ```json + *

```json * { - * "type": "s3", - * "endpoint": "https://gateway.storjshare.io", - * "credentials": { - * "accessKeyId": "$ACCESS_KEY_ID", - * "secretAccessKey": "$SECRET_ACCESS_KEY" - * }, - * "bucket": "inbucket", - * "path": "/video/source.mp4" + * "type": "s3", + * "endpoint": "https://gateway.storjshare.io", + * "credentials": { + * "accessKeyId": "$ACCESS_KEY_ID", + * "secretAccessKey": "$SECRET_ACCESS_KEY" + * }, + * "bucket": "inbucket", + * "path": "/video/source.mp4" * } * ``` * - * - * ## Storage + *

## Storage * \ * This endpoint currently supports the following storage services: * - S3 API Compatible Service @@ -116,65 +107,63 @@ public class Transcode implements * **S3 API Compatible Service** * ```json * { - * "type": "s3", - * "endpoint": "https://gateway.storjshare.io", - * "credentials": { - * "accessKeyId": "$ACCESS_KEY_ID", - * "secretAccessKey": "$SECRET_ACCESS_KEY" - * }, - * "bucket": "mybucket" + * "type": "s3", + * "endpoint": "https://gateway.storjshare.io", + * "credentials": { + * "accessKeyId": "$ACCESS_KEY_ID", + * "secretAccessKey": "$SECRET_ACCESS_KEY" + * }, + * "bucket": "mybucket" * } * ``` * - * **Web3 Storage** + *

**Web3 Storage** * - * ```json + *

```json * { - * "type": "web3.storage", - * "credentials": { - * "proof": "$UCAN_DELEGATION_PROOF", - * } + * "type": "web3.storage", + * "credentials": { + * "proof": "$UCAN_DELEGATION_PROOF", + * } * } * ``` * - * - * - * ## Outputs + *

## Outputs * \ * This endpoint currently supports the following output types: * - HLS * - MP4 * - * **HLS** + *

**HLS** * - * ```json + *

```json * { - * "hls": { - * "path": "/samplevideo/hls" - * } + * "hls": { + * "path": "/samplevideo/hls" + * } * } * ``` * + *

**MP4** * - * **MP4** - * - * ```json + *

```json * { - * "mp4": { - * "path": "/samplevideo/mp4" - * } + * "mp4": { + * "path": "/samplevideo/mp4" + * } * } * ``` * * @return The call builder */ public TranscodeVideoRequestBuilder create() { - return new TranscodeVideoRequestBuilder(this); + return new TranscodeVideoRequestBuilder(sdkConfiguration); } /** * Transcode a video - * `POST /transcode` transcodes a video file and uploads the results to the + * + *

`POST /transcode` transcodes a video file and uploads the results to the * specified storage service. * \ * \ @@ -204,14 +193,14 @@ public TranscodeVideoRequestBuilder create() { * A public HTTP URL can be used to read a video file. * ```json * { - * "url": "https://www.example.com/video.mp4" + * "url": "https://www.example.com/video.mp4" * } * ``` * | Name | Type | Description | * | ---- | ------ | ------------------------------------ | * | url | string | A public HTTP URL for the video file. | * - * Note: For IPFS HTTP gateway URLs, the API currently only supports “path + *

Note: For IPFS HTTP gateway URLs, the API currently only supports “path * style” URLs and does not support “subdomain style” URLs. The API will * support both styles of URLs in a future update. * \ @@ -222,21 +211,20 @@ public TranscodeVideoRequestBuilder create() { * S3 credentials can be used to authenticate with a S3 API compatible * service to read a video file. * - * ```json + *

```json * { - * "type": "s3", - * "endpoint": "https://gateway.storjshare.io", - * "credentials": { - * "accessKeyId": "$ACCESS_KEY_ID", - * "secretAccessKey": "$SECRET_ACCESS_KEY" - * }, - * "bucket": "inbucket", - * "path": "/video/source.mp4" + * "type": "s3", + * "endpoint": "https://gateway.storjshare.io", + * "credentials": { + * "accessKeyId": "$ACCESS_KEY_ID", + * "secretAccessKey": "$SECRET_ACCESS_KEY" + * }, + * "bucket": "inbucket", + * "path": "/video/source.mp4" * } * ``` * - * - * ## Storage + *

## Storage * \ * This endpoint currently supports the following storage services: * - S3 API Compatible Service @@ -246,184 +234,61 @@ public TranscodeVideoRequestBuilder create() { * **S3 API Compatible Service** * ```json * { - * "type": "s3", - * "endpoint": "https://gateway.storjshare.io", - * "credentials": { - * "accessKeyId": "$ACCESS_KEY_ID", - * "secretAccessKey": "$SECRET_ACCESS_KEY" - * }, - * "bucket": "mybucket" + * "type": "s3", + * "endpoint": "https://gateway.storjshare.io", + * "credentials": { + * "accessKeyId": "$ACCESS_KEY_ID", + * "secretAccessKey": "$SECRET_ACCESS_KEY" + * }, + * "bucket": "mybucket" * } * ``` * - * **Web3 Storage** + *

**Web3 Storage** * - * ```json + *

```json * { - * "type": "web3.storage", - * "credentials": { - * "proof": "$UCAN_DELEGATION_PROOF", - * } + * "type": "web3.storage", + * "credentials": { + * "proof": "$UCAN_DELEGATION_PROOF", + * } * } * ``` * - * - * - * ## Outputs + *

## Outputs * \ * This endpoint currently supports the following output types: * - HLS * - MP4 * - * **HLS** + *

**HLS** * - * ```json + *

```json * { - * "hls": { - * "path": "/samplevideo/hls" - * } + * "hls": { + * "path": "/samplevideo/hls" + * } * } * ``` * + *

**MP4** * - * **MP4** - * - * ```json + *

```json * { - * "mp4": { - * "path": "/samplevideo/mp4" - * } + * "mp4": { + * "path": "/samplevideo/mp4" + * } * } * ``` * - * @param request The request object containing all of the parameters for the API call. + * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public TranscodeVideoResponse create( - TranscodePayload request) throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/transcode"); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "request", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "transcodeVideo", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "transcodeVideo", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "transcodeVideo", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "transcodeVideo", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - TranscodeVideoResponse.Builder _resBuilder = - TranscodeVideoResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - TranscodeVideoResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Task _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withTask(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public TranscodeVideoResponse create(TranscodePayload request) { + RequestOperation operation + = new TranscodeVideo.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/Webhook.java b/src/main/java/studio/livepeer/livepeer/Webhook.java index 8ca36b18..218053ff 100644 --- a/src/main/java/studio/livepeer/livepeer/Webhook.java +++ b/src/main/java/studio/livepeer/livepeer/Webhook.java @@ -1,22 +1,13 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer; -import com.fasterxml.jackson.core.type.TypeReference; -import java.io.InputStream; -import java.lang.Exception; -import java.lang.Object; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.util.List; -import java.util.Optional; import studio.livepeer.livepeer.models.components.WebhookInput; -import studio.livepeer.livepeer.models.components.WebhookLog; -import studio.livepeer.livepeer.models.errors.Error; -import studio.livepeer.livepeer.models.errors.SDKError; import studio.livepeer.livepeer.models.operations.CreateWebhookRequestBuilder; import studio.livepeer.livepeer.models.operations.CreateWebhookResponse; import studio.livepeer.livepeer.models.operations.DeleteWebhookRequest; @@ -36,1160 +27,264 @@ import studio.livepeer.livepeer.models.operations.ResendWebhookRequest; import studio.livepeer.livepeer.models.operations.ResendWebhookRequestBuilder; import studio.livepeer.livepeer.models.operations.ResendWebhookResponse; -import studio.livepeer.livepeer.models.operations.SDKMethodInterfaces.*; import studio.livepeer.livepeer.models.operations.UpdateWebhookRequest; import studio.livepeer.livepeer.models.operations.UpdateWebhookRequestBuilder; import studio.livepeer.livepeer.models.operations.UpdateWebhookResponse; -import studio.livepeer.livepeer.utils.HTTPClient; -import studio.livepeer.livepeer.utils.HTTPRequest; -import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; -import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; -import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; -import studio.livepeer.livepeer.utils.SerializedBody; -import studio.livepeer.livepeer.utils.Utils.JsonShape; -import studio.livepeer.livepeer.utils.Utils; +import studio.livepeer.livepeer.operations.CreateWebhook; +import studio.livepeer.livepeer.operations.DeleteWebhook; +import studio.livepeer.livepeer.operations.GetWebhook; +import studio.livepeer.livepeer.operations.GetWebhookLog; +import studio.livepeer.livepeer.operations.GetWebhookLogs; +import studio.livepeer.livepeer.operations.GetWebhooks; +import studio.livepeer.livepeer.operations.ResendWebhook; +import studio.livepeer.livepeer.operations.UpdateWebhook; +import studio.livepeer.livepeer.utils.Headers; /** * Operations related to webhook api */ -public class Webhook implements - MethodCallGetWebhooks, - MethodCallCreateWebhook, - MethodCallGetWebhook, - MethodCallUpdateWebhook, - MethodCallDeleteWebhook, - MethodCallGetWebhookLogs, - MethodCallGetWebhookLog, - MethodCallResendWebhook { - +public class Webhook { + private static final Headers _headers = Headers.EMPTY; private final SDKConfiguration sdkConfiguration; + private final AsyncWebhook asyncSDK; Webhook(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; + this.asyncSDK = new AsyncWebhook(this, sdkConfiguration); } + /** + * Switches to the async SDK. + * + * @return The async SDK + */ + public AsyncWebhook async() { + return asyncSDK; + } /** * Retrieve a Webhook + * * @return The call builder */ public GetWebhooksRequestBuilder getAll() { - return new GetWebhooksRequestBuilder(this); + return new GetWebhooksRequestBuilder(sdkConfiguration); } /** * Retrieve a Webhook + * * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWebhooksResponse getAllDirect() throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/webhook"); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getWebhooks", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getWebhooks", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getWebhooks", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getWebhooks", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetWebhooksResponse.Builder _resBuilder = - GetWebhooksResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetWebhooksResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public GetWebhooksResponse getAllDirect() { + RequestlessOperation operation + = new GetWebhooks.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest()); } - - /** * Create a webhook - * To create a new webhook, you need to make an API call with the events you want to listen for and the URL that will be called when those events occur. + * + *

To create a new webhook, you need to make an API call with the events you want to listen for and the + * URL that will be called when those events occur. * * @return The call builder */ public CreateWebhookRequestBuilder create() { - return new CreateWebhookRequestBuilder(this); + return new CreateWebhookRequestBuilder(sdkConfiguration); } /** * Create a webhook - * To create a new webhook, you need to make an API call with the events you want to listen for and the URL that will be called when those events occur. * - * @param request The request object containing all of the parameters for the API call. + *

To create a new webhook, you need to make an API call with the events you want to listen for and the + * URL that will be called when those events occur. + * + * @param request The request object containing all the parameters for the API call. * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public CreateWebhookResponse create( - WebhookInput request) throws Exception { - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - _baseUrl, - "/webhook"); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "request", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "createWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "createWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "createWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - CreateWebhookResponse.Builder _resBuilder = - CreateWebhookResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - CreateWebhookResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.Webhook _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withWebhook(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + public CreateWebhookResponse create(WebhookInput request) { + RequestOperation operation + = new CreateWebhook.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Retrieve a webhook + * * @return The call builder */ public GetWebhookRequestBuilder get() { - return new GetWebhookRequestBuilder(this); + return new GetWebhookRequestBuilder(sdkConfiguration); } /** * Retrieve a webhook - * @param id + * + * @param id * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWebhookResponse get( - String id) throws Exception { + public GetWebhookResponse get(String id) { GetWebhookRequest request = GetWebhookRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetWebhookRequest.class, - _baseUrl, - "/webhook/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetWebhookResponse.Builder _resBuilder = - GetWebhookResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetWebhookResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.Webhook _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withWebhook(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetWebhook.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Update a webhook + * * @return The call builder */ public UpdateWebhookRequestBuilder update() { - return new UpdateWebhookRequestBuilder(this); + return new UpdateWebhookRequestBuilder(sdkConfiguration); } /** * Update a webhook - * @param id - * @param webhook + * + * @param id + * @param webhook * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public UpdateWebhookResponse update( - String id, - WebhookInput webhook) throws Exception { + public UpdateWebhookResponse update(String id, WebhookInput webhook) { UpdateWebhookRequest request = UpdateWebhookRequest .builder() .id(id) .webhook(webhook) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - UpdateWebhookRequest.class, - _baseUrl, - "/webhook/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "PUT"); - Object _convertedRequest = Utils.convertToShape( - request, - JsonShape.DEFAULT, - new TypeReference() {}); - SerializedBody _serializedRequestBody = Utils.serializeRequestBody( - _convertedRequest, - "webhook", - "json", - false); - if (_serializedRequestBody == null) { - throw new Exception("Request body is required"); - } - _req.setBody(Optional.ofNullable(_serializedRequestBody)); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "updateWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "updateWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "updateWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "updateWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - UpdateWebhookResponse.Builder _resBuilder = - UpdateWebhookResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - UpdateWebhookResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.Webhook _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withWebhook(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new UpdateWebhook.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Delete a webhook + * * @return The call builder */ public DeleteWebhookRequestBuilder delete() { - return new DeleteWebhookRequestBuilder(this); + return new DeleteWebhookRequestBuilder(sdkConfiguration); } /** * Delete a webhook - * @param id + * + * @param id * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public DeleteWebhookResponse delete( - String id) throws Exception { + public DeleteWebhookResponse delete(String id) { DeleteWebhookRequest request = DeleteWebhookRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - DeleteWebhookRequest.class, - _baseUrl, - "/webhook/{id}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "DELETE"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "deleteWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "deleteWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "deleteWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - DeleteWebhookResponse.Builder _resBuilder = - DeleteWebhookResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - DeleteWebhookResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - studio.livepeer.livepeer.models.components.Webhook _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withWebhook(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new DeleteWebhook.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Retrieve webhook logs + * * @return The call builder */ public GetWebhookLogsRequestBuilder getLogs() { - return new GetWebhookLogsRequestBuilder(this); + return new GetWebhookLogsRequestBuilder(sdkConfiguration); } /** * Retrieve webhook logs - * @param id + * + * @param id * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWebhookLogsResponse getLogs( - String id) throws Exception { + public GetWebhookLogsResponse getLogs(String id) { GetWebhookLogsRequest request = GetWebhookLogsRequest .builder() .id(id) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetWebhookLogsRequest.class, - _baseUrl, - "/webhook/{id}/log", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getWebhookLogs", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getWebhookLogs", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getWebhookLogs", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getWebhookLogs", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetWebhookLogsResponse.Builder _resBuilder = - GetWebhookLogsResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetWebhookLogsResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - List _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference>() {}); - _res.withData(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetWebhookLogs.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Retrieve a webhook log + * * @return The call builder */ public GetWebhookLogRequestBuilder getLog() { - return new GetWebhookLogRequestBuilder(this); + return new GetWebhookLogRequestBuilder(sdkConfiguration); } /** * Retrieve a webhook log - * @param id - * @param logId + * + * @param id + * @param logId * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public GetWebhookLogResponse getLog( - String id, - String logId) throws Exception { + public GetWebhookLogResponse getLog(String id, String logId) { GetWebhookLogRequest request = GetWebhookLogRequest .builder() .id(id) .logId(logId) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - GetWebhookLogRequest.class, - _baseUrl, - "/webhook/{id}/log/{logId}", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "GET"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "getWebhookLog", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getWebhookLog", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "getWebhookLog", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "getWebhookLog", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - GetWebhookLogResponse.Builder _resBuilder = - GetWebhookLogResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - GetWebhookLogResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - WebhookLog _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withWebhookLog(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new GetWebhookLog.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } - - /** * Resend a webhook - * Use this API to resend the same webhook request. This is useful when + * + *

Use this API to resend the same webhook request. This is useful when * developing and debugging, allowing you to easily repeat the same webhook * to check or fix the behaviour in your handler. * * @return The call builder */ public ResendWebhookRequestBuilder resendLog() { - return new ResendWebhookRequestBuilder(this); + return new ResendWebhookRequestBuilder(sdkConfiguration); } /** * Resend a webhook - * Use this API to resend the same webhook request. This is useful when + * + *

Use this API to resend the same webhook request. This is useful when * developing and debugging, allowing you to easily repeat the same webhook * to check or fix the behaviour in your handler. * - * @param id - * @param logId + * @param id + * @param logId * @return The response from the API call - * @throws Exception if the API call fails + * @throws RuntimeException subclass if the API call fails */ - public ResendWebhookResponse resendLog( - String id, - String logId) throws Exception { + public ResendWebhookResponse resendLog(String id, String logId) { ResendWebhookRequest request = ResendWebhookRequest .builder() .id(id) .logId(logId) .build(); - - String _baseUrl = this.sdkConfiguration.serverUrl; - String _url = Utils.generateURL( - ResendWebhookRequest.class, - _baseUrl, - "/webhook/{id}/log/{logId}/resend", - request, null); - - HTTPRequest _req = new HTTPRequest(_url, "POST"); - _req.addHeader("Accept", "application/json") - .addHeader("user-agent", - this.sdkConfiguration.userAgent); - - Utils.configureSecurity(_req, - this.sdkConfiguration.securitySource.getSecurity()); - - HTTPClient _client = this.sdkConfiguration.defaultClient; - HttpRequest _r = - sdkConfiguration.hooks() - .beforeRequest( - new BeforeRequestContextImpl( - "resendWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _req.build()); - HttpResponse _httpRes; - try { - _httpRes = _client.send(_r); - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "resendWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.of(_httpRes), - Optional.empty()); - } else { - _httpRes = sdkConfiguration.hooks() - .afterSuccess( - new AfterSuccessContextImpl( - "resendWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - _httpRes); - } - } catch (Exception _e) { - _httpRes = sdkConfiguration.hooks() - .afterError( - new AfterErrorContextImpl( - "resendWebhook", - Optional.of(List.of()), - sdkConfiguration.securitySource()), - Optional.empty(), - Optional.of(_e)); - } - String _contentType = _httpRes - .headers() - .firstValue("Content-Type") - .orElse("application/octet-stream"); - ResendWebhookResponse.Builder _resBuilder = - ResendWebhookResponse - .builder() - .contentType(_contentType) - .statusCode(_httpRes.statusCode()) - .rawResponse(_httpRes); - - ResendWebhookResponse _res = _resBuilder.build(); - - if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - WebhookLog _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withWebhookLog(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX", "5XX")) { - // no content - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "API error occurred", - Utils.extractByteArrayFromBody(_httpRes)); - } - if (Utils.statusCodeMatches(_httpRes.statusCode(), "default")) { - if (Utils.contentTypeMatches(_contentType, "application/json")) { - Error _out = Utils.mapper().readValue( - Utils.toUtf8AndClose(_httpRes.body()), - new TypeReference() {}); - _res.withError(Optional.ofNullable(_out)); - return _res; - } else { - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected content-type received: " + _contentType, - Utils.extractByteArrayFromBody(_httpRes)); - } - } - throw new SDKError( - _httpRes, - _httpRes.statusCode(), - "Unexpected status code received: " + _httpRes.statusCode(), - Utils.extractByteArrayFromBody(_httpRes)); + RequestOperation operation + = new ResendWebhook.Sync(sdkConfiguration, _headers); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/hooks/SDKHooks.java b/src/main/java/studio/livepeer/livepeer/hooks/SDKHooks.java index aebf85cb..7690bf34 100644 --- a/src/main/java/studio/livepeer/livepeer/hooks/SDKHooks.java +++ b/src/main/java/studio/livepeer/livepeer/hooks/SDKHooks.java @@ -1,11 +1,7 @@ -/* - * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - */ - package studio.livepeer.livepeer.hooks; // -// This file is written once by speakeasy code generation and +// This file is written once by speakeasy code generation and // thereafter will not be overwritten by speakeasy updates. As a // consequence any customization of this class will be preserved. // @@ -16,11 +12,31 @@ private SDKHooks() { // prevent instantiation } - public static final void initialize(studio.livepeer.livepeer.utils.Hooks hooks) { - // register hooks here + public static void initialize(studio.livepeer.livepeer.utils.Hooks hooks) { + // register synchronous hooks here + // hooks.registerBeforeRequest(...); + // hooks.registerAfterSuccess(...); + // hooks.registerAfterError(...); + + // for more information see + // https://www.speakeasy.com/docs/additional-features/sdk-hooks + } + + public static void initialize(studio.livepeer.livepeer.utils.AsyncHooks asyncHooks) { + // register async hooks here + // asyncHooks.registerBeforeRequest(...); + // asyncHooks.registerAfterSuccess(...); + // asyncHooks.registerAfterError(...); + + // NOTE: If you have existing synchronous hooks, you can adapt them using HookAdapters: + // asyncHooks.registerAfterError(studio.livepeer.livepeer.utils.HookAdapters.adapt(mySyncHook)); + // PERFORMANCE TIP: For better performance, implement async hooks directly using + // non-blocking I/O (NIO) APIs instead of adapting synchronous hooks, as adapters + // offload execution to the ForkJoinPool which can introduce overhead. + // for more information see - // https://www.speakeasyapi.dev/docs/additional-features/sdk-hooks + // https://www.speakeasy.com/docs/additional-features/sdk-hooks } - + } diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Asset.java b/src/main/java/studio/livepeer/livepeer/models/components/Asset.java index e1f54422..2b9635dc 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Asset.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Asset.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -16,7 +14,6 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; @@ -42,6 +39,7 @@ public class Asset { private Optional playbackId; /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -50,14 +48,17 @@ public class Asset { private Optional userId; /** - * 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). + * 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). */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("playbackUrl") private Optional playbackUrl; /** - * The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. It is not recommended to use this for playback. + * The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. + * It is not recommended to use this for playback. */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("downloadUrl") @@ -70,9 +71,11 @@ public class Asset { @JsonProperty("playbackPolicy") private JsonNullable playbackPolicy; + @JsonProperty("source") private Source source; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("creatorId") private Optional creatorId; @@ -83,12 +86,12 @@ public class Asset { * field for recordings. If not specified, default profiles are derived * based on the source input. If this is a recording, the source will * not be present in this list but will be available for playback. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("profiles") private Optional> profiles; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("storage") private Optional storage; @@ -102,7 +105,6 @@ public class Asset { /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ @JsonProperty("name") private String name; @@ -214,7 +216,13 @@ public Asset( String id, Source source, String name) { - this(id, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), JsonNullable.undefined(), source, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), name, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), JsonNullable.undefined(), Optional.empty()); + this(id, Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + JsonNullable.undefined(), source, Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + name, Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), JsonNullable.undefined(), + Optional.empty()); } @JsonIgnore @@ -240,6 +248,7 @@ public Optional playbackId() { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -249,7 +258,9 @@ public Optional userId() { } /** - * 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). + * 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). */ @JsonIgnore public Optional playbackUrl() { @@ -257,7 +268,8 @@ public Optional playbackUrl() { } /** - * The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. It is not recommended to use this for playback. + * The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. + * It is not recommended to use this for playback. */ @JsonIgnore public Optional downloadUrl() { @@ -290,7 +302,6 @@ public Optional creatorId() { * field for recordings. If not specified, default profiles are derived * based on the source input. If this is a recording, the source will * not be present in this list but will be available for playback. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -315,7 +326,6 @@ public Optional status() { /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ @JsonIgnore public String name() { @@ -372,10 +382,11 @@ public Optional videoSpec() { return (Optional) videoSpec; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Asset withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -391,6 +402,7 @@ public Asset withType(AssetType type) { return this; } + /** * Type of the asset. */ @@ -409,6 +421,7 @@ public Asset withPlaybackId(String playbackId) { return this; } + /** * The playback ID to use with the Playback Info endpoint to retrieve playback URLs. */ @@ -419,6 +432,7 @@ public Asset withPlaybackId(Optional playbackId) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -428,7 +442,9 @@ public Asset withUserId(String userId) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -439,7 +455,9 @@ public Asset withUserId(Optional userId) { } /** - * 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). + * 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). */ public Asset withPlaybackUrl(String playbackUrl) { Utils.checkNotNull(playbackUrl, "playbackUrl"); @@ -447,8 +465,11 @@ public Asset withPlaybackUrl(String playbackUrl) { return this; } + /** - * 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). + * 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). */ public Asset withPlaybackUrl(Optional playbackUrl) { Utils.checkNotNull(playbackUrl, "playbackUrl"); @@ -457,7 +478,8 @@ public Asset withPlaybackUrl(Optional playbackUrl) { } /** - * The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. It is not recommended to use this for playback. + * The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. + * It is not recommended to use this for playback. */ public Asset withDownloadUrl(String downloadUrl) { Utils.checkNotNull(downloadUrl, "downloadUrl"); @@ -465,8 +487,10 @@ public Asset withDownloadUrl(String downloadUrl) { return this; } + /** - * The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. It is not recommended to use this for playback. + * The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. + * It is not recommended to use this for playback. */ public Asset withDownloadUrl(Optional downloadUrl) { Utils.checkNotNull(downloadUrl, "downloadUrl"); @@ -504,6 +528,7 @@ public Asset withCreatorId(CreatorId creatorId) { return this; } + public Asset withCreatorId(Optional creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = creatorId; @@ -516,7 +541,6 @@ public Asset withCreatorId(Optional creatorId) { * field for recordings. If not specified, default profiles are derived * based on the source input. If this is a recording, the source will * not be present in this list but will be available for playback. - * */ public Asset withProfiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -524,13 +548,13 @@ public Asset withProfiles(List profiles) { return this; } + /** * Requested profiles for the asset to be transcoded into. Configured * on the upload APIs payload or through the `stream.recordingSpec` * field for recordings. If not specified, default profiles are derived * based on the source input. If this is a recording, the source will * not be present in this list but will be available for playback. - * */ public Asset withProfiles(Optional> profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -544,6 +568,7 @@ public Asset withStorage(AssetStorage storage) { return this; } + public Asset withStorage(Optional storage) { Utils.checkNotNull(storage, "storage"); this.storage = storage; @@ -559,6 +584,7 @@ public Asset withStatus(AssetStatus status) { return this; } + /** * Status of the asset */ @@ -570,7 +596,6 @@ public Asset withStatus(Optional status) { /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ public Asset withName(String name) { Utils.checkNotNull(name, "name"); @@ -587,6 +612,7 @@ public Asset withProjectId(String projectId) { return this; } + /** * The ID of the project */ @@ -605,6 +631,7 @@ public Asset withCreatedAt(double createdAt) { return this; } + /** * Timestamp (in milliseconds) at which asset was created */ @@ -623,6 +650,7 @@ public Asset withCreatedByTokenName(String createdByTokenName) { return this; } + /** * Name of the token used to create this object */ @@ -641,6 +669,7 @@ public Asset withSize(double size) { return this; } + /** * Size of the asset in bytes */ @@ -677,6 +706,7 @@ public Asset withVideoSpec(VideoSpec videoSpec) { return this; } + /** * Video metadata */ @@ -685,7 +715,7 @@ public Asset withVideoSpec(Optional videoSpec) { this.videoSpec = videoSpec; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -696,48 +726,36 @@ public boolean equals(java.lang.Object o) { } Asset other = (Asset) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.playbackId, other.playbackId) && - Objects.deepEquals(this.userId, other.userId) && - Objects.deepEquals(this.playbackUrl, other.playbackUrl) && - Objects.deepEquals(this.downloadUrl, other.downloadUrl) && - Objects.deepEquals(this.playbackPolicy, other.playbackPolicy) && - Objects.deepEquals(this.source, other.source) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.profiles, other.profiles) && - Objects.deepEquals(this.storage, other.storage) && - Objects.deepEquals(this.status, other.status) && - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.projectId, other.projectId) && - Objects.deepEquals(this.createdAt, other.createdAt) && - Objects.deepEquals(this.createdByTokenName, other.createdByTokenName) && - Objects.deepEquals(this.size, other.size) && - Objects.deepEquals(this.hash, other.hash) && - Objects.deepEquals(this.videoSpec, other.videoSpec); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.playbackId, other.playbackId) && + Utils.enhancedDeepEquals(this.userId, other.userId) && + Utils.enhancedDeepEquals(this.playbackUrl, other.playbackUrl) && + Utils.enhancedDeepEquals(this.downloadUrl, other.downloadUrl) && + Utils.enhancedDeepEquals(this.playbackPolicy, other.playbackPolicy) && + Utils.enhancedDeepEquals(this.source, other.source) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.profiles, other.profiles) && + Utils.enhancedDeepEquals(this.storage, other.storage) && + Utils.enhancedDeepEquals(this.status, other.status) && + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.projectId, other.projectId) && + Utils.enhancedDeepEquals(this.createdAt, other.createdAt) && + Utils.enhancedDeepEquals(this.createdByTokenName, other.createdByTokenName) && + Utils.enhancedDeepEquals(this.size, other.size) && + Utils.enhancedDeepEquals(this.hash, other.hash) && + Utils.enhancedDeepEquals(this.videoSpec, other.videoSpec); } @Override public int hashCode() { - return Objects.hash( - id, - type, - playbackId, - userId, - playbackUrl, - downloadUrl, - playbackPolicy, - source, - creatorId, - profiles, - storage, - status, - name, - projectId, - createdAt, - createdByTokenName, - size, - hash, + return Utils.enhancedHash( + id, type, playbackId, + userId, playbackUrl, downloadUrl, + playbackPolicy, source, creatorId, + profiles, storage, status, + name, projectId, createdAt, + createdByTokenName, size, hash, videoSpec); } @@ -764,58 +782,61 @@ public String toString() { "hash", hash, "videoSpec", videoSpec); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - + private Optional type = Optional.empty(); - + private Optional playbackId = Optional.empty(); - + @Deprecated private Optional userId = Optional.empty(); - + private Optional playbackUrl = Optional.empty(); - + private Optional downloadUrl = Optional.empty(); - + private JsonNullable playbackPolicy = JsonNullable.undefined(); - + private Source source; - + private Optional creatorId = Optional.empty(); - + private Optional> profiles = Optional.empty(); - + private Optional storage = Optional.empty(); - + private Optional status = Optional.empty(); - + private String name; - + private Optional projectId = Optional.empty(); - + private Optional createdAt = Optional.empty(); - + private Optional createdByTokenName = Optional.empty(); - + private Optional size = Optional.empty(); - + private JsonNullable> hash = JsonNullable.undefined(); - - private Optional videoSpec = Optional.empty(); - + + private Optional videoSpec = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } + /** * Type of the asset. */ @@ -834,6 +855,7 @@ public Builder type(Optional type) { return this; } + /** * The playback ID to use with the Playback Info endpoint to retrieve playback URLs. */ @@ -852,7 +874,9 @@ public Builder playbackId(Optional playbackId) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -863,6 +887,7 @@ public Builder userId(String userId) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -872,8 +897,11 @@ public Builder userId(Optional userId) { return this; } + /** - * 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). + * 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). */ public Builder playbackUrl(String playbackUrl) { Utils.checkNotNull(playbackUrl, "playbackUrl"); @@ -882,7 +910,9 @@ public Builder playbackUrl(String playbackUrl) { } /** - * 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). + * 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). */ public Builder playbackUrl(Optional playbackUrl) { Utils.checkNotNull(playbackUrl, "playbackUrl"); @@ -890,8 +920,10 @@ public Builder playbackUrl(Optional playbackUrl) { return this; } + /** - * The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. It is not recommended to use this for playback. + * The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. + * It is not recommended to use this for playback. */ public Builder downloadUrl(String downloadUrl) { Utils.checkNotNull(downloadUrl, "downloadUrl"); @@ -900,7 +932,8 @@ public Builder downloadUrl(String downloadUrl) { } /** - * The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. It is not recommended to use this for playback. + * The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. + * It is not recommended to use this for playback. */ public Builder downloadUrl(Optional downloadUrl) { Utils.checkNotNull(downloadUrl, "downloadUrl"); @@ -908,6 +941,7 @@ public Builder downloadUrl(Optional downloadUrl) { return this; } + /** * Whether the playback policy for an asset or stream is public or signed */ @@ -926,12 +960,14 @@ public Builder playbackPolicy(JsonNullable playbackPol return this; } + public Builder source(Source source) { Utils.checkNotNull(source, "source"); this.source = source; return this; } + public Builder creatorId(CreatorId creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = Optional.ofNullable(creatorId); @@ -944,13 +980,13 @@ public Builder creatorId(Optional creatorId) { return this; } + /** * Requested profiles for the asset to be transcoded into. Configured * on the upload APIs payload or through the `stream.recordingSpec` * field for recordings. If not specified, default profiles are derived * based on the source input. If this is a recording, the source will * not be present in this list but will be available for playback. - * */ public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -964,7 +1000,6 @@ public Builder profiles(List profiles) { * field for recordings. If not specified, default profiles are derived * based on the source input. If this is a recording, the source will * not be present in this list but will be available for playback. - * */ public Builder profiles(Optional> profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -972,6 +1007,7 @@ public Builder profiles(Optional> profiles) { return this; } + public Builder storage(AssetStorage storage) { Utils.checkNotNull(storage, "storage"); this.storage = Optional.ofNullable(storage); @@ -984,6 +1020,7 @@ public Builder storage(Optional storage) { return this; } + /** * Status of the asset */ @@ -1002,9 +1039,9 @@ public Builder status(Optional status) { return this; } + /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ public Builder name(String name) { Utils.checkNotNull(name, "name"); @@ -1012,6 +1049,7 @@ public Builder name(String name) { return this; } + /** * The ID of the project */ @@ -1030,6 +1068,7 @@ public Builder projectId(Optional projectId) { return this; } + /** * Timestamp (in milliseconds) at which asset was created */ @@ -1048,6 +1087,7 @@ public Builder createdAt(Optional createdAt) { return this; } + /** * Name of the token used to create this object */ @@ -1066,6 +1106,7 @@ public Builder createdByTokenName(Optional createdByTokenName) { return this; } + /** * Size of the asset in bytes */ @@ -1084,6 +1125,7 @@ public Builder size(Optional size) { return this; } + /** * Hash of the asset */ @@ -1102,6 +1144,7 @@ public Builder hash(JsonNullable> hash) { return this; } + /** * Video metadata */ @@ -1119,29 +1162,18 @@ public Builder videoSpec(Optional videoSpec) { this.videoSpec = videoSpec; return this; } - + public Asset build() { + return new Asset( - id, - type, - playbackId, - userId, - playbackUrl, - downloadUrl, - playbackPolicy, - source, - creatorId, - profiles, - storage, - status, - name, - projectId, - createdAt, - createdByTokenName, - size, - hash, + id, type, playbackId, + userId, playbackUrl, downloadUrl, + playbackPolicy, source, creatorId, + profiles, storage, status, + name, projectId, createdAt, + createdByTokenName, size, hash, videoSpec); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AssetIpfs.java b/src/main/java/studio/livepeer/livepeer/models/components/AssetIpfs.java index 873dd5bb..5154d2ed 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AssetIpfs.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AssetIpfs.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -15,7 +13,6 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -26,10 +23,12 @@ public class AssetIpfs { @JsonProperty("spec") private Optional spec; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("$ref") private Optional dollarRef; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("nftMetadata") private Optional nftMetadata; @@ -37,7 +36,6 @@ public class AssetIpfs { /** * Timestamp (in milliseconds) at which IPFS export task was * updated - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("updatedAt") @@ -60,7 +58,8 @@ public AssetIpfs( } public AssetIpfs() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } @SuppressWarnings("unchecked") @@ -84,23 +83,24 @@ public Optional nftMetadata() { /** * Timestamp (in milliseconds) at which IPFS export task was * updated - * */ @JsonIgnore public Optional updatedAt() { return updatedAt; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public AssetIpfs withSpec(AssetSpec spec) { Utils.checkNotNull(spec, "spec"); this.spec = Optional.ofNullable(spec); return this; } + public AssetIpfs withSpec(Optional spec) { Utils.checkNotNull(spec, "spec"); this.spec = spec; @@ -113,6 +113,7 @@ public AssetIpfs withDollarRef(Object dollarRef) { return this; } + public AssetIpfs withDollarRef(Optional dollarRef) { Utils.checkNotNull(dollarRef, "dollarRef"); this.dollarRef = dollarRef; @@ -125,6 +126,7 @@ public AssetIpfs withNftMetadata(IpfsFileInfo nftMetadata) { return this; } + public AssetIpfs withNftMetadata(Optional nftMetadata) { Utils.checkNotNull(nftMetadata, "nftMetadata"); this.nftMetadata = nftMetadata; @@ -134,7 +136,6 @@ public AssetIpfs withNftMetadata(Optional nftMetadata) { /** * Timestamp (in milliseconds) at which IPFS export task was * updated - * */ public AssetIpfs withUpdatedAt(double updatedAt) { Utils.checkNotNull(updatedAt, "updatedAt"); @@ -142,17 +143,17 @@ public AssetIpfs withUpdatedAt(double updatedAt) { return this; } + /** * Timestamp (in milliseconds) at which IPFS export task was * updated - * */ public AssetIpfs withUpdatedAt(Optional updatedAt) { Utils.checkNotNull(updatedAt, "updatedAt"); this.updatedAt = updatedAt; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -163,18 +164,16 @@ public boolean equals(java.lang.Object o) { } AssetIpfs other = (AssetIpfs) o; return - Objects.deepEquals(this.spec, other.spec) && - Objects.deepEquals(this.dollarRef, other.dollarRef) && - Objects.deepEquals(this.nftMetadata, other.nftMetadata) && - Objects.deepEquals(this.updatedAt, other.updatedAt); + Utils.enhancedDeepEquals(this.spec, other.spec) && + Utils.enhancedDeepEquals(this.dollarRef, other.dollarRef) && + Utils.enhancedDeepEquals(this.nftMetadata, other.nftMetadata) && + Utils.enhancedDeepEquals(this.updatedAt, other.updatedAt); } @Override public int hashCode() { - return Objects.hash( - spec, - dollarRef, - nftMetadata, + return Utils.enhancedHash( + spec, dollarRef, nftMetadata, updatedAt); } @@ -186,21 +185,23 @@ public String toString() { "nftMetadata", nftMetadata, "updatedAt", updatedAt); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional spec = Optional.empty(); - + private Optional dollarRef = Optional.empty(); - + private Optional nftMetadata = Optional.empty(); - - private Optional updatedAt = Optional.empty(); - + + private Optional updatedAt = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder spec(AssetSpec spec) { Utils.checkNotNull(spec, "spec"); this.spec = Optional.ofNullable(spec); @@ -213,6 +214,7 @@ public Builder spec(Optional spec) { return this; } + public Builder dollarRef(Object dollarRef) { Utils.checkNotNull(dollarRef, "dollarRef"); this.dollarRef = Optional.ofNullable(dollarRef); @@ -225,6 +227,7 @@ public Builder dollarRef(Optional dollarRef) { return this; } + public Builder nftMetadata(IpfsFileInfo nftMetadata) { Utils.checkNotNull(nftMetadata, "nftMetadata"); this.nftMetadata = Optional.ofNullable(nftMetadata); @@ -237,10 +240,10 @@ public Builder nftMetadata(Optional nftMetadata) { return this; } + /** * Timestamp (in milliseconds) at which IPFS export task was * updated - * */ public Builder updatedAt(double updatedAt) { Utils.checkNotNull(updatedAt, "updatedAt"); @@ -251,21 +254,19 @@ public Builder updatedAt(double updatedAt) { /** * Timestamp (in milliseconds) at which IPFS export task was * updated - * */ public Builder updatedAt(Optional updatedAt) { Utils.checkNotNull(updatedAt, "updatedAt"); this.updatedAt = updatedAt; return this; } - + public AssetIpfs build() { + return new AssetIpfs( - spec, - dollarRef, - nftMetadata, + spec, dollarRef, nftMetadata, updatedAt); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AssetNftMetadata.java b/src/main/java/studio/livepeer/livepeer/models/components/AssetNftMetadata.java index 49754efa..9d59225e 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AssetNftMetadata.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AssetNftMetadata.java @@ -1,35 +1,30 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * AssetNftMetadata - Additional data to add to the NFT metadata exported to + * AssetNftMetadata + * + *

Additional data to add to the NFT metadata exported to * IPFS. Will be deep merged with the default metadata * exported. - * */ - public class AssetNftMetadata { - @JsonCreator public AssetNftMetadata() { - - } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } - + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -43,7 +38,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( ); } @@ -51,17 +46,19 @@ public int hashCode() { public String toString() { return Utils.toString(AssetNftMetadata.class); } - - public final static class Builder { - + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + private Builder() { // force use of static builder() method } - + public AssetNftMetadata build() { + return new AssetNftMetadata( ); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AssetNftMetadataTemplate.java b/src/main/java/studio/livepeer/livepeer/models/components/AssetNftMetadataTemplate.java index 114ea73c..5ac431a5 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AssetNftMetadataTemplate.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AssetNftMetadataTemplate.java @@ -1,17 +1,19 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * AssetNftMetadataTemplate - Name of the NFT metadata template to export. 'player' + * AssetNftMetadataTemplate + * + *

Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ public enum AssetNftMetadataTemplate { FILE("file"), @@ -20,11 +22,21 @@ public enum AssetNftMetadataTemplate { @JsonValue private final String value; - private AssetNftMetadataTemplate(String value) { + AssetNftMetadataTemplate(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (AssetNftMetadataTemplate o: AssetNftMetadataTemplate.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AssetPatchPayload.java b/src/main/java/studio/livepeer/livepeer/models/components/AssetPatchPayload.java index 9122183f..26fd616f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AssetPatchPayload.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AssetPatchPayload.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,22 +11,20 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; public class AssetPatchPayload { - /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("name") private Optional name; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("creatorId") private Optional creatorId; @@ -40,6 +36,7 @@ public class AssetPatchPayload { @JsonProperty("playbackPolicy") private JsonNullable playbackPolicy; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("storage") private Optional storage; @@ -61,12 +58,12 @@ public AssetPatchPayload( } public AssetPatchPayload() { - this(Optional.empty(), Optional.empty(), JsonNullable.undefined(), Optional.empty()); + this(Optional.empty(), Optional.empty(), JsonNullable.undefined(), + Optional.empty()); } /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ @JsonIgnore public Optional name() { @@ -94,13 +91,13 @@ public Optional storage() { return (Optional) storage; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ public AssetPatchPayload withName(String name) { Utils.checkNotNull(name, "name"); @@ -108,9 +105,9 @@ public AssetPatchPayload withName(String name) { return this; } + /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ public AssetPatchPayload withName(Optional name) { Utils.checkNotNull(name, "name"); @@ -124,6 +121,7 @@ public AssetPatchPayload withCreatorId(InputCreatorId creatorId) { return this; } + public AssetPatchPayload withCreatorId(Optional creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = creatorId; @@ -154,12 +152,13 @@ public AssetPatchPayload withStorage(Storage storage) { return this; } + public AssetPatchPayload withStorage(Optional storage) { Utils.checkNotNull(storage, "storage"); this.storage = storage; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -170,18 +169,16 @@ public boolean equals(java.lang.Object o) { } AssetPatchPayload other = (AssetPatchPayload) o; return - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.playbackPolicy, other.playbackPolicy) && - Objects.deepEquals(this.storage, other.storage); + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.playbackPolicy, other.playbackPolicy) && + Utils.enhancedDeepEquals(this.storage, other.storage); } @Override public int hashCode() { - return Objects.hash( - name, - creatorId, - playbackPolicy, + return Utils.enhancedHash( + name, creatorId, playbackPolicy, storage); } @@ -193,24 +190,25 @@ public String toString() { "playbackPolicy", playbackPolicy, "storage", storage); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional name = Optional.empty(); - + private Optional creatorId = Optional.empty(); - + private JsonNullable playbackPolicy = JsonNullable.undefined(); - - private Optional storage = Optional.empty(); - + + private Optional storage = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ public Builder name(String name) { Utils.checkNotNull(name, "name"); @@ -220,7 +218,6 @@ public Builder name(String name) { /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ public Builder name(Optional name) { Utils.checkNotNull(name, "name"); @@ -228,6 +225,7 @@ public Builder name(Optional name) { return this; } + public Builder creatorId(InputCreatorId creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = Optional.ofNullable(creatorId); @@ -240,6 +238,7 @@ public Builder creatorId(Optional creatorId) { return this; } + /** * Whether the playback policy for an asset or stream is public or signed */ @@ -258,6 +257,7 @@ public Builder playbackPolicy(JsonNullable playbackPol return this; } + public Builder storage(Storage storage) { Utils.checkNotNull(storage, "storage"); this.storage = Optional.ofNullable(storage); @@ -269,14 +269,13 @@ public Builder storage(Optional storage) { this.storage = storage; return this; } - + public AssetPatchPayload build() { + return new AssetPatchPayload( - name, - creatorId, - playbackPolicy, + name, creatorId, playbackPolicy, storage); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AssetPhase.java b/src/main/java/studio/livepeer/livepeer/models/components/AssetPhase.java index e4088026..df05b972 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AssetPhase.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AssetPhase.java @@ -1,14 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * AssetPhase - Phase of the asset + * AssetPhase + * + *

Phase of the asset */ public enum AssetPhase { UPLOADING("uploading"), @@ -22,11 +25,21 @@ public enum AssetPhase { @JsonValue private final String value; - private AssetPhase(String value) { + AssetPhase(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (AssetPhase o: AssetPhase.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AssetSource3Type.java b/src/main/java/studio/livepeer/livepeer/models/components/AssetSource3Type.java index 7da8d974..056a8f4f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AssetSource3Type.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AssetSource3Type.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum AssetSource3Type { DIRECT_UPLOAD("directUpload"), @@ -14,11 +15,21 @@ public enum AssetSource3Type { @JsonValue private final String value; - private AssetSource3Type(String value) { + AssetSource3Type(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (AssetSource3Type o: AssetSource3Type.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AssetSourceType.java b/src/main/java/studio/livepeer/livepeer/models/components/AssetSourceType.java index 9f8468f1..37042af6 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AssetSourceType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AssetSourceType.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum AssetSourceType { RECORDING("recording"); @@ -13,11 +14,21 @@ public enum AssetSourceType { @JsonValue private final String value; - private AssetSourceType(String value) { + AssetSourceType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (AssetSourceType o: AssetSourceType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AssetSpec.java b/src/main/java/studio/livepeer/livepeer/models/components/AssetSpec.java index 6cb5a019..66757419 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AssetSpec.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AssetSpec.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,19 +12,16 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.LazySingletonValue; import studio.livepeer.livepeer.utils.Utils; public class AssetSpec { - /** * Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("nftMetadataTemplate") @@ -36,7 +31,6 @@ public class AssetSpec { * Additional data to add to the NFT metadata exported to * IPFS. Will be deep merged with the default metadata * exported. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("nftMetadata") @@ -60,7 +54,6 @@ public AssetSpec() { * Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -72,7 +65,6 @@ public Optional nftMetadataTemplate() { * Additional data to add to the NFT metadata exported to * IPFS. Will be deep merged with the default metadata * exported. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -80,15 +72,15 @@ public Optional nftMetadata() { return (Optional) nftMetadata; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ public AssetSpec withNftMetadataTemplate(AssetNftMetadataTemplate nftMetadataTemplate) { Utils.checkNotNull(nftMetadataTemplate, "nftMetadataTemplate"); @@ -96,11 +88,11 @@ public AssetSpec withNftMetadataTemplate(AssetNftMetadataTemplate nftMetadataTem return this; } + /** * Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ public AssetSpec withNftMetadataTemplate(Optional nftMetadataTemplate) { Utils.checkNotNull(nftMetadataTemplate, "nftMetadataTemplate"); @@ -112,7 +104,6 @@ public AssetSpec withNftMetadataTemplate(Optional nftMetadata) { Utils.checkNotNull(nftMetadata, "nftMetadata"); this.nftMetadata = nftMetadata; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -142,15 +133,14 @@ public boolean equals(java.lang.Object o) { } AssetSpec other = (AssetSpec) o; return - Objects.deepEquals(this.nftMetadataTemplate, other.nftMetadataTemplate) && - Objects.deepEquals(this.nftMetadata, other.nftMetadata); + Utils.enhancedDeepEquals(this.nftMetadataTemplate, other.nftMetadataTemplate) && + Utils.enhancedDeepEquals(this.nftMetadata, other.nftMetadata); } @Override public int hashCode() { - return Objects.hash( - nftMetadataTemplate, - nftMetadata); + return Utils.enhancedHash( + nftMetadataTemplate, nftMetadata); } @Override @@ -159,22 +149,23 @@ public String toString() { "nftMetadataTemplate", nftMetadataTemplate, "nftMetadata", nftMetadata); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional nftMetadataTemplate; - - private Optional nftMetadata = Optional.empty(); - + + private Optional nftMetadata = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ public Builder nftMetadataTemplate(AssetNftMetadataTemplate nftMetadataTemplate) { Utils.checkNotNull(nftMetadataTemplate, "nftMetadataTemplate"); @@ -186,7 +177,6 @@ public Builder nftMetadataTemplate(AssetNftMetadataTemplate nftMetadataTemplate) * Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ public Builder nftMetadataTemplate(Optional nftMetadataTemplate) { Utils.checkNotNull(nftMetadataTemplate, "nftMetadataTemplate"); @@ -194,11 +184,11 @@ public Builder nftMetadataTemplate(Optional return this; } + /** * Additional data to add to the NFT metadata exported to * IPFS. Will be deep merged with the default metadata * exported. - * */ public Builder nftMetadata(AssetNftMetadata nftMetadata) { Utils.checkNotNull(nftMetadata, "nftMetadata"); @@ -210,23 +200,23 @@ public Builder nftMetadata(AssetNftMetadata nftMetadata) { * Additional data to add to the NFT metadata exported to * IPFS. Will be deep merged with the default metadata * exported. - * */ public Builder nftMetadata(Optional nftMetadata) { Utils.checkNotNull(nftMetadata, "nftMetadata"); this.nftMetadata = nftMetadata; return this; } - + public AssetSpec build() { if (nftMetadataTemplate == null) { nftMetadataTemplate = _SINGLETON_VALUE_NftMetadataTemplate.value(); } + return new AssetSpec( - nftMetadataTemplate, - nftMetadata); + nftMetadataTemplate, nftMetadata); } + private static final LazySingletonValue> _SINGLETON_VALUE_NftMetadataTemplate = new LazySingletonValue<>( "nftMetadataTemplate", @@ -234,4 +224,3 @@ public AssetSpec build() { new TypeReference>() {}); } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AssetStatus.java b/src/main/java/studio/livepeer/livepeer/models/components/AssetStatus.java index 48da496a..e0401f3d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AssetStatus.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AssetStatus.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,16 +11,15 @@ import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * AssetStatus - Status of the asset + * AssetStatus + * + *

Status of the asset */ - public class AssetStatus { - /** * Phase of the asset */ @@ -68,7 +65,8 @@ public AssetStatus( public AssetStatus( AssetPhase phase, double updatedAt) { - this(phase, updatedAt, Optional.empty(), Optional.empty()); + this(phase, updatedAt, Optional.empty(), + Optional.empty()); } /** @@ -103,10 +101,11 @@ public Optional errorMessage() { return errorMessage; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Phase of the asset */ @@ -134,6 +133,7 @@ public AssetStatus withProgress(double progress) { return this; } + /** * Current progress of the task creating this asset. */ @@ -152,6 +152,7 @@ public AssetStatus withErrorMessage(String errorMessage) { return this; } + /** * Error message if the asset creation failed. */ @@ -160,7 +161,7 @@ public AssetStatus withErrorMessage(Optional errorMessage) { this.errorMessage = errorMessage; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -171,18 +172,16 @@ public boolean equals(java.lang.Object o) { } AssetStatus other = (AssetStatus) o; return - Objects.deepEquals(this.phase, other.phase) && - Objects.deepEquals(this.updatedAt, other.updatedAt) && - Objects.deepEquals(this.progress, other.progress) && - Objects.deepEquals(this.errorMessage, other.errorMessage); + Utils.enhancedDeepEquals(this.phase, other.phase) && + Utils.enhancedDeepEquals(this.updatedAt, other.updatedAt) && + Utils.enhancedDeepEquals(this.progress, other.progress) && + Utils.enhancedDeepEquals(this.errorMessage, other.errorMessage); } @Override public int hashCode() { - return Objects.hash( - phase, - updatedAt, - progress, + return Utils.enhancedHash( + phase, updatedAt, progress, errorMessage); } @@ -194,21 +193,23 @@ public String toString() { "progress", progress, "errorMessage", errorMessage); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private AssetPhase phase; - + private Double updatedAt; - + private Optional progress = Optional.empty(); - - private Optional errorMessage = Optional.empty(); - + + private Optional errorMessage = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Phase of the asset */ @@ -218,6 +219,7 @@ public Builder phase(AssetPhase phase) { return this; } + /** * Timestamp (in milliseconds) at which the asset was last updated */ @@ -227,6 +229,7 @@ public Builder updatedAt(double updatedAt) { return this; } + /** * Current progress of the task creating this asset. */ @@ -245,6 +248,7 @@ public Builder progress(Optional progress) { return this; } + /** * Error message if the asset creation failed. */ @@ -262,14 +266,13 @@ public Builder errorMessage(Optional errorMessage) { this.errorMessage = errorMessage; return this; } - + public AssetStatus build() { + return new AssetStatus( - phase, - updatedAt, - progress, + phase, updatedAt, progress, errorMessage); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AssetStorage.java b/src/main/java/studio/livepeer/livepeer/models/components/AssetStorage.java index 8d55d94b..4e1c23bf 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AssetStorage.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AssetStorage.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,7 +11,6 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -24,6 +21,7 @@ public class AssetStorage { @JsonProperty("ipfs") private Optional ipfs; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("status") private Optional status; @@ -54,16 +52,18 @@ public Optional status() { return (Optional) status; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public AssetStorage withIpfs(AssetIpfs ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = Optional.ofNullable(ipfs); return this; } + public AssetStorage withIpfs(Optional ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = ipfs; @@ -76,12 +76,13 @@ public AssetStorage withStatus(StorageStatus status) { return this; } + public AssetStorage withStatus(Optional status) { Utils.checkNotNull(status, "status"); this.status = status; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -92,15 +93,14 @@ public boolean equals(java.lang.Object o) { } AssetStorage other = (AssetStorage) o; return - Objects.deepEquals(this.ipfs, other.ipfs) && - Objects.deepEquals(this.status, other.status); + Utils.enhancedDeepEquals(this.ipfs, other.ipfs) && + Utils.enhancedDeepEquals(this.status, other.status); } @Override public int hashCode() { - return Objects.hash( - ipfs, - status); + return Utils.enhancedHash( + ipfs, status); } @Override @@ -109,17 +109,19 @@ public String toString() { "ipfs", ipfs, "status", status); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional ipfs = Optional.empty(); - - private Optional status = Optional.empty(); - + + private Optional status = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder ipfs(AssetIpfs ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = Optional.ofNullable(ipfs); @@ -132,6 +134,7 @@ public Builder ipfs(Optional ipfs) { return this; } + public Builder status(StorageStatus status) { Utils.checkNotNull(status, "status"); this.status = Optional.ofNullable(status); @@ -143,12 +146,12 @@ public Builder status(Optional status) { this.status = status; return this; } - + public AssetStorage build() { + return new AssetStorage( - ipfs, - status); + ipfs, status); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AssetType.java b/src/main/java/studio/livepeer/livepeer/models/components/AssetType.java index 4ca15dfa..457b1dd0 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AssetType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AssetType.java @@ -1,14 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * AssetType - Type of the asset. + * AssetType + * + *

Type of the asset. */ public enum AssetType { VIDEO("video"), @@ -17,11 +20,21 @@ public enum AssetType { @JsonValue private final String value; - private AssetType(String value) { + AssetType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (AssetType o: AssetType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AssetVideoSpecType.java b/src/main/java/studio/livepeer/livepeer/models/components/AssetVideoSpecType.java index d677d5a2..f1b6323d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AssetVideoSpecType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AssetVideoSpecType.java @@ -1,14 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * AssetVideoSpecType - type of track + * AssetVideoSpecType + * + *

type of track */ public enum AssetVideoSpecType { VIDEO("video"), @@ -17,11 +20,21 @@ public enum AssetVideoSpecType { @JsonValue private final String value; - private AssetVideoSpecType(String value) { + AssetVideoSpecType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (AssetVideoSpecType o: AssetVideoSpecType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Attestation.java b/src/main/java/studio/livepeer/livepeer/models/components/Attestation.java index 055c1d44..e124a2c9 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Attestation.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Attestation.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,7 +12,6 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -56,10 +53,12 @@ public class Attestation { @JsonProperty("createdAt") private Optional createdAt; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("signatureType") private Optional signatureType; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("storage") private Optional storage; @@ -97,7 +96,9 @@ public Attestation( Domain domain, Message message, String signature) { - this(Optional.empty(), primaryType, domain, message, signature, Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), primaryType, domain, + message, signature, Optional.empty(), + Optional.empty(), Optional.empty()); } @JsonIgnore @@ -157,16 +158,18 @@ public Optional storage() { return (Optional) storage; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Attestation withId(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); return this; } + public Attestation withId(Optional id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -218,6 +221,7 @@ public Attestation withCreatedAt(double createdAt) { return this; } + /** * Timestamp (in milliseconds) at which the object was created */ @@ -233,6 +237,7 @@ public Attestation withSignatureType(SignatureType signatureType) { return this; } + public Attestation withSignatureType(Optional signatureType) { Utils.checkNotNull(signatureType, "signatureType"); this.signatureType = signatureType; @@ -245,12 +250,13 @@ public Attestation withStorage(AttestationStorage storage) { return this; } + public Attestation withStorage(Optional storage) { Utils.checkNotNull(storage, "storage"); this.storage = storage; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -261,27 +267,22 @@ public boolean equals(java.lang.Object o) { } Attestation other = (Attestation) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.primaryType, other.primaryType) && - Objects.deepEquals(this.domain, other.domain) && - Objects.deepEquals(this.message, other.message) && - Objects.deepEquals(this.signature, other.signature) && - Objects.deepEquals(this.createdAt, other.createdAt) && - Objects.deepEquals(this.signatureType, other.signatureType) && - Objects.deepEquals(this.storage, other.storage); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.primaryType, other.primaryType) && + Utils.enhancedDeepEquals(this.domain, other.domain) && + Utils.enhancedDeepEquals(this.message, other.message) && + Utils.enhancedDeepEquals(this.signature, other.signature) && + Utils.enhancedDeepEquals(this.createdAt, other.createdAt) && + Utils.enhancedDeepEquals(this.signatureType, other.signatureType) && + Utils.enhancedDeepEquals(this.storage, other.storage); } @Override public int hashCode() { - return Objects.hash( - id, - primaryType, - domain, - message, - signature, - createdAt, - signatureType, - storage); + return Utils.enhancedHash( + id, primaryType, domain, + message, signature, createdAt, + signatureType, storage); } @Override @@ -296,29 +297,31 @@ public String toString() { "signatureType", signatureType, "storage", storage); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional id = Optional.empty(); - + private PrimaryType primaryType; - + private Domain domain; - + private Message message; - + private String signature; - + private Optional createdAt = Optional.empty(); - + private Optional signatureType = Optional.empty(); - - private Optional storage = Optional.empty(); - + + private Optional storage = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); @@ -331,6 +334,7 @@ public Builder id(Optional id) { return this; } + /** * Video Metadata EIP-712 primaryType */ @@ -340,6 +344,7 @@ public Builder primaryType(PrimaryType primaryType) { return this; } + /** * Video Metadata EIP-712 domain */ @@ -349,6 +354,7 @@ public Builder domain(Domain domain) { return this; } + /** * Video Metadata EIP-712 message content */ @@ -358,6 +364,7 @@ public Builder message(Message message) { return this; } + /** * Video Metadata EIP-712 message signature */ @@ -367,6 +374,7 @@ public Builder signature(String signature) { return this; } + /** * Timestamp (in milliseconds) at which the object was created */ @@ -385,6 +393,7 @@ public Builder createdAt(Optional createdAt) { return this; } + public Builder signatureType(SignatureType signatureType) { Utils.checkNotNull(signatureType, "signatureType"); this.signatureType = Optional.ofNullable(signatureType); @@ -397,6 +406,7 @@ public Builder signatureType(Optional signatureType) { return this; } + public Builder storage(AttestationStorage storage) { Utils.checkNotNull(storage, "storage"); this.storage = Optional.ofNullable(storage); @@ -408,18 +418,14 @@ public Builder storage(Optional storage) { this.storage = storage; return this; } - + public Attestation build() { + return new Attestation( - id, - primaryType, - domain, - message, - signature, - createdAt, - signatureType, - storage); + id, primaryType, domain, + message, signature, createdAt, + signatureType, storage); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AttestationIpfs.java b/src/main/java/studio/livepeer/livepeer/models/components/AttestationIpfs.java index f1007b39..8daf6236 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AttestationIpfs.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AttestationIpfs.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -15,7 +13,6 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -28,7 +25,6 @@ public class AttestationIpfs { /** * Timestamp (in milliseconds) at which IPFS export task was updated - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("updatedAt") @@ -56,23 +52,24 @@ public Optional dollarRef() { /** * Timestamp (in milliseconds) at which IPFS export task was updated - * */ @JsonIgnore public Optional updatedAt() { return updatedAt; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public AttestationIpfs withDollarRef(Object dollarRef) { Utils.checkNotNull(dollarRef, "dollarRef"); this.dollarRef = Optional.ofNullable(dollarRef); return this; } + public AttestationIpfs withDollarRef(Optional dollarRef) { Utils.checkNotNull(dollarRef, "dollarRef"); this.dollarRef = dollarRef; @@ -81,7 +78,6 @@ public AttestationIpfs withDollarRef(Optional dollarRef) { /** * Timestamp (in milliseconds) at which IPFS export task was updated - * */ public AttestationIpfs withUpdatedAt(double updatedAt) { Utils.checkNotNull(updatedAt, "updatedAt"); @@ -89,16 +85,16 @@ public AttestationIpfs withUpdatedAt(double updatedAt) { return this; } + /** * Timestamp (in milliseconds) at which IPFS export task was updated - * */ public AttestationIpfs withUpdatedAt(Optional updatedAt) { Utils.checkNotNull(updatedAt, "updatedAt"); this.updatedAt = updatedAt; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -109,15 +105,14 @@ public boolean equals(java.lang.Object o) { } AttestationIpfs other = (AttestationIpfs) o; return - Objects.deepEquals(this.dollarRef, other.dollarRef) && - Objects.deepEquals(this.updatedAt, other.updatedAt); + Utils.enhancedDeepEquals(this.dollarRef, other.dollarRef) && + Utils.enhancedDeepEquals(this.updatedAt, other.updatedAt); } @Override public int hashCode() { - return Objects.hash( - dollarRef, - updatedAt); + return Utils.enhancedHash( + dollarRef, updatedAt); } @Override @@ -126,17 +121,19 @@ public String toString() { "dollarRef", dollarRef, "updatedAt", updatedAt); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional dollarRef = Optional.empty(); - - private Optional updatedAt = Optional.empty(); - + + private Optional updatedAt = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder dollarRef(Object dollarRef) { Utils.checkNotNull(dollarRef, "dollarRef"); this.dollarRef = Optional.ofNullable(dollarRef); @@ -149,9 +146,9 @@ public Builder dollarRef(Optional dollarRef) { return this; } + /** * Timestamp (in milliseconds) at which IPFS export task was updated - * */ public Builder updatedAt(double updatedAt) { Utils.checkNotNull(updatedAt, "updatedAt"); @@ -161,19 +158,18 @@ public Builder updatedAt(double updatedAt) { /** * Timestamp (in milliseconds) at which IPFS export task was updated - * */ public Builder updatedAt(Optional updatedAt) { Utils.checkNotNull(updatedAt, "updatedAt"); this.updatedAt = updatedAt; return this; } - + public AttestationIpfs build() { + return new AttestationIpfs( - dollarRef, - updatedAt); + dollarRef, updatedAt); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/AttestationStorage.java b/src/main/java/studio/livepeer/livepeer/models/components/AttestationStorage.java index 6184a800..57df2b7b 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/AttestationStorage.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/AttestationStorage.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,7 +11,6 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -24,6 +21,7 @@ public class AttestationStorage { @JsonProperty("ipfs") private Optional ipfs; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("status") private Optional status; @@ -54,16 +52,18 @@ public Optional status() { return (Optional) status; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public AttestationStorage withIpfs(AttestationIpfs ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = Optional.ofNullable(ipfs); return this; } + public AttestationStorage withIpfs(Optional ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = ipfs; @@ -76,12 +76,13 @@ public AttestationStorage withStatus(StorageStatus status) { return this; } + public AttestationStorage withStatus(Optional status) { Utils.checkNotNull(status, "status"); this.status = status; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -92,15 +93,14 @@ public boolean equals(java.lang.Object o) { } AttestationStorage other = (AttestationStorage) o; return - Objects.deepEquals(this.ipfs, other.ipfs) && - Objects.deepEquals(this.status, other.status); + Utils.enhancedDeepEquals(this.ipfs, other.ipfs) && + Utils.enhancedDeepEquals(this.status, other.status); } @Override public int hashCode() { - return Objects.hash( - ipfs, - status); + return Utils.enhancedHash( + ipfs, status); } @Override @@ -109,17 +109,19 @@ public String toString() { "ipfs", ipfs, "status", status); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional ipfs = Optional.empty(); - - private Optional status = Optional.empty(); - + + private Optional status = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder ipfs(AttestationIpfs ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = Optional.ofNullable(ipfs); @@ -132,6 +134,7 @@ public Builder ipfs(Optional ipfs) { return this; } + public Builder status(StorageStatus status) { Utils.checkNotNull(status, "status"); this.status = Optional.ofNullable(status); @@ -143,12 +146,12 @@ public Builder status(Optional status) { this.status = status; return this; } - + public AttestationStorage build() { + return new AttestationStorage( - ipfs, - status); + ipfs, status); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Attestations.java b/src/main/java/studio/livepeer/livepeer/models/components/Attestations.java index c511313d..193bc294 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Attestations.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Attestations.java @@ -1,16 +1,13 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; @@ -19,6 +16,7 @@ public class Attestations { @JsonProperty("role") private String role; + @JsonProperty("address") private String address; @@ -42,10 +40,11 @@ public String address() { return address; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Attestations withRole(String role) { Utils.checkNotNull(role, "role"); this.role = role; @@ -57,7 +56,7 @@ public Attestations withAddress(String address) { this.address = address; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -68,15 +67,14 @@ public boolean equals(java.lang.Object o) { } Attestations other = (Attestations) o; return - Objects.deepEquals(this.role, other.role) && - Objects.deepEquals(this.address, other.address); + Utils.enhancedDeepEquals(this.role, other.role) && + Utils.enhancedDeepEquals(this.address, other.address); } @Override public int hashCode() { - return Objects.hash( - role, - address); + return Utils.enhancedHash( + role, address); } @Override @@ -85,34 +83,37 @@ public String toString() { "role", role, "address", address); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String role; - - private String address; - + + private String address; + private Builder() { // force use of static builder() method } + public Builder role(String role) { Utils.checkNotNull(role, "role"); this.role = role; return this; } + public Builder address(String address) { Utils.checkNotNull(address, "address"); this.address = address; return this; } - + public Attestations build() { + return new Attestations( - role, - address); + role, address); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/CatalystPipelineStrategy.java b/src/main/java/studio/livepeer/livepeer/models/components/CatalystPipelineStrategy.java index c6e786a7..c0ba908a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/CatalystPipelineStrategy.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/CatalystPipelineStrategy.java @@ -1,14 +1,19 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * CatalystPipelineStrategy - Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * CatalystPipelineStrategy + * + *

Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy + * that Catalyst is configured for will be used. This field only available for admin users, and is only + * used for E2E testing. */ public enum CatalystPipelineStrategy { CATALYST("catalyst"), @@ -21,11 +26,21 @@ public enum CatalystPipelineStrategy { @JsonValue private final String value; - private CatalystPipelineStrategy(String value) { + CatalystPipelineStrategy(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (CatalystPipelineStrategy o: CatalystPipelineStrategy.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Clip.java b/src/main/java/studio/livepeer/livepeer/models/components/Clip.java index 37440f88..57a16805 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Clip.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Clip.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,13 +11,11 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class Clip { - /** * URL of the asset to "clip" */ @@ -28,14 +24,18 @@ public class Clip { private Optional url; /** - * Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is + * configured for will be used. This field only available for admin users, and is only used for E2E + * testing. */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("clipStrategy") private Optional clipStrategy; /** - * Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy + * that Catalyst is configured for will be used. This field only available for admin users, and is only + * used for E2E testing. */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("catalystPipelineStrategy") @@ -75,7 +75,8 @@ public Clip( } public Clip() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); } /** @@ -87,7 +88,9 @@ public Optional url() { } /** - * Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is + * configured for will be used. This field only available for admin users, and is only used for E2E + * testing. */ @SuppressWarnings("unchecked") @JsonIgnore @@ -96,7 +99,9 @@ public Optional clipStrategy() { } /** - * Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy + * that Catalyst is configured for will be used. This field only available for admin users, and is only + * used for E2E testing. */ @SuppressWarnings("unchecked") @JsonIgnore @@ -120,10 +125,11 @@ public Optional inputId() { return inputId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * URL of the asset to "clip" */ @@ -133,6 +139,7 @@ public Clip withUrl(String url) { return this; } + /** * URL of the asset to "clip" */ @@ -143,7 +150,9 @@ public Clip withUrl(Optional url) { } /** - * Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is + * configured for will be used. This field only available for admin users, and is only used for E2E + * testing. */ public Clip withClipStrategy(ClipStrategy clipStrategy) { Utils.checkNotNull(clipStrategy, "clipStrategy"); @@ -151,8 +160,11 @@ public Clip withClipStrategy(ClipStrategy clipStrategy) { return this; } + /** - * Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is + * configured for will be used. This field only available for admin users, and is only used for E2E + * testing. */ public Clip withClipStrategy(Optional clipStrategy) { Utils.checkNotNull(clipStrategy, "clipStrategy"); @@ -161,7 +173,9 @@ public Clip withClipStrategy(Optional clipStrategy) { } /** - * Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy + * that Catalyst is configured for will be used. This field only available for admin users, and is only + * used for E2E testing. */ public Clip withCatalystPipelineStrategy(CatalystPipelineStrategy catalystPipelineStrategy) { Utils.checkNotNull(catalystPipelineStrategy, "catalystPipelineStrategy"); @@ -169,8 +183,11 @@ public Clip withCatalystPipelineStrategy(CatalystPipelineStrategy catalystPipeli return this; } + /** - * Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy + * that Catalyst is configured for will be used. This field only available for admin users, and is only + * used for E2E testing. */ public Clip withCatalystPipelineStrategy(Optional catalystPipelineStrategy) { Utils.checkNotNull(catalystPipelineStrategy, "catalystPipelineStrategy"); @@ -187,6 +204,7 @@ public Clip withSessionId(String sessionId) { return this; } + /** * ID of the session */ @@ -205,6 +223,7 @@ public Clip withInputId(String inputId) { return this; } + /** * ID of the input asset or stream */ @@ -213,7 +232,7 @@ public Clip withInputId(Optional inputId) { this.inputId = inputId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -224,21 +243,18 @@ public boolean equals(java.lang.Object o) { } Clip other = (Clip) o; return - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.clipStrategy, other.clipStrategy) && - Objects.deepEquals(this.catalystPipelineStrategy, other.catalystPipelineStrategy) && - Objects.deepEquals(this.sessionId, other.sessionId) && - Objects.deepEquals(this.inputId, other.inputId); + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.clipStrategy, other.clipStrategy) && + Utils.enhancedDeepEquals(this.catalystPipelineStrategy, other.catalystPipelineStrategy) && + Utils.enhancedDeepEquals(this.sessionId, other.sessionId) && + Utils.enhancedDeepEquals(this.inputId, other.inputId); } @Override public int hashCode() { - return Objects.hash( - url, - clipStrategy, - catalystPipelineStrategy, - sessionId, - inputId); + return Utils.enhancedHash( + url, clipStrategy, catalystPipelineStrategy, + sessionId, inputId); } @Override @@ -250,23 +266,25 @@ public String toString() { "sessionId", sessionId, "inputId", inputId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional url = Optional.empty(); - + private Optional clipStrategy = Optional.empty(); - + private Optional catalystPipelineStrategy = Optional.empty(); - + private Optional sessionId = Optional.empty(); - - private Optional inputId = Optional.empty(); - + + private Optional inputId = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * URL of the asset to "clip" */ @@ -285,8 +303,11 @@ public Builder url(Optional url) { return this; } + /** - * Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is + * configured for will be used. This field only available for admin users, and is only used for E2E + * testing. */ public Builder clipStrategy(ClipStrategy clipStrategy) { Utils.checkNotNull(clipStrategy, "clipStrategy"); @@ -295,7 +316,9 @@ public Builder clipStrategy(ClipStrategy clipStrategy) { } /** - * Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is + * configured for will be used. This field only available for admin users, and is only used for E2E + * testing. */ public Builder clipStrategy(Optional clipStrategy) { Utils.checkNotNull(clipStrategy, "clipStrategy"); @@ -303,8 +326,11 @@ public Builder clipStrategy(Optional clipStrategy) { return this; } + /** - * Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy + * that Catalyst is configured for will be used. This field only available for admin users, and is only + * used for E2E testing. */ public Builder catalystPipelineStrategy(CatalystPipelineStrategy catalystPipelineStrategy) { Utils.checkNotNull(catalystPipelineStrategy, "catalystPipelineStrategy"); @@ -313,7 +339,9 @@ public Builder catalystPipelineStrategy(CatalystPipelineStrategy catalystPipelin } /** - * Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * Force to use a specific strategy in the Catalyst pipeline. If not specified, the default strategy + * that Catalyst is configured for will be used. This field only available for admin users, and is only + * used for E2E testing. */ public Builder catalystPipelineStrategy(Optional catalystPipelineStrategy) { Utils.checkNotNull(catalystPipelineStrategy, "catalystPipelineStrategy"); @@ -321,6 +349,7 @@ public Builder catalystPipelineStrategy(Optional sessionId) { return this; } + /** * ID of the input asset or stream */ @@ -356,15 +386,13 @@ public Builder inputId(Optional inputId) { this.inputId = inputId; return this; } - + public Clip build() { + return new Clip( - url, - clipStrategy, - catalystPipelineStrategy, - sessionId, - inputId); + url, clipStrategy, catalystPipelineStrategy, + sessionId, inputId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/ClipPayload.java b/src/main/java/studio/livepeer/livepeer/models/components/ClipPayload.java index 7cebbdc6..cd62dd2a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/ClipPayload.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/ClipPayload.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,13 +11,11 @@ import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class ClipPayload { - /** * The playback ID of the stream or stream recording to clip. Asset playback IDs are not supported yet. */ @@ -27,13 +23,17 @@ public class ClipPayload { private String playbackId; /** - * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ @JsonProperty("startTime") private double startTime; /** - * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("endTime") @@ -47,7 +47,8 @@ public class ClipPayload { private Optional name; /** - * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not specified, it will clip the ongoing livestream. + * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not + * specified, it will clip the ongoing livestream. */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("sessionId") @@ -75,7 +76,8 @@ public ClipPayload( public ClipPayload( String playbackId, double startTime) { - this(playbackId, startTime, Optional.empty(), Optional.empty(), Optional.empty()); + this(playbackId, startTime, Optional.empty(), + Optional.empty(), Optional.empty()); } /** @@ -87,7 +89,9 @@ public String playbackId() { } /** - * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ @JsonIgnore public double startTime() { @@ -95,7 +99,9 @@ public double startTime() { } /** - * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ @JsonIgnore public Optional endTime() { @@ -111,17 +117,19 @@ public Optional name() { } /** - * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not specified, it will clip the ongoing livestream. + * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not + * specified, it will clip the ongoing livestream. */ @JsonIgnore public Optional sessionId() { return sessionId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The playback ID of the stream or stream recording to clip. Asset playback IDs are not supported yet. */ @@ -132,7 +140,9 @@ public ClipPayload withPlaybackId(String playbackId) { } /** - * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public ClipPayload withStartTime(double startTime) { Utils.checkNotNull(startTime, "startTime"); @@ -141,7 +151,9 @@ public ClipPayload withStartTime(double startTime) { } /** - * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public ClipPayload withEndTime(double endTime) { Utils.checkNotNull(endTime, "endTime"); @@ -149,8 +161,11 @@ public ClipPayload withEndTime(double endTime) { return this; } + /** - * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public ClipPayload withEndTime(Optional endTime) { Utils.checkNotNull(endTime, "endTime"); @@ -167,6 +182,7 @@ public ClipPayload withName(String name) { return this; } + /** * The optional friendly name of the clip to create. */ @@ -177,7 +193,8 @@ public ClipPayload withName(Optional name) { } /** - * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not specified, it will clip the ongoing livestream. + * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not + * specified, it will clip the ongoing livestream. */ public ClipPayload withSessionId(String sessionId) { Utils.checkNotNull(sessionId, "sessionId"); @@ -185,15 +202,17 @@ public ClipPayload withSessionId(String sessionId) { return this; } + /** - * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not specified, it will clip the ongoing livestream. + * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not + * specified, it will clip the ongoing livestream. */ public ClipPayload withSessionId(Optional sessionId) { Utils.checkNotNull(sessionId, "sessionId"); this.sessionId = sessionId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -204,21 +223,18 @@ public boolean equals(java.lang.Object o) { } ClipPayload other = (ClipPayload) o; return - Objects.deepEquals(this.playbackId, other.playbackId) && - Objects.deepEquals(this.startTime, other.startTime) && - Objects.deepEquals(this.endTime, other.endTime) && - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.sessionId, other.sessionId); + Utils.enhancedDeepEquals(this.playbackId, other.playbackId) && + Utils.enhancedDeepEquals(this.startTime, other.startTime) && + Utils.enhancedDeepEquals(this.endTime, other.endTime) && + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.sessionId, other.sessionId); } @Override public int hashCode() { - return Objects.hash( - playbackId, - startTime, - endTime, - name, - sessionId); + return Utils.enhancedHash( + playbackId, startTime, endTime, + name, sessionId); } @Override @@ -230,23 +246,25 @@ public String toString() { "name", name, "sessionId", sessionId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String playbackId; - + private Double startTime; - + private Optional endTime = Optional.empty(); - + private Optional name = Optional.empty(); - - private Optional sessionId = Optional.empty(); - + + private Optional sessionId = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * The playback ID of the stream or stream recording to clip. Asset playback IDs are not supported yet. */ @@ -256,8 +274,11 @@ public Builder playbackId(String playbackId) { return this; } + /** - * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public Builder startTime(double startTime) { Utils.checkNotNull(startTime, "startTime"); @@ -265,8 +286,11 @@ public Builder startTime(double startTime) { return this; } + /** - * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public Builder endTime(double endTime) { Utils.checkNotNull(endTime, "endTime"); @@ -275,7 +299,9 @@ public Builder endTime(double endTime) { } /** - * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public Builder endTime(Optional endTime) { Utils.checkNotNull(endTime, "endTime"); @@ -283,6 +309,7 @@ public Builder endTime(Optional endTime) { return this; } + /** * The optional friendly name of the clip to create. */ @@ -301,8 +328,10 @@ public Builder name(Optional name) { return this; } + /** - * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not specified, it will clip the ongoing livestream. + * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not + * specified, it will clip the ongoing livestream. */ public Builder sessionId(String sessionId) { Utils.checkNotNull(sessionId, "sessionId"); @@ -311,22 +340,21 @@ public Builder sessionId(String sessionId) { } /** - * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not specified, it will clip the ongoing livestream. + * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not + * specified, it will clip the ongoing livestream. */ public Builder sessionId(Optional sessionId) { Utils.checkNotNull(sessionId, "sessionId"); this.sessionId = sessionId; return this; } - + public ClipPayload build() { + return new ClipPayload( - playbackId, - startTime, - endTime, - name, - sessionId); + playbackId, startTime, endTime, + name, sessionId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/ClipStrategy.java b/src/main/java/studio/livepeer/livepeer/models/components/ClipStrategy.java index 0456974c..ca7118a9 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/ClipStrategy.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/ClipStrategy.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,25 +11,30 @@ import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * ClipStrategy - Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is configured for will be used. This field only available for admin users, and is only used for E2E testing. + * ClipStrategy + * + *

Strategy to use for clipping the asset. If not specified, the default strategy that Catalyst is + * configured for will be used. This field only available for admin users, and is only used for E2E + * testing. */ - public class ClipStrategy { - /** - * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("startTime") private Optional startTime; /** - * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("endTime") @@ -62,7 +65,9 @@ public ClipStrategy() { } /** - * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ @JsonIgnore public Optional startTime() { @@ -70,7 +75,9 @@ public Optional startTime() { } /** - * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ @JsonIgnore public Optional endTime() { @@ -85,12 +92,15 @@ public Optional playbackId() { return playbackId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** - * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public ClipStrategy withStartTime(double startTime) { Utils.checkNotNull(startTime, "startTime"); @@ -98,8 +108,11 @@ public ClipStrategy withStartTime(double startTime) { return this; } + /** - * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public ClipStrategy withStartTime(Optional startTime) { Utils.checkNotNull(startTime, "startTime"); @@ -108,7 +121,9 @@ public ClipStrategy withStartTime(Optional startTime) { } /** - * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public ClipStrategy withEndTime(double endTime) { Utils.checkNotNull(endTime, "endTime"); @@ -116,8 +131,11 @@ public ClipStrategy withEndTime(double endTime) { return this; } + /** - * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public ClipStrategy withEndTime(Optional endTime) { Utils.checkNotNull(endTime, "endTime"); @@ -134,6 +152,7 @@ public ClipStrategy withPlaybackId(String playbackId) { return this; } + /** * The playback ID of the stream or stream recording to clip. Asset playback IDs are not supported yet. */ @@ -142,7 +161,7 @@ public ClipStrategy withPlaybackId(Optional playbackId) { this.playbackId = playbackId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -153,17 +172,15 @@ public boolean equals(java.lang.Object o) { } ClipStrategy other = (ClipStrategy) o; return - Objects.deepEquals(this.startTime, other.startTime) && - Objects.deepEquals(this.endTime, other.endTime) && - Objects.deepEquals(this.playbackId, other.playbackId); + Utils.enhancedDeepEquals(this.startTime, other.startTime) && + Utils.enhancedDeepEquals(this.endTime, other.endTime) && + Utils.enhancedDeepEquals(this.playbackId, other.playbackId); } @Override public int hashCode() { - return Objects.hash( - startTime, - endTime, - playbackId); + return Utils.enhancedHash( + startTime, endTime, playbackId); } @Override @@ -173,21 +190,25 @@ public String toString() { "endTime", endTime, "playbackId", playbackId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional startTime = Optional.empty(); - + private Optional endTime = Optional.empty(); - - private Optional playbackId = Optional.empty(); - + + private Optional playbackId = Optional.empty(); + private Builder() { // force use of static builder() method } + /** - * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public Builder startTime(double startTime) { Utils.checkNotNull(startTime, "startTime"); @@ -196,7 +217,9 @@ public Builder startTime(double startTime) { } /** - * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public Builder startTime(Optional startTime) { Utils.checkNotNull(startTime, "startTime"); @@ -204,8 +227,11 @@ public Builder startTime(Optional startTime) { return this; } + /** - * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public Builder endTime(double endTime) { Utils.checkNotNull(endTime, "endTime"); @@ -214,7 +240,9 @@ public Builder endTime(double endTime) { } /** - * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ + * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an + * example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it + * uses the latency from server to client at stream startup)._ */ public Builder endTime(Optional endTime) { Utils.checkNotNull(endTime, "endTime"); @@ -222,6 +250,7 @@ public Builder endTime(Optional endTime) { return this; } + /** * The playback ID of the stream or stream recording to clip. Asset playback IDs are not supported yet. */ @@ -239,13 +268,12 @@ public Builder playbackId(Optional playbackId) { this.playbackId = playbackId; return this; } - + public ClipStrategy build() { + return new ClipStrategy( - startTime, - endTime, - playbackId); + startTime, endTime, playbackId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Content.java b/src/main/java/studio/livepeer/livepeer/models/components/Content.java index b3fcda60..c49110ed 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Content.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Content.java @@ -1,32 +1,28 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * Content - File content to store into IPFS + * Content + * + *

File content to store into IPFS */ - public class Content { - @JsonCreator public Content() { - - } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } - + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -40,7 +36,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( ); } @@ -48,17 +44,19 @@ public int hashCode() { public String toString() { return Utils.toString(Content.class); } - - public final static class Builder { - + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + private Builder() { // force use of static builder() method } - + public Content build() { + return new Content( ); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/CreateRoomResponse.java b/src/main/java/studio/livepeer/livepeer/models/components/CreateRoomResponse.java index 7cc86a7b..d4adb369 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/CreateRoomResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/CreateRoomResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,13 +10,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class CreateRoomResponse { - /** * The ID of the room */ @@ -45,10 +41,11 @@ public Optional id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The ID of the room */ @@ -58,6 +55,7 @@ public CreateRoomResponse withId(String id) { return this; } + /** * The ID of the room */ @@ -66,7 +64,7 @@ public CreateRoomResponse withId(Optional id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -77,12 +75,12 @@ public boolean equals(java.lang.Object o) { } CreateRoomResponse other = (CreateRoomResponse) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -91,15 +89,17 @@ public String toString() { return Utils.toString(CreateRoomResponse.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional id = Optional.empty(); - + + private Optional id = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * The ID of the room */ @@ -117,11 +117,12 @@ public Builder id(Optional id) { this.id = id; return this; } - + public CreateRoomResponse build() { + return new CreateRoomResponse( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/CreatorId.java b/src/main/java/studio/livepeer/livepeer/models/components/CreatorId.java index ed3b9d56..29ec5386 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/CreatorId.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/CreatorId.java @@ -1,24 +1,20 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; import studio.livepeer.livepeer.utils.Utils.TypeReferenceWithShape; import studio.livepeer.livepeer.utils.Utils; - @JsonDeserialize(using = CreatorId._Deserializer.class) public class CreatorId { @@ -64,12 +60,12 @@ public boolean equals(java.lang.Object o) { return false; } CreatorId other = (CreatorId) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -77,7 +73,7 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(CreatorId.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -88,3 +84,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/CreatorId1.java b/src/main/java/studio/livepeer/livepeer/models/components/CreatorId1.java index 30f26e48..3ca20403 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/CreatorId1.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/CreatorId1.java @@ -1,16 +1,13 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; @@ -48,10 +45,11 @@ public String value() { return value; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public CreatorId1 withType(CreatorIdType type) { Utils.checkNotNull(type, "type"); this.type = type; @@ -66,7 +64,7 @@ public CreatorId1 withValue(String value) { this.value = value; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -77,15 +75,14 @@ public boolean equals(java.lang.Object o) { } CreatorId1 other = (CreatorId1) o; return - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.value, other.value); + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.value, other.value); } @Override public int hashCode() { - return Objects.hash( - type, - value); + return Utils.enhancedHash( + type, value); } @Override @@ -94,23 +91,26 @@ public String toString() { "type", type, "value", value); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private CreatorIdType type; - - private String value; - + + private String value; + private Builder() { // force use of static builder() method } + public Builder type(CreatorIdType type) { Utils.checkNotNull(type, "type"); this.type = type; return this; } + /** * Developer-managed ID of the user who created the resource. */ @@ -119,12 +119,12 @@ public Builder value(String value) { this.value = value; return this; } - + public CreatorId1 build() { + return new CreatorId1( - type, - value); + type, value); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/CreatorIdType.java b/src/main/java/studio/livepeer/livepeer/models/components/CreatorIdType.java index 40496d76..dde26ed7 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/CreatorIdType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/CreatorIdType.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum CreatorIdType { UNVERIFIED("unverified"); @@ -13,11 +14,21 @@ public enum CreatorIdType { @JsonValue private final String value; - private CreatorIdType(String value) { + CreatorIdType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (CreatorIdType o: CreatorIdType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Credentials.java b/src/main/java/studio/livepeer/livepeer/models/components/Credentials.java index d14b183b..b00fdf22 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Credentials.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Credentials.java @@ -1,24 +1,21 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * Credentials - Credentials for the private input video storage + * Credentials + * + *

Credentials for the private input video storage */ - public class Credentials { - /** * Access Key ID */ @@ -57,10 +54,11 @@ public String secretAccessKey() { return secretAccessKey; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Access Key ID */ @@ -78,7 +76,7 @@ public Credentials withSecretAccessKey(String secretAccessKey) { this.secretAccessKey = secretAccessKey; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -89,15 +87,14 @@ public boolean equals(java.lang.Object o) { } Credentials other = (Credentials) o; return - Objects.deepEquals(this.accessKeyId, other.accessKeyId) && - Objects.deepEquals(this.secretAccessKey, other.secretAccessKey); + Utils.enhancedDeepEquals(this.accessKeyId, other.accessKeyId) && + Utils.enhancedDeepEquals(this.secretAccessKey, other.secretAccessKey); } @Override public int hashCode() { - return Objects.hash( - accessKeyId, - secretAccessKey); + return Utils.enhancedHash( + accessKeyId, secretAccessKey); } @Override @@ -106,17 +103,19 @@ public String toString() { "accessKeyId", accessKeyId, "secretAccessKey", secretAccessKey); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String accessKeyId; - - private String secretAccessKey; - + + private String secretAccessKey; + private Builder() { // force use of static builder() method } + /** * Access Key ID */ @@ -126,6 +125,7 @@ public Builder accessKeyId(String accessKeyId) { return this; } + /** * Secret Access Key */ @@ -134,12 +134,12 @@ public Builder secretAccessKey(String secretAccessKey) { this.secretAccessKey = secretAccessKey; return this; } - + public Credentials build() { + return new Credentials( - accessKeyId, - secretAccessKey); + accessKeyId, secretAccessKey); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Custom.java b/src/main/java/studio/livepeer/livepeer/models/components/Custom.java index 71daf050..33981b5c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Custom.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Custom.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -15,17 +13,16 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.Map; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.LazySingletonValue; import studio.livepeer.livepeer.utils.Utils; /** - * Custom - custom URL parameters for the export task + * Custom + * + *

custom URL parameters for the export task */ - public class Custom { - /** * URL where to export the asset */ @@ -89,10 +86,11 @@ public Optional> headers() { return (Optional>) headers; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * URL where to export the asset */ @@ -111,6 +109,7 @@ public Custom withMethod(String method) { return this; } + /** * Method to use on the export request */ @@ -129,6 +128,7 @@ public Custom withHeaders(Map headers) { return this; } + /** * Headers to add to the export request */ @@ -137,7 +137,7 @@ public Custom withHeaders(Optional> headers) { this.headers = headers; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -148,17 +148,15 @@ public boolean equals(java.lang.Object o) { } Custom other = (Custom) o; return - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.method, other.method) && - Objects.deepEquals(this.headers, other.headers); + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.method, other.method) && + Utils.enhancedDeepEquals(this.headers, other.headers); } @Override public int hashCode() { - return Objects.hash( - url, - method, - headers); + return Utils.enhancedHash( + url, method, headers); } @Override @@ -168,19 +166,21 @@ public String toString() { "method", method, "headers", headers); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String url; - + private Optional method; - - private Optional> headers = Optional.empty(); - + + private Optional> headers = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * URL where to export the asset */ @@ -190,6 +190,7 @@ public Builder url(String url) { return this; } + /** * Method to use on the export request */ @@ -208,6 +209,7 @@ public Builder method(Optional method) { return this; } + /** * Headers to add to the export request */ @@ -225,17 +227,17 @@ public Builder headers(Optional> headers) { this.headers = headers; return this; } - + public Custom build() { if (method == null) { method = _SINGLETON_VALUE_Method.value(); } + return new Custom( - url, - method, - headers); + url, method, headers); } + private static final LazySingletonValue> _SINGLETON_VALUE_Method = new LazySingletonValue<>( "method", @@ -243,4 +245,3 @@ public Custom build() { new TypeReference>() {}); } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Domain.java b/src/main/java/studio/livepeer/livepeer/models/components/Domain.java index 6593b52d..6f003043 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Domain.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Domain.java @@ -1,27 +1,26 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * Domain - Video Metadata EIP-712 domain + * Domain + * + *

Video Metadata EIP-712 domain */ - public class Domain { @JsonProperty("name") private Name name; + @JsonProperty("version") private Version version; @@ -45,10 +44,11 @@ public Version version() { return version; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Domain withName(Name name) { Utils.checkNotNull(name, "name"); this.name = name; @@ -60,7 +60,7 @@ public Domain withVersion(Version version) { this.version = version; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -71,15 +71,14 @@ public boolean equals(java.lang.Object o) { } Domain other = (Domain) o; return - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.version, other.version); + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.version, other.version); } @Override public int hashCode() { - return Objects.hash( - name, - version); + return Utils.enhancedHash( + name, version); } @Override @@ -88,34 +87,37 @@ public String toString() { "name", name, "version", version); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Name name; - - private Version version; - + + private Version version; + private Builder() { // force use of static builder() method } + public Builder name(Name name) { Utils.checkNotNull(name, "name"); this.name = name; return this; } + public Builder version(Version version) { Utils.checkNotNull(version, "version"); this.version = version; return this; } - + public Domain build() { + return new Domain( - name, - version); + name, version); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/DvrPlayback.java b/src/main/java/studio/livepeer/livepeer/models/components/DvrPlayback.java index d76b645b..647325db 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/DvrPlayback.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/DvrPlayback.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,7 +11,6 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -24,14 +21,17 @@ public class DvrPlayback { @JsonProperty("hrn") private Optional hrn; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("type") private Optional type; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("url") private Optional url; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("error") private Optional error; @@ -53,7 +53,8 @@ public DvrPlayback( } public DvrPlayback() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } @SuppressWarnings("unchecked") @@ -78,16 +79,18 @@ public Optional error() { return error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public DvrPlayback withHrn(PlaybackInfoHrn hrn) { Utils.checkNotNull(hrn, "hrn"); this.hrn = Optional.ofNullable(hrn); return this; } + public DvrPlayback withHrn(Optional hrn) { Utils.checkNotNull(hrn, "hrn"); this.hrn = hrn; @@ -100,6 +103,7 @@ public DvrPlayback withType(PlaybackInfoMetaDvrPlaybackType type) { return this; } + public DvrPlayback withType(Optional type) { Utils.checkNotNull(type, "type"); this.type = type; @@ -112,6 +116,7 @@ public DvrPlayback withUrl(String url) { return this; } + public DvrPlayback withUrl(Optional url) { Utils.checkNotNull(url, "url"); this.url = url; @@ -124,12 +129,13 @@ public DvrPlayback withError(String error) { return this; } + public DvrPlayback withError(Optional error) { Utils.checkNotNull(error, "error"); this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -140,18 +146,16 @@ public boolean equals(java.lang.Object o) { } DvrPlayback other = (DvrPlayback) o; return - Objects.deepEquals(this.hrn, other.hrn) && - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.hrn, other.hrn) && + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - hrn, - type, - url, + return Utils.enhancedHash( + hrn, type, url, error); } @@ -163,21 +167,23 @@ public String toString() { "url", url, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional hrn = Optional.empty(); - + private Optional type = Optional.empty(); - + private Optional url = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder hrn(PlaybackInfoHrn hrn) { Utils.checkNotNull(hrn, "hrn"); this.hrn = Optional.ofNullable(hrn); @@ -190,6 +196,7 @@ public Builder hrn(Optional hrn) { return this; } + public Builder type(PlaybackInfoMetaDvrPlaybackType type) { Utils.checkNotNull(type, "type"); this.type = Optional.ofNullable(type); @@ -202,6 +209,7 @@ public Builder type(Optional type) { return this; } + public Builder url(String url) { Utils.checkNotNull(url, "url"); this.url = Optional.ofNullable(url); @@ -214,6 +222,7 @@ public Builder url(Optional url) { return this; } + public Builder error(String error) { Utils.checkNotNull(error, "error"); this.error = Optional.ofNullable(error); @@ -225,14 +234,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public DvrPlayback build() { + return new DvrPlayback( - hrn, - type, - url, + hrn, type, url, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Encoder.java b/src/main/java/studio/livepeer/livepeer/models/components/Encoder.java index b30a12fe..4f251336 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Encoder.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Encoder.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum Encoder { H264("H.264"); @@ -13,11 +14,21 @@ public enum Encoder { @JsonValue private final String value; - private Encoder(String value) { + Encoder(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (Encoder o: Encoder.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Encryption.java b/src/main/java/studio/livepeer/livepeer/models/components/Encryption.java index d476b678..3ae7c39c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Encryption.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Encryption.java @@ -1,23 +1,20 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; public class Encryption { - /** - * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be retrieved back. + * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be + * retrieved back. */ @JsonProperty("encryptedKey") private String encryptedKey; @@ -30,26 +27,29 @@ public Encryption( } /** - * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be retrieved back. + * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be + * retrieved back. */ @JsonIgnore public String encryptedKey() { return encryptedKey; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** - * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be retrieved back. + * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be + * retrieved back. */ public Encryption withEncryptedKey(String encryptedKey) { Utils.checkNotNull(encryptedKey, "encryptedKey"); this.encryptedKey = encryptedKey; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +60,12 @@ public boolean equals(java.lang.Object o) { } Encryption other = (Encryption) o; return - Objects.deepEquals(this.encryptedKey, other.encryptedKey); + Utils.enhancedDeepEquals(this.encryptedKey, other.encryptedKey); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( encryptedKey); } @@ -74,28 +74,32 @@ public String toString() { return Utils.toString(Encryption.class, "encryptedKey", encryptedKey); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String encryptedKey; - + + private String encryptedKey; + private Builder() { // force use of static builder() method } + /** - * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be retrieved back. + * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be + * retrieved back. */ public Builder encryptedKey(String encryptedKey) { Utils.checkNotNull(encryptedKey, "encryptedKey"); this.encryptedKey = encryptedKey; return this; } - + public Encryption build() { + return new Encryption( encryptedKey); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/EncryptionOutput.java b/src/main/java/studio/livepeer/livepeer/models/components/EncryptionOutput.java index 13d1d9d6..b941cc7f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/EncryptionOutput.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/EncryptionOutput.java @@ -1,29 +1,24 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; public class EncryptionOutput { - @JsonCreator public EncryptionOutput() { - - } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } - + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -37,7 +32,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( ); } @@ -45,17 +40,19 @@ public int hashCode() { public String toString() { return Utils.toString(EncryptionOutput.class); } - - public final static class Builder { - + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + private Builder() { // force use of static builder() method } - + public EncryptionOutput build() { + return new EncryptionOutput( ); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Error.java b/src/main/java/studio/livepeer/livepeer/models/components/Error.java new file mode 100644 index 00000000..e5d06edf --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/components/Error.java @@ -0,0 +1,114 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.utils.Utils; + + +public class Error { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("errors") + private Optional> errors; + + @JsonCreator + public Error( + @JsonProperty("errors") Optional> errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = errors; + } + + public Error() { + this(Optional.empty()); + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> errors() { + return (Optional>) errors; + } + + public static Builder builder() { + return new Builder(); + } + + + public Error withErrors(List errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = Optional.ofNullable(errors); + return this; + } + + + public Error withErrors(Optional> errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = errors; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error other = (Error) o; + return + Utils.enhancedDeepEquals(this.errors, other.errors); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + errors); + } + + @Override + public String toString() { + return Utils.toString(Error.class, + "errors", errors); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private Optional> errors = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + public Builder errors(List errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = Optional.ofNullable(errors); + return this; + } + + public Builder errors(Optional> errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = errors; + return this; + } + + public Error build() { + + return new Error( + errors); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Events.java b/src/main/java/studio/livepeer/livepeer/models/components/Events.java index 600ffe6a..fbf8b9f4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Events.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Events.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum Events { STREAM_STARTED("stream.started"), @@ -32,11 +33,21 @@ public enum Events { @JsonValue private final String value; - private Events(String value) { + Events(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (Events o: Events.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Export.java b/src/main/java/studio/livepeer/livepeer/models/components/Export.java index b1e08e18..2d6bfdae 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Export.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Export.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,14 +11,14 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * Export - Output of the export task + * Export + * + *

Output of the export task */ - public class Export { @JsonInclude(Include.NON_ABSENT) @@ -44,22 +42,24 @@ public Optional ipfs() { return (Optional) ipfs; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Export withIpfs(TaskIpfs ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = Optional.ofNullable(ipfs); return this; } + public Export withIpfs(Optional ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = ipfs; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -70,12 +70,12 @@ public boolean equals(java.lang.Object o) { } Export other = (Export) o; return - Objects.deepEquals(this.ipfs, other.ipfs); + Utils.enhancedDeepEquals(this.ipfs, other.ipfs); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( ipfs); } @@ -84,15 +84,17 @@ public String toString() { return Utils.toString(Export.class, "ipfs", ipfs); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional ipfs = Optional.empty(); - + + private Optional ipfs = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder ipfs(TaskIpfs ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = Optional.ofNullable(ipfs); @@ -104,11 +106,12 @@ public Builder ipfs(Optional ipfs) { this.ipfs = ipfs; return this; } - + public Export build() { + return new Export( ipfs); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/ExportData.java b/src/main/java/studio/livepeer/livepeer/models/components/ExportData.java index 12b52529..6c1d22a1 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/ExportData.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/ExportData.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,14 +11,14 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * ExportData - Output of the export data task + * ExportData + * + *

Output of the export data task */ - public class ExportData { @JsonInclude(Include.NON_ABSENT) @@ -44,22 +42,24 @@ public Optional ipfs() { return (Optional) ipfs; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public ExportData withIpfs(TaskOutputIpfs ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = Optional.ofNullable(ipfs); return this; } + public ExportData withIpfs(Optional ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = ipfs; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -70,12 +70,12 @@ public boolean equals(java.lang.Object o) { } ExportData other = (ExportData) o; return - Objects.deepEquals(this.ipfs, other.ipfs); + Utils.enhancedDeepEquals(this.ipfs, other.ipfs); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( ipfs); } @@ -84,15 +84,17 @@ public String toString() { return Utils.toString(ExportData.class, "ipfs", ipfs); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional ipfs = Optional.empty(); - + + private Optional ipfs = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder ipfs(TaskOutputIpfs ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = Optional.ofNullable(ipfs); @@ -104,11 +106,12 @@ public Builder ipfs(Optional ipfs) { this.ipfs = ipfs; return this; } - + public ExportData build() { + return new ExportData( ipfs); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams.java b/src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams.java index 7c181094..8a1ed0e7 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams.java @@ -1,17 +1,14 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; @@ -19,9 +16,10 @@ import studio.livepeer.livepeer.utils.Utils; /** - * ExportTaskParams - Parameters for the export task + * ExportTaskParams + * + *

Parameters for the export task */ - @JsonDeserialize(using = ExportTaskParams._Deserializer.class) public class ExportTaskParams { @@ -73,12 +71,12 @@ public boolean equals(java.lang.Object o) { return false; } ExportTaskParams other = (ExportTaskParams) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -86,8 +84,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -98,3 +96,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams1.java b/src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams1.java index 521fa7f7..fedb1f2f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams1.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams1.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; public class ExportTaskParams1 { - /** * custom URL parameters for the export task */ @@ -37,10 +33,11 @@ public Custom custom() { return custom; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * custom URL parameters for the export task */ @@ -49,7 +46,7 @@ public ExportTaskParams1 withCustom(Custom custom) { this.custom = custom; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } ExportTaskParams1 other = (ExportTaskParams1) o; return - Objects.deepEquals(this.custom, other.custom); + Utils.enhancedDeepEquals(this.custom, other.custom); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( custom); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(ExportTaskParams1.class, "custom", custom); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Custom custom; - + + private Custom custom; + private Builder() { // force use of static builder() method } + /** * custom URL parameters for the export task */ @@ -91,11 +90,12 @@ public Builder custom(Custom custom) { this.custom = custom; return this; } - + public ExportTaskParams1 build() { + return new ExportTaskParams1( custom); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams2.java b/src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams2.java index 678aa8ea..cf5b365a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams2.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/ExportTaskParams2.java @@ -1,16 +1,13 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; @@ -31,16 +28,17 @@ public IpfsExportParams ipfs() { return ipfs; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public ExportTaskParams2 withIpfs(IpfsExportParams ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = ipfs; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -51,12 +49,12 @@ public boolean equals(java.lang.Object o) { } ExportTaskParams2 other = (ExportTaskParams2) o; return - Objects.deepEquals(this.ipfs, other.ipfs); + Utils.enhancedDeepEquals(this.ipfs, other.ipfs); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( ipfs); } @@ -65,25 +63,28 @@ public String toString() { return Utils.toString(ExportTaskParams2.class, "ipfs", ipfs); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private IpfsExportParams ipfs; - + + private IpfsExportParams ipfs; + private Builder() { // force use of static builder() method } + public Builder ipfs(IpfsExportParams ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = ipfs; return this; } - + public ExportTaskParams2 build() { + return new ExportTaskParams2( ipfs); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/FfmpegProfile.java b/src/main/java/studio/livepeer/livepeer/models/components/FfmpegProfile.java index 813166d3..dfdbf666 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/FfmpegProfile.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/FfmpegProfile.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,51 +12,60 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * FfmpegProfile - Transcode profile + * FfmpegProfile + * + *

Transcode profile */ - public class FfmpegProfile { @JsonProperty("width") private long width; + @JsonProperty("name") private String name; + @JsonProperty("height") private long height; + @JsonProperty("bitrate") private long bitrate; + @JsonProperty("fps") private long fps; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("fpsDen") private Optional fpsDen; /** - * Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it. - * + * Restricts the size of the output video using the constant quality feature. Increasing this value + * will result in a lower quality video. Note that this parameter might not work if the transcoder + * lacks support for it. */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("quality") private Optional quality; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("gop") private Optional gop; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("profile") private Optional profile; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("encoder") private Optional encoder; @@ -103,7 +110,10 @@ public FfmpegProfile( long height, long bitrate, long fps) { - this(width, name, height, bitrate, fps, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(width, name, height, + bitrate, fps, Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } @JsonIgnore @@ -137,8 +147,9 @@ public Optional fpsDen() { } /** - * Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it. - * + * Restricts the size of the output video using the constant quality feature. Increasing this value + * will result in a lower quality video. Note that this parameter might not work if the transcoder + * lacks support for it. */ @JsonIgnore public Optional quality() { @@ -162,10 +173,11 @@ public Optional encoder() { return (Optional) encoder; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public FfmpegProfile withWidth(long width) { Utils.checkNotNull(width, "width"); this.width = width; @@ -202,6 +214,7 @@ public FfmpegProfile withFpsDen(long fpsDen) { return this; } + public FfmpegProfile withFpsDen(Optional fpsDen) { Utils.checkNotNull(fpsDen, "fpsDen"); this.fpsDen = fpsDen; @@ -209,8 +222,9 @@ public FfmpegProfile withFpsDen(Optional fpsDen) { } /** - * Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it. - * + * Restricts the size of the output video using the constant quality feature. Increasing this value + * will result in a lower quality video. Note that this parameter might not work if the transcoder + * lacks support for it. */ public FfmpegProfile withQuality(long quality) { Utils.checkNotNull(quality, "quality"); @@ -218,9 +232,11 @@ public FfmpegProfile withQuality(long quality) { return this; } + /** - * Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it. - * + * Restricts the size of the output video using the constant quality feature. Increasing this value + * will result in a lower quality video. Note that this parameter might not work if the transcoder + * lacks support for it. */ public FfmpegProfile withQuality(Optional quality) { Utils.checkNotNull(quality, "quality"); @@ -234,6 +250,7 @@ public FfmpegProfile withGop(String gop) { return this; } + public FfmpegProfile withGop(Optional gop) { Utils.checkNotNull(gop, "gop"); this.gop = gop; @@ -246,6 +263,7 @@ public FfmpegProfile withProfile(Profile profile) { return this; } + public FfmpegProfile withProfile(Optional profile) { Utils.checkNotNull(profile, "profile"); this.profile = profile; @@ -258,12 +276,13 @@ public FfmpegProfile withEncoder(Encoder encoder) { return this; } + public FfmpegProfile withEncoder(Optional encoder) { Utils.checkNotNull(encoder, "encoder"); this.encoder = encoder; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -274,30 +293,24 @@ public boolean equals(java.lang.Object o) { } FfmpegProfile other = (FfmpegProfile) o; return - Objects.deepEquals(this.width, other.width) && - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.height, other.height) && - Objects.deepEquals(this.bitrate, other.bitrate) && - Objects.deepEquals(this.fps, other.fps) && - Objects.deepEquals(this.fpsDen, other.fpsDen) && - Objects.deepEquals(this.quality, other.quality) && - Objects.deepEquals(this.gop, other.gop) && - Objects.deepEquals(this.profile, other.profile) && - Objects.deepEquals(this.encoder, other.encoder); + Utils.enhancedDeepEquals(this.width, other.width) && + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.height, other.height) && + Utils.enhancedDeepEquals(this.bitrate, other.bitrate) && + Utils.enhancedDeepEquals(this.fps, other.fps) && + Utils.enhancedDeepEquals(this.fpsDen, other.fpsDen) && + Utils.enhancedDeepEquals(this.quality, other.quality) && + Utils.enhancedDeepEquals(this.gop, other.gop) && + Utils.enhancedDeepEquals(this.profile, other.profile) && + Utils.enhancedDeepEquals(this.encoder, other.encoder); } @Override public int hashCode() { - return Objects.hash( - width, - name, - height, - bitrate, - fps, - fpsDen, - quality, - gop, - profile, + return Utils.enhancedHash( + width, name, height, + bitrate, fps, fpsDen, + quality, gop, profile, encoder); } @@ -315,63 +328,70 @@ public String toString() { "profile", profile, "encoder", encoder); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Long width; - + private String name; - + private Long height; - + private Long bitrate; - + private Long fps; - + private Optional fpsDen = Optional.empty(); - + private Optional quality = Optional.empty(); - + private Optional gop = Optional.empty(); - + private Optional profile = Optional.empty(); - - private Optional encoder = Optional.empty(); - + + private Optional encoder = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder width(long width) { Utils.checkNotNull(width, "width"); this.width = width; return this; } + public Builder name(String name) { Utils.checkNotNull(name, "name"); this.name = name; return this; } + public Builder height(long height) { Utils.checkNotNull(height, "height"); this.height = height; return this; } + public Builder bitrate(long bitrate) { Utils.checkNotNull(bitrate, "bitrate"); this.bitrate = bitrate; return this; } + public Builder fps(long fps) { Utils.checkNotNull(fps, "fps"); this.fps = fps; return this; } + public Builder fpsDen(long fpsDen) { Utils.checkNotNull(fpsDen, "fpsDen"); this.fpsDen = Optional.ofNullable(fpsDen); @@ -384,9 +404,11 @@ public Builder fpsDen(Optional fpsDen) { return this; } + /** - * Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it. - * + * Restricts the size of the output video using the constant quality feature. Increasing this value + * will result in a lower quality video. Note that this parameter might not work if the transcoder + * lacks support for it. */ public Builder quality(long quality) { Utils.checkNotNull(quality, "quality"); @@ -395,8 +417,9 @@ public Builder quality(long quality) { } /** - * Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it. - * + * Restricts the size of the output video using the constant quality feature. Increasing this value + * will result in a lower quality video. Note that this parameter might not work if the transcoder + * lacks support for it. */ public Builder quality(Optional quality) { Utils.checkNotNull(quality, "quality"); @@ -404,6 +427,7 @@ public Builder quality(Optional quality) { return this; } + public Builder gop(String gop) { Utils.checkNotNull(gop, "gop"); this.gop = Optional.ofNullable(gop); @@ -416,6 +440,7 @@ public Builder gop(Optional gop) { return this; } + public Builder profile(Profile profile) { Utils.checkNotNull(profile, "profile"); this.profile = Optional.ofNullable(profile); @@ -428,6 +453,7 @@ public Builder profile(Optional profile) { return this; } + public Builder encoder(Encoder encoder) { Utils.checkNotNull(encoder, "encoder"); this.encoder = Optional.ofNullable(encoder); @@ -439,20 +465,15 @@ public Builder encoder(Optional encoder) { this.encoder = encoder; return this; } - + public FfmpegProfile build() { + return new FfmpegProfile( - width, - name, - height, - bitrate, - fps, - fpsDen, - quality, - gop, - profile, + width, name, height, + bitrate, fps, fpsDen, + quality, gop, profile, encoder); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Fmp4.java b/src/main/java/studio/livepeer/livepeer/models/components/Fmp4.java index 74815dc6..444fb815 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Fmp4.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Fmp4.java @@ -1,24 +1,21 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * Fmp4 - FMP4 output format + * Fmp4 + * + *

FMP4 output format */ - public class Fmp4 { - /** * Path for the FMP4 output */ @@ -40,10 +37,11 @@ public String path() { return path; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Path for the FMP4 output */ @@ -52,7 +50,7 @@ public Fmp4 withPath(String path) { this.path = path; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -63,12 +61,12 @@ public boolean equals(java.lang.Object o) { } Fmp4 other = (Fmp4) o; return - Objects.deepEquals(this.path, other.path); + Utils.enhancedDeepEquals(this.path, other.path); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( path); } @@ -77,15 +75,17 @@ public String toString() { return Utils.toString(Fmp4.class, "path", path); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String path; - + + private String path; + private Builder() { // force use of static builder() method } + /** * Path for the FMP4 output */ @@ -94,11 +94,12 @@ public Builder path(String path) { this.path = path; return this; } - + public Fmp4 build() { + return new Fmp4( path); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/GetRoomUserResponse.java b/src/main/java/studio/livepeer/livepeer/models/components/GetRoomUserResponse.java index c2f76670..6d514784 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/GetRoomUserResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/GetRoomUserResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -15,14 +13,12 @@ import java.lang.Long; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.LazySingletonValue; import studio.livepeer.livepeer.utils.Utils; public class GetRoomUserResponse { - /** * The ID of the user */ @@ -78,7 +74,8 @@ public GetRoomUserResponse( } public GetRoomUserResponse() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); } /** @@ -121,10 +118,11 @@ public Optional metadata() { return metadata; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The ID of the user */ @@ -134,6 +132,7 @@ public GetRoomUserResponse withId(String id) { return this; } + /** * The ID of the user */ @@ -152,6 +151,7 @@ public GetRoomUserResponse withJoinedAt(long joinedAt) { return this; } + /** * Timestamp (in milliseconds) at which the user joined */ @@ -170,6 +170,7 @@ public GetRoomUserResponse withName(String name) { return this; } + /** * The display name of the user */ @@ -188,6 +189,7 @@ public GetRoomUserResponse withIsPublisher(boolean isPublisher) { return this; } + /** * Whether a user is allowed to publish audio/video tracks */ @@ -206,6 +208,7 @@ public GetRoomUserResponse withMetadata(String metadata) { return this; } + /** * User defined payload to store for the participant */ @@ -214,7 +217,7 @@ public GetRoomUserResponse withMetadata(Optional metadata) { this.metadata = metadata; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -225,21 +228,18 @@ public boolean equals(java.lang.Object o) { } GetRoomUserResponse other = (GetRoomUserResponse) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.joinedAt, other.joinedAt) && - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.isPublisher, other.isPublisher) && - Objects.deepEquals(this.metadata, other.metadata); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.joinedAt, other.joinedAt) && + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.isPublisher, other.isPublisher) && + Utils.enhancedDeepEquals(this.metadata, other.metadata); } @Override public int hashCode() { - return Objects.hash( - id, - joinedAt, - name, - isPublisher, - metadata); + return Utils.enhancedHash( + id, joinedAt, name, + isPublisher, metadata); } @Override @@ -251,23 +251,25 @@ public String toString() { "isPublisher", isPublisher, "metadata", metadata); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional id = Optional.empty(); - + private Optional joinedAt = Optional.empty(); - + private Optional name = Optional.empty(); - + private Optional isPublisher; - - private Optional metadata = Optional.empty(); - + + private Optional metadata = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * The ID of the user */ @@ -286,6 +288,7 @@ public Builder id(Optional id) { return this; } + /** * Timestamp (in milliseconds) at which the user joined */ @@ -304,6 +307,7 @@ public Builder joinedAt(Optional joinedAt) { return this; } + /** * The display name of the user */ @@ -322,6 +326,7 @@ public Builder name(Optional name) { return this; } + /** * Whether a user is allowed to publish audio/video tracks */ @@ -340,6 +345,7 @@ public Builder isPublisher(Optional isPublisher) { return this; } + /** * User defined payload to store for the participant */ @@ -357,19 +363,18 @@ public Builder metadata(Optional metadata) { this.metadata = metadata; return this; } - + public GetRoomUserResponse build() { if (isPublisher == null) { isPublisher = _SINGLETON_VALUE_IsPublisher.value(); } + return new GetRoomUserResponse( - id, - joinedAt, - name, - isPublisher, - metadata); + id, joinedAt, name, + isPublisher, metadata); } + private static final LazySingletonValue> _SINGLETON_VALUE_IsPublisher = new LazySingletonValue<>( "isPublisher", @@ -377,4 +382,3 @@ public GetRoomUserResponse build() { new TypeReference>() {}); } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Hash.java b/src/main/java/studio/livepeer/livepeer/models/components/Hash.java index 6d78f60a..6b6fe1a0 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Hash.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Hash.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,13 +10,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class Hash { - /** * Hash of the asset */ @@ -63,10 +59,11 @@ public Optional algorithm() { return algorithm; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Hash of the asset */ @@ -76,6 +73,7 @@ public Hash withHash(String hash) { return this; } + /** * Hash of the asset */ @@ -94,6 +92,7 @@ public Hash withAlgorithm(String algorithm) { return this; } + /** * Hash algorithm used to compute the hash */ @@ -102,7 +101,7 @@ public Hash withAlgorithm(Optional algorithm) { this.algorithm = algorithm; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -113,15 +112,14 @@ public boolean equals(java.lang.Object o) { } Hash other = (Hash) o; return - Objects.deepEquals(this.hash, other.hash) && - Objects.deepEquals(this.algorithm, other.algorithm); + Utils.enhancedDeepEquals(this.hash, other.hash) && + Utils.enhancedDeepEquals(this.algorithm, other.algorithm); } @Override public int hashCode() { - return Objects.hash( - hash, - algorithm); + return Utils.enhancedHash( + hash, algorithm); } @Override @@ -130,17 +128,19 @@ public String toString() { "hash", hash, "algorithm", algorithm); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional hash = Optional.empty(); - - private Optional algorithm = Optional.empty(); - + + private Optional algorithm = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Hash of the asset */ @@ -159,6 +159,7 @@ public Builder hash(Optional hash) { return this; } + /** * Hash algorithm used to compute the hash */ @@ -176,12 +177,12 @@ public Builder algorithm(Optional algorithm) { this.algorithm = algorithm; return this; } - + public Hash build() { + return new Hash( - hash, - algorithm); + hash, algorithm); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Hls.java b/src/main/java/studio/livepeer/livepeer/models/components/Hls.java index 628daf38..1e95b4ab 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Hls.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Hls.java @@ -1,24 +1,21 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * Hls - HLS output format + * Hls + * + *

HLS output format */ - public class Hls { - /** * Path for the HLS output */ @@ -40,10 +37,11 @@ public String path() { return path; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Path for the HLS output */ @@ -52,7 +50,7 @@ public Hls withPath(String path) { this.path = path; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -63,12 +61,12 @@ public boolean equals(java.lang.Object o) { } Hls other = (Hls) o; return - Objects.deepEquals(this.path, other.path); + Utils.enhancedDeepEquals(this.path, other.path); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( path); } @@ -77,15 +75,17 @@ public String toString() { return Utils.toString(Hls.class, "path", path); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String path; - + + private String path; + private Builder() { // force use of static builder() method } + /** * Path for the HLS output */ @@ -94,11 +94,12 @@ public Builder path(String path) { this.path = path; return this; } - + public Hls build() { + return new Hls( path); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Hrn.java b/src/main/java/studio/livepeer/livepeer/models/components/Hrn.java index e5bad45c..d56f181c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Hrn.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Hrn.java @@ -1,14 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * Hrn - Human Readable Name + * Hrn + * + *

Human Readable Name */ public enum Hrn { HLS_TS("HLS (TS)"), @@ -22,11 +25,21 @@ public enum Hrn { @JsonValue private final String value; - private Hrn(String value) { + Hrn(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (Hrn o: Hrn.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Input.java b/src/main/java/studio/livepeer/livepeer/models/components/Input.java index 62249672..54e8714a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Input.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Input.java @@ -1,24 +1,20 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; import studio.livepeer.livepeer.utils.Utils.TypeReferenceWithShape; import studio.livepeer.livepeer.utils.Utils; - @JsonDeserialize(using = Input._Deserializer.class) public class Input { @@ -70,12 +66,12 @@ public boolean equals(java.lang.Object o) { return false; } Input other = (Input) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -83,8 +79,8 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(Input.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -95,3 +91,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Input1.java b/src/main/java/studio/livepeer/livepeer/models/components/Input1.java index 82e62fa0..281283eb 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Input1.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Input1.java @@ -1,24 +1,21 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * Input1 - URL input video + * Input1 + * + *

URL input video */ - public class Input1 { - /** * URL of the video to transcode */ @@ -40,10 +37,11 @@ public String url() { return url; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * URL of the video to transcode */ @@ -52,7 +50,7 @@ public Input1 withUrl(String url) { this.url = url; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -63,12 +61,12 @@ public boolean equals(java.lang.Object o) { } Input1 other = (Input1) o; return - Objects.deepEquals(this.url, other.url); + Utils.enhancedDeepEquals(this.url, other.url); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( url); } @@ -77,15 +75,17 @@ public String toString() { return Utils.toString(Input1.class, "url", url); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String url; - + + private String url; + private Builder() { // force use of static builder() method } + /** * URL of the video to transcode */ @@ -94,11 +94,12 @@ public Builder url(String url) { this.url = url; return this; } - + public Input1 build() { + return new Input1( url); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Input2.java b/src/main/java/studio/livepeer/livepeer/models/components/Input2.java index cda9795f..6281dc3b 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Input2.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Input2.java @@ -1,34 +1,31 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * Input2 - S3-like storage input video + * Input2 + * + *

S3-like storage input video */ - public class Input2 { - /** * Type of service. This is optional and defaults to `url` if * ŚURL field is provided. - * */ @JsonProperty("type") private InputType type; /** - * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) + * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, + * GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) */ @JsonProperty("endpoint") private String endpoint; @@ -73,7 +70,6 @@ public Input2( /** * Type of service. This is optional and defaults to `url` if * ŚURL field is provided. - * */ @JsonIgnore public InputType type() { @@ -81,7 +77,8 @@ public InputType type() { } /** - * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) + * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, + * GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) */ @JsonIgnore public String endpoint() { @@ -112,14 +109,14 @@ public Credentials credentials() { return credentials; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Type of service. This is optional and defaults to `url` if * ŚURL field is provided. - * */ public Input2 withType(InputType type) { Utils.checkNotNull(type, "type"); @@ -128,7 +125,8 @@ public Input2 withType(InputType type) { } /** - * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) + * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, + * GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) */ public Input2 withEndpoint(String endpoint) { Utils.checkNotNull(endpoint, "endpoint"); @@ -162,7 +160,7 @@ public Input2 withCredentials(Credentials credentials) { this.credentials = credentials; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -173,21 +171,18 @@ public boolean equals(java.lang.Object o) { } Input2 other = (Input2) o; return - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.endpoint, other.endpoint) && - Objects.deepEquals(this.bucket, other.bucket) && - Objects.deepEquals(this.path, other.path) && - Objects.deepEquals(this.credentials, other.credentials); + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.endpoint, other.endpoint) && + Utils.enhancedDeepEquals(this.bucket, other.bucket) && + Utils.enhancedDeepEquals(this.path, other.path) && + Utils.enhancedDeepEquals(this.credentials, other.credentials); } @Override public int hashCode() { - return Objects.hash( - type, - endpoint, - bucket, - path, - credentials); + return Utils.enhancedHash( + type, endpoint, bucket, + path, credentials); } @Override @@ -199,27 +194,28 @@ public String toString() { "path", path, "credentials", credentials); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private InputType type; - + private String endpoint; - + private String bucket; - + private String path; - - private Credentials credentials; - + + private Credentials credentials; + private Builder() { // force use of static builder() method } + /** * Type of service. This is optional and defaults to `url` if * ŚURL field is provided. - * */ public Builder type(InputType type) { Utils.checkNotNull(type, "type"); @@ -227,8 +223,10 @@ public Builder type(InputType type) { return this; } + /** - * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) + * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, + * GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) */ public Builder endpoint(String endpoint) { Utils.checkNotNull(endpoint, "endpoint"); @@ -236,6 +234,7 @@ public Builder endpoint(String endpoint) { return this; } + /** * Bucket with input file */ @@ -245,6 +244,7 @@ public Builder bucket(String bucket) { return this; } + /** * Path to the input file inside the bucket */ @@ -254,6 +254,7 @@ public Builder path(String path) { return this; } + /** * Credentials for the private input video storage */ @@ -262,15 +263,13 @@ public Builder credentials(Credentials credentials) { this.credentials = credentials; return this; } - + public Input2 build() { + return new Input2( - type, - endpoint, - bucket, - path, - credentials); + type, endpoint, bucket, + path, credentials); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/InputCreatorId.java b/src/main/java/studio/livepeer/livepeer/models/components/InputCreatorId.java index 21877917..0fa5f36c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/InputCreatorId.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/InputCreatorId.java @@ -1,24 +1,20 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; import studio.livepeer.livepeer.utils.Utils.TypeReferenceWithShape; import studio.livepeer.livepeer.utils.Utils; - @JsonDeserialize(using = InputCreatorId._Deserializer.class) public class InputCreatorId { @@ -70,12 +66,12 @@ public boolean equals(java.lang.Object o) { return false; } InputCreatorId other = (InputCreatorId) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -83,8 +79,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -95,3 +91,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/InputCreatorId1.java b/src/main/java/studio/livepeer/livepeer/models/components/InputCreatorId1.java index 48f7e4b5..72772e07 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/InputCreatorId1.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/InputCreatorId1.java @@ -1,16 +1,13 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; @@ -19,6 +16,7 @@ public class InputCreatorId1 { @JsonProperty("type") private InputCreatorIdType type; + @JsonProperty("value") private String value; @@ -42,10 +40,11 @@ public String value() { return value; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public InputCreatorId1 withType(InputCreatorIdType type) { Utils.checkNotNull(type, "type"); this.type = type; @@ -57,7 +56,7 @@ public InputCreatorId1 withValue(String value) { this.value = value; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -68,15 +67,14 @@ public boolean equals(java.lang.Object o) { } InputCreatorId1 other = (InputCreatorId1) o; return - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.value, other.value); + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.value, other.value); } @Override public int hashCode() { - return Objects.hash( - type, - value); + return Utils.enhancedHash( + type, value); } @Override @@ -85,34 +83,37 @@ public String toString() { "type", type, "value", value); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private InputCreatorIdType type; - - private String value; - + + private String value; + private Builder() { // force use of static builder() method } + public Builder type(InputCreatorIdType type) { Utils.checkNotNull(type, "type"); this.type = type; return this; } + public Builder value(String value) { Utils.checkNotNull(value, "value"); this.value = value; return this; } - + public InputCreatorId1 build() { + return new InputCreatorId1( - type, - value); + type, value); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/InputCreatorIdType.java b/src/main/java/studio/livepeer/livepeer/models/components/InputCreatorIdType.java index 9ce83185..1b94da7c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/InputCreatorIdType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/InputCreatorIdType.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum InputCreatorIdType { UNVERIFIED("unverified"); @@ -13,11 +14,21 @@ public enum InputCreatorIdType { @JsonValue private final String value; - private InputCreatorIdType(String value) { + InputCreatorIdType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (InputCreatorIdType o: InputCreatorIdType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/InputType.java b/src/main/java/studio/livepeer/livepeer/models/components/InputType.java index 08088cd6..114baa35 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/InputType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/InputType.java @@ -1,16 +1,18 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * InputType - Type of service. This is optional and defaults to `url` if - * ŚURL field is provided. + * InputType * + *

Type of service. This is optional and defaults to `url` if + * ŚURL field is provided. */ public enum InputType { S3("s3"); @@ -18,11 +20,21 @@ public enum InputType { @JsonValue private final String value; - private InputType(String value) { + InputType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (InputType o: InputType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Ipfs.java b/src/main/java/studio/livepeer/livepeer/models/components/Ipfs.java index 26b8b205..d1d876e8 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Ipfs.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Ipfs.java @@ -1,17 +1,15 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Boolean; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; @@ -19,12 +17,12 @@ import studio.livepeer.livepeer.utils.Utils; /** - * Ipfs - Set to true to make default export to IPFS. To customize the + * Ipfs + * + *

Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ - @JsonDeserialize(using = Ipfs._Deserializer.class) public class Ipfs { @@ -76,12 +74,12 @@ public boolean equals(java.lang.Object o) { return false; } Ipfs other = (Ipfs) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -89,8 +87,8 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(Ipfs.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -101,3 +99,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Ipfs1.java b/src/main/java/studio/livepeer/livepeer/models/components/Ipfs1.java index b61a480e..3e4921f3 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Ipfs1.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Ipfs1.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,7 +11,6 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; @@ -41,10 +38,11 @@ public JsonNullable spec() { return (JsonNullable) spec; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Ipfs1 withSpec(Spec spec) { Utils.checkNotNull(spec, "spec"); this.spec = JsonNullable.of(spec); @@ -56,7 +54,7 @@ public Ipfs1 withSpec(JsonNullable spec) { this.spec = spec; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -67,12 +65,12 @@ public boolean equals(java.lang.Object o) { } Ipfs1 other = (Ipfs1) o; return - Objects.deepEquals(this.spec, other.spec); + Utils.enhancedDeepEquals(this.spec, other.spec); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( spec); } @@ -81,15 +79,17 @@ public String toString() { return Utils.toString(Ipfs1.class, "spec", spec); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private JsonNullable spec = JsonNullable.undefined(); - + + private JsonNullable spec = JsonNullable.undefined(); + private Builder() { // force use of static builder() method } + public Builder spec(Spec spec) { Utils.checkNotNull(spec, "spec"); this.spec = JsonNullable.of(spec); @@ -101,11 +101,12 @@ public Builder spec(JsonNullable spec) { this.spec = spec; return this; } - + public Ipfs1 build() { + return new Ipfs1( spec); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/IpfsExportParams.java b/src/main/java/studio/livepeer/livepeer/models/components/IpfsExportParams.java index b2425027..7a59f3f1 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/IpfsExportParams.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/IpfsExportParams.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,7 +12,6 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -28,7 +25,6 @@ public class IpfsExportParams { /** * Custom credentials for the Piñata service. Must have either * a JWT or an API key and an API secret. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("pinata") @@ -57,7 +53,6 @@ public Optional dollarRef() { /** * Custom credentials for the Piñata service. Must have either * a JWT or an API key and an API secret. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -65,16 +60,18 @@ public Optional pinata() { return (Optional) pinata; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public IpfsExportParams withDollarRef(Object dollarRef) { Utils.checkNotNull(dollarRef, "dollarRef"); this.dollarRef = Optional.ofNullable(dollarRef); return this; } + public IpfsExportParams withDollarRef(Optional dollarRef) { Utils.checkNotNull(dollarRef, "dollarRef"); this.dollarRef = dollarRef; @@ -84,7 +81,6 @@ public IpfsExportParams withDollarRef(Optional dollarRef) { /** * Custom credentials for the Piñata service. Must have either * a JWT or an API key and an API secret. - * */ public IpfsExportParams withPinata(Pinata pinata) { Utils.checkNotNull(pinata, "pinata"); @@ -92,17 +88,17 @@ public IpfsExportParams withPinata(Pinata pinata) { return this; } + /** * Custom credentials for the Piñata service. Must have either * a JWT or an API key and an API secret. - * */ public IpfsExportParams withPinata(Optional pinata) { Utils.checkNotNull(pinata, "pinata"); this.pinata = pinata; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -113,15 +109,14 @@ public boolean equals(java.lang.Object o) { } IpfsExportParams other = (IpfsExportParams) o; return - Objects.deepEquals(this.dollarRef, other.dollarRef) && - Objects.deepEquals(this.pinata, other.pinata); + Utils.enhancedDeepEquals(this.dollarRef, other.dollarRef) && + Utils.enhancedDeepEquals(this.pinata, other.pinata); } @Override public int hashCode() { - return Objects.hash( - dollarRef, - pinata); + return Utils.enhancedHash( + dollarRef, pinata); } @Override @@ -130,17 +125,19 @@ public String toString() { "dollarRef", dollarRef, "pinata", pinata); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional dollarRef = Optional.empty(); - - private Optional pinata = Optional.empty(); - + + private Optional pinata = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder dollarRef(Object dollarRef) { Utils.checkNotNull(dollarRef, "dollarRef"); this.dollarRef = Optional.ofNullable(dollarRef); @@ -153,10 +150,10 @@ public Builder dollarRef(Optional dollarRef) { return this; } + /** * Custom credentials for the Piñata service. Must have either * a JWT or an API key and an API secret. - * */ public Builder pinata(Pinata pinata) { Utils.checkNotNull(pinata, "pinata"); @@ -167,19 +164,18 @@ public Builder pinata(Pinata pinata) { /** * Custom credentials for the Piñata service. Must have either * a JWT or an API key and an API secret. - * */ public Builder pinata(Optional pinata) { Utils.checkNotNull(pinata, "pinata"); this.pinata = pinata; return this; } - + public IpfsExportParams build() { + return new IpfsExportParams( - dollarRef, - pinata); + dollarRef, pinata); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/IpfsFileInfo.java b/src/main/java/studio/livepeer/livepeer/models/components/IpfsFileInfo.java index cf4da8cc..7552a25a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/IpfsFileInfo.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/IpfsFileInfo.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,13 +10,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class IpfsFileInfo { - /** * CID of the file on IPFS */ @@ -81,10 +77,11 @@ public Optional gatewayUrl() { return gatewayUrl; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * CID of the file on IPFS */ @@ -103,6 +100,7 @@ public IpfsFileInfo withUrl(String url) { return this; } + /** * URL with IPFS scheme for the file */ @@ -121,6 +119,7 @@ public IpfsFileInfo withGatewayUrl(String gatewayUrl) { return this; } + /** * URL to access file via HTTP through an IPFS gateway */ @@ -129,7 +128,7 @@ public IpfsFileInfo withGatewayUrl(Optional gatewayUrl) { this.gatewayUrl = gatewayUrl; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -140,17 +139,15 @@ public boolean equals(java.lang.Object o) { } IpfsFileInfo other = (IpfsFileInfo) o; return - Objects.deepEquals(this.cid, other.cid) && - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.gatewayUrl, other.gatewayUrl); + Utils.enhancedDeepEquals(this.cid, other.cid) && + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.gatewayUrl, other.gatewayUrl); } @Override public int hashCode() { - return Objects.hash( - cid, - url, - gatewayUrl); + return Utils.enhancedHash( + cid, url, gatewayUrl); } @Override @@ -160,19 +157,21 @@ public String toString() { "url", url, "gatewayUrl", gatewayUrl); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String cid; - + private Optional url = Optional.empty(); - - private Optional gatewayUrl = Optional.empty(); - + + private Optional gatewayUrl = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * CID of the file on IPFS */ @@ -182,6 +181,7 @@ public Builder cid(String cid) { return this; } + /** * URL with IPFS scheme for the file */ @@ -200,6 +200,7 @@ public Builder url(Optional url) { return this; } + /** * URL to access file via HTTP through an IPFS gateway */ @@ -217,13 +218,12 @@ public Builder gatewayUrl(Optional gatewayUrl) { this.gatewayUrl = gatewayUrl; return this; } - + public IpfsFileInfo build() { + return new IpfsFileInfo( - cid, - url, - gatewayUrl); + cid, url, gatewayUrl); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/IsMobile.java b/src/main/java/studio/livepeer/livepeer/models/components/IsMobile.java index 2a54d6f8..dd52e836 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/IsMobile.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/IsMobile.java @@ -1,17 +1,15 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Boolean; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; @@ -19,9 +17,10 @@ import studio.livepeer.livepeer.utils.Utils; /** - * IsMobile - Indicates whether the stream will be pulled from a mobile source. + * IsMobile + * + *

Indicates whether the stream will be pulled from a mobile source. */ - @JsonDeserialize(using = IsMobile._Deserializer.class) public class IsMobile { @@ -73,12 +72,12 @@ public boolean equals(java.lang.Object o) { return false; } IsMobile other = (IsMobile) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -86,8 +85,8 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(IsMobile.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -98,3 +97,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/IsMobile1.java b/src/main/java/studio/livepeer/livepeer/models/components/IsMobile1.java index b7b31cd8..ccb04e77 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/IsMobile1.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/IsMobile1.java @@ -1,13 +1,16 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; /** - * IsMobile1 - 0: not mobile, 1: mobile screen share, 2: mobile camera. + * IsMobile1 + * + *

0: not mobile, 1: mobile screen share, 2: mobile camera. */ public enum IsMobile1 { ZERO(0L), @@ -17,11 +20,21 @@ public enum IsMobile1 { @JsonValue private final long value; - private IsMobile1(long value) { + IsMobile1(long value) { this.value = value; } public long value() { return value; } + + public static Optional fromValue(long value) { + for (IsMobile1 o: IsMobile1.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/LastFailure.java b/src/main/java/studio/livepeer/livepeer/models/components/LastFailure.java index ce1179b0..efe537dd 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/LastFailure.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/LastFailure.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,16 +11,15 @@ import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * LastFailure - failure timestamp and error message with status code + * LastFailure + * + *

failure timestamp and error message with status code */ - public class LastFailure { - /** * Timestamp (in milliseconds) at which the webhook last failed */ @@ -68,7 +65,8 @@ public LastFailure( } public LastFailure() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -103,10 +101,11 @@ public Optional statusCode() { return statusCode; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Timestamp (in milliseconds) at which the webhook last failed */ @@ -116,6 +115,7 @@ public LastFailure withTimestamp(double timestamp) { return this; } + /** * Timestamp (in milliseconds) at which the webhook last failed */ @@ -134,6 +134,7 @@ public LastFailure withError(String error) { return this; } + /** * Webhook failure error message */ @@ -152,6 +153,7 @@ public LastFailure withResponse(String response) { return this; } + /** * Webhook failure response */ @@ -170,6 +172,7 @@ public LastFailure withStatusCode(double statusCode) { return this; } + /** * Webhook failure status code */ @@ -178,7 +181,7 @@ public LastFailure withStatusCode(Optional statusCode) { this.statusCode = statusCode; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -189,18 +192,16 @@ public boolean equals(java.lang.Object o) { } LastFailure other = (LastFailure) o; return - Objects.deepEquals(this.timestamp, other.timestamp) && - Objects.deepEquals(this.error, other.error) && - Objects.deepEquals(this.response, other.response) && - Objects.deepEquals(this.statusCode, other.statusCode); + Utils.enhancedDeepEquals(this.timestamp, other.timestamp) && + Utils.enhancedDeepEquals(this.error, other.error) && + Utils.enhancedDeepEquals(this.response, other.response) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode); } @Override public int hashCode() { - return Objects.hash( - timestamp, - error, - response, + return Utils.enhancedHash( + timestamp, error, response, statusCode); } @@ -212,21 +213,23 @@ public String toString() { "response", response, "statusCode", statusCode); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional timestamp = Optional.empty(); - + private Optional error = Optional.empty(); - + private Optional response = Optional.empty(); - - private Optional statusCode = Optional.empty(); - + + private Optional statusCode = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Timestamp (in milliseconds) at which the webhook last failed */ @@ -245,6 +248,7 @@ public Builder timestamp(Optional timestamp) { return this; } + /** * Webhook failure error message */ @@ -263,6 +267,7 @@ public Builder error(Optional error) { return this; } + /** * Webhook failure response */ @@ -281,6 +286,7 @@ public Builder response(Optional response) { return this; } + /** * Webhook failure status code */ @@ -298,14 +304,13 @@ public Builder statusCode(Optional statusCode) { this.statusCode = statusCode; return this; } - + public LastFailure build() { + return new LastFailure( - timestamp, - error, - response, + timestamp, error, response, statusCode); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Live.java b/src/main/java/studio/livepeer/livepeer/models/components/Live.java index 6d5fded1..c8a5ed9f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Live.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Live.java @@ -1,10 +1,11 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; public enum Live { ZERO(0L), @@ -13,11 +14,21 @@ public enum Live { @JsonValue private final long value; - private Live(long value) { + Live(long value) { this.value = value; } public long value() { return value; } + + public static Optional fromValue(long value) { + for (Live o: Live.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Location.java b/src/main/java/studio/livepeer/livepeer/models/components/Location.java index 56ab88a1..b512fa44 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Location.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Location.java @@ -1,26 +1,23 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * Location - Approximate location of the pull source. The location is used to + * Location + * + *

Approximate location of the pull source. The location is used to * determine the closest Livepeer region to pull the stream from. */ - public class Location { - /** * Latitude of the pull source in degrees. North is positive, * south is negative. @@ -63,10 +60,11 @@ public double lon() { return lon; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Latitude of the pull source in degrees. North is positive, * south is negative. @@ -86,7 +84,7 @@ public Location withLon(double lon) { this.lon = lon; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -97,15 +95,14 @@ public boolean equals(java.lang.Object o) { } Location other = (Location) o; return - Objects.deepEquals(this.lat, other.lat) && - Objects.deepEquals(this.lon, other.lon); + Utils.enhancedDeepEquals(this.lat, other.lat) && + Utils.enhancedDeepEquals(this.lon, other.lon); } @Override public int hashCode() { - return Objects.hash( - lat, - lon); + return Utils.enhancedHash( + lat, lon); } @Override @@ -114,17 +111,19 @@ public String toString() { "lat", lat, "lon", lon); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Double lat; - - private Double lon; - + + private Double lon; + private Builder() { // force use of static builder() method } + /** * Latitude of the pull source in degrees. North is positive, * south is negative. @@ -135,6 +134,7 @@ public Builder lat(double lat) { return this; } + /** * Longitude of the pull source in degrees. East is positive, * west is negative. @@ -144,12 +144,12 @@ public Builder lon(double lon) { this.lon = lon; return this; } - + public Location build() { + return new Location( - lat, - lon); + lat, lon); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Message.java b/src/main/java/studio/livepeer/livepeer/models/components/Message.java index 22aa0ccb..602bb314 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Message.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Message.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -12,24 +10,27 @@ import java.lang.Override; import java.lang.String; import java.util.List; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * Message - Video Metadata EIP-712 message content + * Message + * + *

Video Metadata EIP-712 message content */ - public class Message { @JsonProperty("video") private String video; + @JsonProperty("attestations") private List attestations; + @JsonProperty("signer") private String signer; + @JsonProperty("timestamp") private double timestamp; @@ -69,10 +70,11 @@ public double timestamp() { return timestamp; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Message withVideo(String video) { Utils.checkNotNull(video, "video"); this.video = video; @@ -96,7 +98,7 @@ public Message withTimestamp(double timestamp) { this.timestamp = timestamp; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -107,18 +109,16 @@ public boolean equals(java.lang.Object o) { } Message other = (Message) o; return - Objects.deepEquals(this.video, other.video) && - Objects.deepEquals(this.attestations, other.attestations) && - Objects.deepEquals(this.signer, other.signer) && - Objects.deepEquals(this.timestamp, other.timestamp); + Utils.enhancedDeepEquals(this.video, other.video) && + Utils.enhancedDeepEquals(this.attestations, other.attestations) && + Utils.enhancedDeepEquals(this.signer, other.signer) && + Utils.enhancedDeepEquals(this.timestamp, other.timestamp); } @Override public int hashCode() { - return Objects.hash( - video, - attestations, - signer, + return Utils.enhancedHash( + video, attestations, signer, timestamp); } @@ -130,52 +130,56 @@ public String toString() { "signer", signer, "timestamp", timestamp); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String video; - + private List attestations; - + private String signer; - - private Double timestamp; - + + private Double timestamp; + private Builder() { // force use of static builder() method } + public Builder video(String video) { Utils.checkNotNull(video, "video"); this.video = video; return this; } + public Builder attestations(List attestations) { Utils.checkNotNull(attestations, "attestations"); this.attestations = attestations; return this; } + public Builder signer(String signer) { Utils.checkNotNull(signer, "signer"); this.signer = signer; return this; } + public Builder timestamp(double timestamp) { Utils.checkNotNull(timestamp, "timestamp"); this.timestamp = timestamp; return this; } - + public Message build() { + return new Message( - video, - attestations, - signer, + video, attestations, signer, timestamp); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Meta.java b/src/main/java/studio/livepeer/livepeer/models/components/Meta.java index e61a2ca3..7b3d9e52 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Meta.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Meta.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,7 +12,6 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; @@ -33,13 +30,16 @@ public class Meta { @JsonProperty("playbackPolicy") private JsonNullable playbackPolicy; + @JsonProperty("source") private List source; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("dvrPlayback") private Optional> dvrPlayback; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("attestation") private Optional attestation; @@ -65,7 +65,8 @@ public Meta( public Meta( List source) { - this(Optional.empty(), JsonNullable.undefined(), source, Optional.empty(), Optional.empty()); + this(Optional.empty(), JsonNullable.undefined(), source, + Optional.empty(), Optional.empty()); } @SuppressWarnings("unchecked") @@ -100,16 +101,18 @@ public Optional attestation() { return (Optional) attestation; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Meta withLive(Live live) { Utils.checkNotNull(live, "live"); this.live = Optional.ofNullable(live); return this; } + public Meta withLive(Optional live) { Utils.checkNotNull(live, "live"); this.live = live; @@ -146,6 +149,7 @@ public Meta withDvrPlayback(List dvrPlayback) { return this; } + public Meta withDvrPlayback(Optional> dvrPlayback) { Utils.checkNotNull(dvrPlayback, "dvrPlayback"); this.dvrPlayback = dvrPlayback; @@ -158,12 +162,13 @@ public Meta withAttestation(Attestation attestation) { return this; } + public Meta withAttestation(Optional attestation) { Utils.checkNotNull(attestation, "attestation"); this.attestation = attestation; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -174,21 +179,18 @@ public boolean equals(java.lang.Object o) { } Meta other = (Meta) o; return - Objects.deepEquals(this.live, other.live) && - Objects.deepEquals(this.playbackPolicy, other.playbackPolicy) && - Objects.deepEquals(this.source, other.source) && - Objects.deepEquals(this.dvrPlayback, other.dvrPlayback) && - Objects.deepEquals(this.attestation, other.attestation); + Utils.enhancedDeepEquals(this.live, other.live) && + Utils.enhancedDeepEquals(this.playbackPolicy, other.playbackPolicy) && + Utils.enhancedDeepEquals(this.source, other.source) && + Utils.enhancedDeepEquals(this.dvrPlayback, other.dvrPlayback) && + Utils.enhancedDeepEquals(this.attestation, other.attestation); } @Override public int hashCode() { - return Objects.hash( - live, - playbackPolicy, - source, - dvrPlayback, - attestation); + return Utils.enhancedHash( + live, playbackPolicy, source, + dvrPlayback, attestation); } @Override @@ -200,23 +202,25 @@ public String toString() { "dvrPlayback", dvrPlayback, "attestation", attestation); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional live = Optional.empty(); - + private JsonNullable playbackPolicy = JsonNullable.undefined(); - + private List source; - + private Optional> dvrPlayback = Optional.empty(); - - private Optional attestation = Optional.empty(); - + + private Optional attestation = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder live(Live live) { Utils.checkNotNull(live, "live"); this.live = Optional.ofNullable(live); @@ -229,6 +233,7 @@ public Builder live(Optional live) { return this; } + /** * Whether the playback policy for an asset or stream is public or signed */ @@ -247,12 +252,14 @@ public Builder playbackPolicy(JsonNullable playbackPol return this; } + public Builder source(List source) { Utils.checkNotNull(source, "source"); this.source = source; return this; } + public Builder dvrPlayback(List dvrPlayback) { Utils.checkNotNull(dvrPlayback, "dvrPlayback"); this.dvrPlayback = Optional.ofNullable(dvrPlayback); @@ -265,6 +272,7 @@ public Builder dvrPlayback(Optional> dvrPlayback) { return this; } + public Builder attestation(Attestation attestation) { Utils.checkNotNull(attestation, "attestation"); this.attestation = Optional.ofNullable(attestation); @@ -276,15 +284,13 @@ public Builder attestation(Optional attestation) { this.attestation = attestation; return this; } - + public Meta build() { + return new Meta( - live, - playbackPolicy, - source, - dvrPlayback, - attestation); + live, playbackPolicy, source, + dvrPlayback, attestation); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Mp4.java b/src/main/java/studio/livepeer/livepeer/models/components/Mp4.java index 95e32399..7605a451 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Mp4.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Mp4.java @@ -1,24 +1,21 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * Mp4 - MP4 output format + * Mp4 + * + *

MP4 output format */ - public class Mp4 { - /** * Path for the MP4 output */ @@ -40,10 +37,11 @@ public String path() { return path; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Path for the MP4 output */ @@ -52,7 +50,7 @@ public Mp4 withPath(String path) { this.path = path; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -63,12 +61,12 @@ public boolean equals(java.lang.Object o) { } Mp4 other = (Mp4) o; return - Objects.deepEquals(this.path, other.path); + Utils.enhancedDeepEquals(this.path, other.path); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( path); } @@ -77,15 +75,17 @@ public String toString() { return Utils.toString(Mp4.class, "path", path); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String path; - + + private String path; + private Builder() { // force use of static builder() method } + /** * Path for the MP4 output */ @@ -94,11 +94,12 @@ public Builder path(String path) { this.path = path; return this; } - + public Mp4 build() { + return new Mp4( path); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Multistream.java b/src/main/java/studio/livepeer/livepeer/models/components/Multistream.java index 1993c18c..75022ff2 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Multistream.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Multistream.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,17 +12,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class Multistream { - /** * References to targets where this stream will be simultaneously * streamed to - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("targets") @@ -44,7 +39,6 @@ public Multistream() { /** * References to targets where this stream will be simultaneously * streamed to - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -52,14 +46,14 @@ public Optional> targets() { return (Optional>) targets; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * References to targets where this stream will be simultaneously * streamed to - * */ public Multistream withTargets(List targets) { Utils.checkNotNull(targets, "targets"); @@ -67,17 +61,17 @@ public Multistream withTargets(List targets) { return this; } + /** * References to targets where this stream will be simultaneously * streamed to - * */ public Multistream withTargets(Optional> targets) { Utils.checkNotNull(targets, "targets"); this.targets = targets; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -88,12 +82,12 @@ public boolean equals(java.lang.Object o) { } Multistream other = (Multistream) o; return - Objects.deepEquals(this.targets, other.targets); + Utils.enhancedDeepEquals(this.targets, other.targets); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( targets); } @@ -102,19 +96,20 @@ public String toString() { return Utils.toString(Multistream.class, "targets", targets); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional> targets = Optional.empty(); - + + private Optional> targets = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * References to targets where this stream will be simultaneously * streamed to - * */ public Builder targets(List targets) { Utils.checkNotNull(targets, "targets"); @@ -125,18 +120,18 @@ public Builder targets(List targets) { /** * References to targets where this stream will be simultaneously * streamed to - * */ public Builder targets(Optional> targets) { Utils.checkNotNull(targets, "targets"); this.targets = targets; return this; } - + public Multistream build() { + return new Multistream( targets); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/MultistreamTarget.java b/src/main/java/studio/livepeer/livepeer/models/components/MultistreamTarget.java index c9d05288..d99b14d7 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/MultistreamTarget.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/MultistreamTarget.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -15,7 +13,6 @@ import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -26,11 +23,13 @@ public class MultistreamTarget { @JsonProperty("id") private Optional id; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("name") private Optional name; /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -41,7 +40,6 @@ public class MultistreamTarget { /** * If true then this multistream target will not be used for pushing * even if it is configured in a stream object. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("disabled") @@ -50,7 +48,6 @@ public class MultistreamTarget { /** * Timestamp (in milliseconds) at which multistream target object was * created - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("createdAt") @@ -76,7 +73,8 @@ public MultistreamTarget( } public MultistreamTarget() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); } @JsonIgnore @@ -90,6 +88,7 @@ public Optional name() { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -101,7 +100,6 @@ public Optional userId() { /** * If true then this multistream target will not be used for pushing * even if it is configured in a stream object. - * */ @JsonIgnore public Optional disabled() { @@ -111,23 +109,24 @@ public Optional disabled() { /** * Timestamp (in milliseconds) at which multistream target object was * created - * */ @JsonIgnore public Optional createdAt() { return createdAt; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public MultistreamTarget withId(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); return this; } + public MultistreamTarget withId(Optional id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -140,6 +139,7 @@ public MultistreamTarget withName(String name) { return this; } + public MultistreamTarget withName(Optional name) { Utils.checkNotNull(name, "name"); this.name = name; @@ -147,6 +147,7 @@ public MultistreamTarget withName(Optional name) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -156,7 +157,9 @@ public MultistreamTarget withUserId(String userId) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -169,7 +172,6 @@ public MultistreamTarget withUserId(Optional userId) { /** * If true then this multistream target will not be used for pushing * even if it is configured in a stream object. - * */ public MultistreamTarget withDisabled(boolean disabled) { Utils.checkNotNull(disabled, "disabled"); @@ -177,10 +179,10 @@ public MultistreamTarget withDisabled(boolean disabled) { return this; } + /** * If true then this multistream target will not be used for pushing * even if it is configured in a stream object. - * */ public MultistreamTarget withDisabled(Optional disabled) { Utils.checkNotNull(disabled, "disabled"); @@ -191,7 +193,6 @@ public MultistreamTarget withDisabled(Optional disabled) { /** * Timestamp (in milliseconds) at which multistream target object was * created - * */ public MultistreamTarget withCreatedAt(double createdAt) { Utils.checkNotNull(createdAt, "createdAt"); @@ -199,17 +200,17 @@ public MultistreamTarget withCreatedAt(double createdAt) { return this; } + /** * Timestamp (in milliseconds) at which multistream target object was * created - * */ public MultistreamTarget withCreatedAt(Optional createdAt) { Utils.checkNotNull(createdAt, "createdAt"); this.createdAt = createdAt; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -220,21 +221,18 @@ public boolean equals(java.lang.Object o) { } MultistreamTarget other = (MultistreamTarget) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.userId, other.userId) && - Objects.deepEquals(this.disabled, other.disabled) && - Objects.deepEquals(this.createdAt, other.createdAt); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.userId, other.userId) && + Utils.enhancedDeepEquals(this.disabled, other.disabled) && + Utils.enhancedDeepEquals(this.createdAt, other.createdAt); } @Override public int hashCode() { - return Objects.hash( - id, - name, - userId, - disabled, - createdAt); + return Utils.enhancedHash( + id, name, userId, + disabled, createdAt); } @Override @@ -246,24 +244,26 @@ public String toString() { "disabled", disabled, "createdAt", createdAt); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional id = Optional.empty(); - + private Optional name = Optional.empty(); - + @Deprecated private Optional userId = Optional.empty(); - + private Optional disabled = Optional.empty(); - - private Optional createdAt = Optional.empty(); - + + private Optional createdAt = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); @@ -276,6 +276,7 @@ public Builder id(Optional id) { return this; } + public Builder name(String name) { Utils.checkNotNull(name, "name"); this.name = Optional.ofNullable(name); @@ -288,7 +289,9 @@ public Builder name(Optional name) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -299,6 +302,7 @@ public Builder userId(String userId) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -308,10 +312,10 @@ public Builder userId(Optional userId) { return this; } + /** * If true then this multistream target will not be used for pushing * even if it is configured in a stream object. - * */ public Builder disabled(boolean disabled) { Utils.checkNotNull(disabled, "disabled"); @@ -322,7 +326,6 @@ public Builder disabled(boolean disabled) { /** * If true then this multistream target will not be used for pushing * even if it is configured in a stream object. - * */ public Builder disabled(Optional disabled) { Utils.checkNotNull(disabled, "disabled"); @@ -330,10 +333,10 @@ public Builder disabled(Optional disabled) { return this; } + /** * Timestamp (in milliseconds) at which multistream target object was * created - * */ public Builder createdAt(double createdAt) { Utils.checkNotNull(createdAt, "createdAt"); @@ -344,22 +347,19 @@ public Builder createdAt(double createdAt) { /** * Timestamp (in milliseconds) at which multistream target object was * created - * */ public Builder createdAt(Optional createdAt) { Utils.checkNotNull(createdAt, "createdAt"); this.createdAt = createdAt; return this; } - + public MultistreamTarget build() { + return new MultistreamTarget( - id, - name, - userId, - disabled, - createdAt); + id, name, userId, + disabled, createdAt); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/MultistreamTargetInput.java b/src/main/java/studio/livepeer/livepeer/models/components/MultistreamTargetInput.java index 75ca94e6..413e48a1 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/MultistreamTargetInput.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/MultistreamTargetInput.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,7 +11,6 @@ import java.lang.Boolean; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -33,7 +30,6 @@ public class MultistreamTargetInput { /** * If true then this multistream target will not be used for pushing * even if it is configured in a stream object. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("disabled") @@ -73,23 +69,24 @@ public String url() { /** * If true then this multistream target will not be used for pushing * even if it is configured in a stream object. - * */ @JsonIgnore public Optional disabled() { return disabled; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public MultistreamTargetInput withName(String name) { Utils.checkNotNull(name, "name"); this.name = Optional.ofNullable(name); return this; } + public MultistreamTargetInput withName(Optional name) { Utils.checkNotNull(name, "name"); this.name = name; @@ -108,7 +105,6 @@ public MultistreamTargetInput withUrl(String url) { /** * If true then this multistream target will not be used for pushing * even if it is configured in a stream object. - * */ public MultistreamTargetInput withDisabled(boolean disabled) { Utils.checkNotNull(disabled, "disabled"); @@ -116,17 +112,17 @@ public MultistreamTargetInput withDisabled(boolean disabled) { return this; } + /** * If true then this multistream target will not be used for pushing * even if it is configured in a stream object. - * */ public MultistreamTargetInput withDisabled(Optional disabled) { Utils.checkNotNull(disabled, "disabled"); this.disabled = disabled; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -137,17 +133,15 @@ public boolean equals(java.lang.Object o) { } MultistreamTargetInput other = (MultistreamTargetInput) o; return - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.disabled, other.disabled); + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.disabled, other.disabled); } @Override public int hashCode() { - return Objects.hash( - name, - url, - disabled); + return Utils.enhancedHash( + name, url, disabled); } @Override @@ -157,19 +151,21 @@ public String toString() { "url", url, "disabled", disabled); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional name = Optional.empty(); - + private String url; - - private Optional disabled = Optional.empty(); - + + private Optional disabled = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder name(String name) { Utils.checkNotNull(name, "name"); this.name = Optional.ofNullable(name); @@ -182,6 +178,7 @@ public Builder name(Optional name) { return this; } + /** * Livepeer-compatible multistream target URL (RTMP(S) or SRT) */ @@ -191,10 +188,10 @@ public Builder url(String url) { return this; } + /** * If true then this multistream target will not be used for pushing * even if it is configured in a stream object. - * */ public Builder disabled(boolean disabled) { Utils.checkNotNull(disabled, "disabled"); @@ -205,20 +202,18 @@ public Builder disabled(boolean disabled) { /** * If true then this multistream target will not be used for pushing * even if it is configured in a stream object. - * */ public Builder disabled(Optional disabled) { Utils.checkNotNull(disabled, "disabled"); this.disabled = disabled; return this; } - + public MultistreamTargetInput build() { + return new MultistreamTargetInput( - name, - url, - disabled); + name, url, disabled); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/MultistreamTargetPatchPayload.java b/src/main/java/studio/livepeer/livepeer/models/components/MultistreamTargetPatchPayload.java deleted file mode 100644 index aae8dafd..00000000 --- a/src/main/java/studio/livepeer/livepeer/models/components/MultistreamTargetPatchPayload.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -package studio.livepeer.livepeer.models.components; - - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.lang.Boolean; -import java.lang.Override; -import java.lang.String; -import java.util.Objects; -import java.util.Optional; -import studio.livepeer.livepeer.utils.Utils; - - -public class MultistreamTargetPatchPayload { - - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("name") - private Optional name; - - /** - * Livepeer-compatible multistream target URL (RTMP(S) or SRT) - */ - @JsonProperty("url") - private String url; - - /** - * If true then this multistream target will not be used for pushing - * even if it is configured in a stream object. - * - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("disabled") - private Optional disabled; - - @JsonCreator - public MultistreamTargetPatchPayload( - @JsonProperty("name") Optional name, - @JsonProperty("url") String url, - @JsonProperty("disabled") Optional disabled) { - Utils.checkNotNull(name, "name"); - Utils.checkNotNull(url, "url"); - Utils.checkNotNull(disabled, "disabled"); - this.name = name; - this.url = url; - this.disabled = disabled; - } - - public MultistreamTargetPatchPayload( - String url) { - this(Optional.empty(), url, Optional.empty()); - } - - @JsonIgnore - public Optional name() { - return name; - } - - /** - * Livepeer-compatible multistream target URL (RTMP(S) or SRT) - */ - @JsonIgnore - public String url() { - return url; - } - - /** - * If true then this multistream target will not be used for pushing - * even if it is configured in a stream object. - * - */ - @JsonIgnore - public Optional disabled() { - return disabled; - } - - public final static Builder builder() { - return new Builder(); - } - - public MultistreamTargetPatchPayload withName(String name) { - Utils.checkNotNull(name, "name"); - this.name = Optional.ofNullable(name); - return this; - } - - public MultistreamTargetPatchPayload withName(Optional name) { - Utils.checkNotNull(name, "name"); - this.name = name; - return this; - } - - /** - * Livepeer-compatible multistream target URL (RTMP(S) or SRT) - */ - public MultistreamTargetPatchPayload withUrl(String url) { - Utils.checkNotNull(url, "url"); - this.url = url; - return this; - } - - /** - * If true then this multistream target will not be used for pushing - * even if it is configured in a stream object. - * - */ - public MultistreamTargetPatchPayload withDisabled(boolean disabled) { - Utils.checkNotNull(disabled, "disabled"); - this.disabled = Optional.ofNullable(disabled); - return this; - } - - /** - * If true then this multistream target will not be used for pushing - * even if it is configured in a stream object. - * - */ - public MultistreamTargetPatchPayload withDisabled(Optional disabled) { - Utils.checkNotNull(disabled, "disabled"); - this.disabled = disabled; - return this; - } - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MultistreamTargetPatchPayload other = (MultistreamTargetPatchPayload) o; - return - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.disabled, other.disabled); - } - - @Override - public int hashCode() { - return Objects.hash( - name, - url, - disabled); - } - - @Override - public String toString() { - return Utils.toString(MultistreamTargetPatchPayload.class, - "name", name, - "url", url, - "disabled", disabled); - } - - public final static class Builder { - - private Optional name = Optional.empty(); - - private String url; - - private Optional disabled = Optional.empty(); - - private Builder() { - // force use of static builder() method - } - - public Builder name(String name) { - Utils.checkNotNull(name, "name"); - this.name = Optional.ofNullable(name); - return this; - } - - public Builder name(Optional name) { - Utils.checkNotNull(name, "name"); - this.name = name; - return this; - } - - /** - * Livepeer-compatible multistream target URL (RTMP(S) or SRT) - */ - public Builder url(String url) { - Utils.checkNotNull(url, "url"); - this.url = url; - return this; - } - - /** - * If true then this multistream target will not be used for pushing - * even if it is configured in a stream object. - * - */ - public Builder disabled(boolean disabled) { - Utils.checkNotNull(disabled, "disabled"); - this.disabled = Optional.ofNullable(disabled); - return this; - } - - /** - * If true then this multistream target will not be used for pushing - * even if it is configured in a stream object. - * - */ - public Builder disabled(Optional disabled) { - Utils.checkNotNull(disabled, "disabled"); - this.disabled = disabled; - return this; - } - - public MultistreamTargetPatchPayload build() { - return new MultistreamTargetPatchPayload( - name, - url, - disabled); - } - } -} - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Name.java b/src/main/java/studio/livepeer/livepeer/models/components/Name.java index 07074bf1..bf11047f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Name.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Name.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum Name { VERIFIABLE_VIDEO("Verifiable Video"); @@ -13,11 +14,21 @@ public enum Name { @JsonValue private final String value; - private Name(String value) { + Name(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (Name o: Name.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/NewAssetFromUrlPayload.java b/src/main/java/studio/livepeer/livepeer/models/components/NewAssetFromUrlPayload.java index 82877a17..49052af3 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/NewAssetFromUrlPayload.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/NewAssetFromUrlPayload.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -16,17 +14,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; public class NewAssetFromUrlPayload { - /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ @JsonProperty("name") private String name; @@ -45,23 +40,26 @@ public class NewAssetFromUrlPayload { @JsonProperty("playbackPolicy") private JsonNullable playbackPolicy; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("creatorId") private Optional creatorId; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("storage") private Optional storage; /** - * URL where the asset contents can be retrieved, e.g. `https://s3.amazonaws.com/my-bucket/path/filename.mp4`. + * URL where the asset contents can be retrieved, e.g. + * `https://s3.amazonaws.com/my-bucket/path/filename.mp4`. * For an IPFS source, this should be similar to: `ipfs://{CID}`. For an Arweave * source: `ar://{CID}`. - * */ @JsonProperty("url") private String url; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("encryption") private Optional encryption; @@ -73,6 +71,7 @@ public class NewAssetFromUrlPayload { @JsonProperty("c2pa") private Optional c2pa; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("profiles") private JsonNullable> profiles; @@ -121,12 +120,14 @@ public NewAssetFromUrlPayload( public NewAssetFromUrlPayload( String name, String url) { - this(name, Optional.empty(), JsonNullable.undefined(), Optional.empty(), Optional.empty(), url, Optional.empty(), Optional.empty(), JsonNullable.undefined(), Optional.empty()); + this(name, Optional.empty(), JsonNullable.undefined(), + Optional.empty(), Optional.empty(), url, + Optional.empty(), Optional.empty(), JsonNullable.undefined(), + Optional.empty()); } /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ @JsonIgnore public String name() { @@ -163,10 +164,10 @@ public Optional storage() { } /** - * URL where the asset contents can be retrieved, e.g. `https://s3.amazonaws.com/my-bucket/path/filename.mp4`. + * URL where the asset contents can be retrieved, e.g. + * `https://s3.amazonaws.com/my-bucket/path/filename.mp4`. * For an IPFS source, this should be similar to: `ipfs://{CID}`. For an Arweave * source: `ar://{CID}`. - * */ @JsonIgnore public String url() { @@ -201,13 +202,13 @@ public Optional targetSegmentSizeSecs() { return targetSegmentSizeSecs; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ public NewAssetFromUrlPayload withName(String name) { Utils.checkNotNull(name, "name"); @@ -224,6 +225,7 @@ public NewAssetFromUrlPayload withStaticMp4(boolean staticMp4) { return this; } + /** * Whether to generate MP4s for the asset. */ @@ -257,6 +259,7 @@ public NewAssetFromUrlPayload withCreatorId(InputCreatorId creatorId) { return this; } + public NewAssetFromUrlPayload withCreatorId(Optional creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = creatorId; @@ -269,6 +272,7 @@ public NewAssetFromUrlPayload withStorage(Storage storage) { return this; } + public NewAssetFromUrlPayload withStorage(Optional storage) { Utils.checkNotNull(storage, "storage"); this.storage = storage; @@ -276,10 +280,10 @@ public NewAssetFromUrlPayload withStorage(Optional storage) { } /** - * URL where the asset contents can be retrieved, e.g. `https://s3.amazonaws.com/my-bucket/path/filename.mp4`. + * URL where the asset contents can be retrieved, e.g. + * `https://s3.amazonaws.com/my-bucket/path/filename.mp4`. * For an IPFS source, this should be similar to: `ipfs://{CID}`. For an Arweave * source: `ar://{CID}`. - * */ public NewAssetFromUrlPayload withUrl(String url) { Utils.checkNotNull(url, "url"); @@ -293,6 +297,7 @@ public NewAssetFromUrlPayload withEncryption(Encryption encryption) { return this; } + public NewAssetFromUrlPayload withEncryption(Optional encryption) { Utils.checkNotNull(encryption, "encryption"); this.encryption = encryption; @@ -308,6 +313,7 @@ public NewAssetFromUrlPayload withC2pa(boolean c2pa) { return this; } + /** * Decides if the output video should include C2PA signature */ @@ -338,6 +344,7 @@ public NewAssetFromUrlPayload withTargetSegmentSizeSecs(double targetSegmentSize return this; } + /** * How many seconds the duration of each output segment should be */ @@ -346,7 +353,7 @@ public NewAssetFromUrlPayload withTargetSegmentSizeSecs(Optional targetS this.targetSegmentSizeSecs = targetSegmentSizeSecs; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -357,30 +364,24 @@ public boolean equals(java.lang.Object o) { } NewAssetFromUrlPayload other = (NewAssetFromUrlPayload) o; return - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.staticMp4, other.staticMp4) && - Objects.deepEquals(this.playbackPolicy, other.playbackPolicy) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.storage, other.storage) && - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.encryption, other.encryption) && - Objects.deepEquals(this.c2pa, other.c2pa) && - Objects.deepEquals(this.profiles, other.profiles) && - Objects.deepEquals(this.targetSegmentSizeSecs, other.targetSegmentSizeSecs); + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.staticMp4, other.staticMp4) && + Utils.enhancedDeepEquals(this.playbackPolicy, other.playbackPolicy) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.storage, other.storage) && + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.encryption, other.encryption) && + Utils.enhancedDeepEquals(this.c2pa, other.c2pa) && + Utils.enhancedDeepEquals(this.profiles, other.profiles) && + Utils.enhancedDeepEquals(this.targetSegmentSizeSecs, other.targetSegmentSizeSecs); } @Override public int hashCode() { - return Objects.hash( - name, - staticMp4, - playbackPolicy, - creatorId, - storage, - url, - encryption, - c2pa, - profiles, + return Utils.enhancedHash( + name, staticMp4, playbackPolicy, + creatorId, storage, url, + encryption, c2pa, profiles, targetSegmentSizeSecs); } @@ -398,36 +399,37 @@ public String toString() { "profiles", profiles, "targetSegmentSizeSecs", targetSegmentSizeSecs); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String name; - + private Optional staticMp4 = Optional.empty(); - + private JsonNullable playbackPolicy = JsonNullable.undefined(); - + private Optional creatorId = Optional.empty(); - + private Optional storage = Optional.empty(); - + private String url; - + private Optional encryption = Optional.empty(); - + private Optional c2pa = Optional.empty(); - + private JsonNullable> profiles = JsonNullable.undefined(); - - private Optional targetSegmentSizeSecs = Optional.empty(); - + + private Optional targetSegmentSizeSecs = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ public Builder name(String name) { Utils.checkNotNull(name, "name"); @@ -435,6 +437,7 @@ public Builder name(String name) { return this; } + /** * Whether to generate MP4s for the asset. */ @@ -453,6 +456,7 @@ public Builder staticMp4(Optional staticMp4) { return this; } + /** * Whether the playback policy for an asset or stream is public or signed */ @@ -471,6 +475,7 @@ public Builder playbackPolicy(JsonNullable playbackPol return this; } + public Builder creatorId(InputCreatorId creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = Optional.ofNullable(creatorId); @@ -483,6 +488,7 @@ public Builder creatorId(Optional creatorId) { return this; } + public Builder storage(Storage storage) { Utils.checkNotNull(storage, "storage"); this.storage = Optional.ofNullable(storage); @@ -495,11 +501,12 @@ public Builder storage(Optional storage) { return this; } + /** - * URL where the asset contents can be retrieved, e.g. `https://s3.amazonaws.com/my-bucket/path/filename.mp4`. + * URL where the asset contents can be retrieved, e.g. + * `https://s3.amazonaws.com/my-bucket/path/filename.mp4`. * For an IPFS source, this should be similar to: `ipfs://{CID}`. For an Arweave * source: `ar://{CID}`. - * */ public Builder url(String url) { Utils.checkNotNull(url, "url"); @@ -507,6 +514,7 @@ public Builder url(String url) { return this; } + public Builder encryption(Encryption encryption) { Utils.checkNotNull(encryption, "encryption"); this.encryption = Optional.ofNullable(encryption); @@ -519,6 +527,7 @@ public Builder encryption(Optional encryption) { return this; } + /** * Decides if the output video should include C2PA signature */ @@ -537,6 +546,7 @@ public Builder c2pa(Optional c2pa) { return this; } + public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = JsonNullable.of(profiles); @@ -549,6 +559,7 @@ public Builder profiles(JsonNullable> profiles) return this; } + /** * How many seconds the duration of each output segment should be */ @@ -566,20 +577,15 @@ public Builder targetSegmentSizeSecs(Optional targetSegmentSizeSecs) { this.targetSegmentSizeSecs = targetSegmentSizeSecs; return this; } - + public NewAssetFromUrlPayload build() { + return new NewAssetFromUrlPayload( - name, - staticMp4, - playbackPolicy, - creatorId, - storage, - url, - encryption, - c2pa, - profiles, + name, staticMp4, playbackPolicy, + creatorId, storage, url, + encryption, c2pa, profiles, targetSegmentSizeSecs); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayload.java b/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayload.java index 85d515c4..ec58e94a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayload.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayload.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -16,17 +14,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; public class NewAssetPayload { - /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ @JsonProperty("name") private String name; @@ -45,14 +40,17 @@ public class NewAssetPayload { @JsonProperty("playbackPolicy") private JsonNullable playbackPolicy; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("creatorId") private Optional creatorId; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("storage") private Optional storage; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("encryption") private Optional encryption; @@ -64,6 +62,7 @@ public class NewAssetPayload { @JsonProperty("c2pa") private Optional c2pa; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("profiles") private JsonNullable> profiles; @@ -108,12 +107,13 @@ public NewAssetPayload( public NewAssetPayload( String name) { - this(name, Optional.empty(), JsonNullable.undefined(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), JsonNullable.undefined(), Optional.empty()); + this(name, Optional.empty(), JsonNullable.undefined(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), JsonNullable.undefined(), Optional.empty()); } /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ @JsonIgnore public String name() { @@ -177,13 +177,13 @@ public Optional targetSegmentSizeSecs() { return targetSegmentSizeSecs; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ public NewAssetPayload withName(String name) { Utils.checkNotNull(name, "name"); @@ -200,6 +200,7 @@ public NewAssetPayload withStaticMp4(boolean staticMp4) { return this; } + /** * Whether to generate MP4s for the asset. */ @@ -233,6 +234,7 @@ public NewAssetPayload withCreatorId(InputCreatorId creatorId) { return this; } + public NewAssetPayload withCreatorId(Optional creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = creatorId; @@ -245,6 +247,7 @@ public NewAssetPayload withStorage(NewAssetPayloadStorage storage) { return this; } + public NewAssetPayload withStorage(Optional storage) { Utils.checkNotNull(storage, "storage"); this.storage = storage; @@ -257,6 +260,7 @@ public NewAssetPayload withEncryption(NewAssetPayloadEncryption encryption) { return this; } + public NewAssetPayload withEncryption(Optional encryption) { Utils.checkNotNull(encryption, "encryption"); this.encryption = encryption; @@ -272,6 +276,7 @@ public NewAssetPayload withC2pa(boolean c2pa) { return this; } + /** * Decides if the output video should include C2PA signature */ @@ -302,6 +307,7 @@ public NewAssetPayload withTargetSegmentSizeSecs(double targetSegmentSizeSecs) { return this; } + /** * How many seconds the duration of each output segment should be */ @@ -310,7 +316,7 @@ public NewAssetPayload withTargetSegmentSizeSecs(Optional targetSegmentS this.targetSegmentSizeSecs = targetSegmentSizeSecs; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -321,29 +327,23 @@ public boolean equals(java.lang.Object o) { } NewAssetPayload other = (NewAssetPayload) o; return - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.staticMp4, other.staticMp4) && - Objects.deepEquals(this.playbackPolicy, other.playbackPolicy) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.storage, other.storage) && - Objects.deepEquals(this.encryption, other.encryption) && - Objects.deepEquals(this.c2pa, other.c2pa) && - Objects.deepEquals(this.profiles, other.profiles) && - Objects.deepEquals(this.targetSegmentSizeSecs, other.targetSegmentSizeSecs); + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.staticMp4, other.staticMp4) && + Utils.enhancedDeepEquals(this.playbackPolicy, other.playbackPolicy) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.storage, other.storage) && + Utils.enhancedDeepEquals(this.encryption, other.encryption) && + Utils.enhancedDeepEquals(this.c2pa, other.c2pa) && + Utils.enhancedDeepEquals(this.profiles, other.profiles) && + Utils.enhancedDeepEquals(this.targetSegmentSizeSecs, other.targetSegmentSizeSecs); } @Override public int hashCode() { - return Objects.hash( - name, - staticMp4, - playbackPolicy, - creatorId, - storage, - encryption, - c2pa, - profiles, - targetSegmentSizeSecs); + return Utils.enhancedHash( + name, staticMp4, playbackPolicy, + creatorId, storage, encryption, + c2pa, profiles, targetSegmentSizeSecs); } @Override @@ -359,34 +359,35 @@ public String toString() { "profiles", profiles, "targetSegmentSizeSecs", targetSegmentSizeSecs); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String name; - + private Optional staticMp4 = Optional.empty(); - + private JsonNullable playbackPolicy = JsonNullable.undefined(); - + private Optional creatorId = Optional.empty(); - + private Optional storage = Optional.empty(); - + private Optional encryption = Optional.empty(); - + private Optional c2pa = Optional.empty(); - + private JsonNullable> profiles = JsonNullable.undefined(); - - private Optional targetSegmentSizeSecs = Optional.empty(); - + + private Optional targetSegmentSizeSecs = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. - * */ public Builder name(String name) { Utils.checkNotNull(name, "name"); @@ -394,6 +395,7 @@ public Builder name(String name) { return this; } + /** * Whether to generate MP4s for the asset. */ @@ -412,6 +414,7 @@ public Builder staticMp4(Optional staticMp4) { return this; } + /** * Whether the playback policy for an asset or stream is public or signed */ @@ -430,6 +433,7 @@ public Builder playbackPolicy(JsonNullable playbackPol return this; } + public Builder creatorId(InputCreatorId creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = Optional.ofNullable(creatorId); @@ -442,6 +446,7 @@ public Builder creatorId(Optional creatorId) { return this; } + public Builder storage(NewAssetPayloadStorage storage) { Utils.checkNotNull(storage, "storage"); this.storage = Optional.ofNullable(storage); @@ -454,6 +459,7 @@ public Builder storage(Optional storage) { return this; } + public Builder encryption(NewAssetPayloadEncryption encryption) { Utils.checkNotNull(encryption, "encryption"); this.encryption = Optional.ofNullable(encryption); @@ -466,6 +472,7 @@ public Builder encryption(Optional encrypti return this; } + /** * Decides if the output video should include C2PA signature */ @@ -484,6 +491,7 @@ public Builder c2pa(Optional c2pa) { return this; } + public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = JsonNullable.of(profiles); @@ -496,6 +504,7 @@ public Builder profiles(JsonNullable> profiles) return this; } + /** * How many seconds the duration of each output segment should be */ @@ -513,19 +522,14 @@ public Builder targetSegmentSizeSecs(Optional targetSegmentSizeSecs) { this.targetSegmentSizeSecs = targetSegmentSizeSecs; return this; } - + public NewAssetPayload build() { + return new NewAssetPayload( - name, - staticMp4, - playbackPolicy, - creatorId, - storage, - encryption, - c2pa, - profiles, - targetSegmentSizeSecs); + name, staticMp4, playbackPolicy, + creatorId, storage, encryption, + c2pa, profiles, targetSegmentSizeSecs); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadEncryption.java b/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadEncryption.java index bab8b92f..9a5e65ef 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadEncryption.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadEncryption.java @@ -1,23 +1,20 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; public class NewAssetPayloadEncryption { - /** - * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be retrieved back. + * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be + * retrieved back. */ @JsonProperty("encryptedKey") private String encryptedKey; @@ -30,26 +27,29 @@ public NewAssetPayloadEncryption( } /** - * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be retrieved back. + * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be + * retrieved back. */ @JsonIgnore public String encryptedKey() { return encryptedKey; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** - * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be retrieved back. + * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be + * retrieved back. */ public NewAssetPayloadEncryption withEncryptedKey(String encryptedKey) { Utils.checkNotNull(encryptedKey, "encryptedKey"); this.encryptedKey = encryptedKey; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +60,12 @@ public boolean equals(java.lang.Object o) { } NewAssetPayloadEncryption other = (NewAssetPayloadEncryption) o; return - Objects.deepEquals(this.encryptedKey, other.encryptedKey); + Utils.enhancedDeepEquals(this.encryptedKey, other.encryptedKey); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( encryptedKey); } @@ -74,28 +74,32 @@ public String toString() { return Utils.toString(NewAssetPayloadEncryption.class, "encryptedKey", encryptedKey); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String encryptedKey; - + + private String encryptedKey; + private Builder() { // force use of static builder() method } + /** - * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be retrieved back. + * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be + * retrieved back. */ public Builder encryptedKey(String encryptedKey) { Utils.checkNotNull(encryptedKey, "encryptedKey"); this.encryptedKey = encryptedKey; return this; } - + public NewAssetPayloadEncryption build() { + return new NewAssetPayloadEncryption( encryptedKey); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadIpfs.java b/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadIpfs.java index b9c58e10..03ceb779 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadIpfs.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadIpfs.java @@ -1,17 +1,15 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Boolean; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; @@ -19,12 +17,12 @@ import studio.livepeer.livepeer.utils.Utils; /** - * NewAssetPayloadIpfs - Set to true to make default export to IPFS. To customize the + * NewAssetPayloadIpfs + * + *

Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ - @JsonDeserialize(using = NewAssetPayloadIpfs._Deserializer.class) public class NewAssetPayloadIpfs { @@ -76,12 +74,12 @@ public boolean equals(java.lang.Object o) { return false; } NewAssetPayloadIpfs other = (NewAssetPayloadIpfs) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -89,8 +87,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -101,3 +99,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadIpfs1.java b/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadIpfs1.java index 797e6c2a..1fe13dd9 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadIpfs1.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadIpfs1.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,7 +11,6 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; @@ -41,10 +38,11 @@ public JsonNullable spec() { return (JsonNullable) spec; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public NewAssetPayloadIpfs1 withSpec(Spec spec) { Utils.checkNotNull(spec, "spec"); this.spec = JsonNullable.of(spec); @@ -56,7 +54,7 @@ public NewAssetPayloadIpfs1 withSpec(JsonNullable spec) { this.spec = spec; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -67,12 +65,12 @@ public boolean equals(java.lang.Object o) { } NewAssetPayloadIpfs1 other = (NewAssetPayloadIpfs1) o; return - Objects.deepEquals(this.spec, other.spec); + Utils.enhancedDeepEquals(this.spec, other.spec); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( spec); } @@ -81,15 +79,17 @@ public String toString() { return Utils.toString(NewAssetPayloadIpfs1.class, "spec", spec); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private JsonNullable spec = JsonNullable.undefined(); - + + private JsonNullable spec = JsonNullable.undefined(); + private Builder() { // force use of static builder() method } + public Builder spec(Spec spec) { Utils.checkNotNull(spec, "spec"); this.spec = JsonNullable.of(spec); @@ -101,11 +101,12 @@ public Builder spec(JsonNullable spec) { this.spec = spec; return this; } - + public NewAssetPayloadIpfs1 build() { + return new NewAssetPayloadIpfs1( spec); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadStorage.java b/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadStorage.java index 2bace348..e7c46e9b 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadStorage.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/NewAssetPayloadStorage.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,18 +11,15 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; public class NewAssetPayloadStorage { - /** * Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("ipfs") @@ -45,7 +40,6 @@ public NewAssetPayloadStorage() { * Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -53,15 +47,15 @@ public JsonNullable ipfs() { return (JsonNullable) ipfs; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ public NewAssetPayloadStorage withIpfs(NewAssetPayloadIpfs ipfs) { Utils.checkNotNull(ipfs, "ipfs"); @@ -73,14 +67,13 @@ public NewAssetPayloadStorage withIpfs(NewAssetPayloadIpfs ipfs) { * Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ public NewAssetPayloadStorage withIpfs(JsonNullable ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = ipfs; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -91,12 +84,12 @@ public boolean equals(java.lang.Object o) { } NewAssetPayloadStorage other = (NewAssetPayloadStorage) o; return - Objects.deepEquals(this.ipfs, other.ipfs); + Utils.enhancedDeepEquals(this.ipfs, other.ipfs); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( ipfs); } @@ -105,20 +98,21 @@ public String toString() { return Utils.toString(NewAssetPayloadStorage.class, "ipfs", ipfs); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private JsonNullable ipfs = JsonNullable.undefined(); - + + private JsonNullable ipfs = JsonNullable.undefined(); + private Builder() { // force use of static builder() method } + /** * Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ public Builder ipfs(NewAssetPayloadIpfs ipfs) { Utils.checkNotNull(ipfs, "ipfs"); @@ -130,18 +124,18 @@ public Builder ipfs(NewAssetPayloadIpfs ipfs) { * Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ public Builder ipfs(JsonNullable ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = ipfs; return this; } - + public NewAssetPayloadStorage build() { + return new NewAssetPayloadStorage( ipfs); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/NewStreamPayload.java b/src/main/java/studio/livepeer/livepeer/models/components/NewStreamPayload.java index ac9be87c..7af5fb58 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/NewStreamPayload.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/NewStreamPayload.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -16,7 +14,6 @@ import java.lang.SuppressWarnings; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; @@ -36,6 +33,7 @@ public class NewStreamPayload { @JsonProperty("pull") private Optional pull; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("creatorId") private Optional creatorId; @@ -47,6 +45,7 @@ public class NewStreamPayload { @JsonProperty("playbackPolicy") private JsonNullable playbackPolicy; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("profiles") private JsonNullable> profiles; @@ -54,16 +53,17 @@ public class NewStreamPayload { /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("record") private Optional record; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("recordingSpec") private Optional recordingSpec; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("multistream") private Optional multistream; @@ -108,7 +108,9 @@ public NewStreamPayload( public NewStreamPayload( String name) { - this(name, Optional.empty(), Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(name, Optional.empty(), Optional.empty(), + JsonNullable.undefined(), JsonNullable.undefined(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty()); } @JsonIgnore @@ -151,7 +153,6 @@ public JsonNullable> profiles() { /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ @JsonIgnore public Optional record() { @@ -179,10 +180,11 @@ public Optional> userTags() { return (Optional>) userTags; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public NewStreamPayload withName(String name) { Utils.checkNotNull(name, "name"); this.name = name; @@ -200,6 +202,7 @@ public NewStreamPayload withPull(Pull pull) { return this; } + /** * Configuration for a stream that should be actively pulled from an * external source, rather than pushed to Livepeer. If specified, the @@ -217,6 +220,7 @@ public NewStreamPayload withCreatorId(InputCreatorId creatorId) { return this; } + public NewStreamPayload withCreatorId(Optional creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = creatorId; @@ -256,7 +260,6 @@ public NewStreamPayload withProfiles(JsonNullable> /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ public NewStreamPayload withRecord(boolean record) { Utils.checkNotNull(record, "record"); @@ -264,10 +267,10 @@ public NewStreamPayload withRecord(boolean record) { return this; } + /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ public NewStreamPayload withRecord(Optional record) { Utils.checkNotNull(record, "record"); @@ -281,6 +284,7 @@ public NewStreamPayload withRecordingSpec(NewStreamPayloadRecordingSpec recordin return this; } + public NewStreamPayload withRecordingSpec(Optional recordingSpec) { Utils.checkNotNull(recordingSpec, "recordingSpec"); this.recordingSpec = recordingSpec; @@ -293,6 +297,7 @@ public NewStreamPayload withMultistream(Multistream multistream) { return this; } + public NewStreamPayload withMultistream(Optional multistream) { Utils.checkNotNull(multistream, "multistream"); this.multistream = multistream; @@ -308,6 +313,7 @@ public NewStreamPayload withUserTags(Map userTags) { return this; } + /** * User input tags associated with the stream */ @@ -316,7 +322,7 @@ public NewStreamPayload withUserTags(Optional> u this.userTags = userTags; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -327,29 +333,23 @@ public boolean equals(java.lang.Object o) { } NewStreamPayload other = (NewStreamPayload) o; return - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.pull, other.pull) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.playbackPolicy, other.playbackPolicy) && - Objects.deepEquals(this.profiles, other.profiles) && - Objects.deepEquals(this.record, other.record) && - Objects.deepEquals(this.recordingSpec, other.recordingSpec) && - Objects.deepEquals(this.multistream, other.multistream) && - Objects.deepEquals(this.userTags, other.userTags); + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.pull, other.pull) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.playbackPolicy, other.playbackPolicy) && + Utils.enhancedDeepEquals(this.profiles, other.profiles) && + Utils.enhancedDeepEquals(this.record, other.record) && + Utils.enhancedDeepEquals(this.recordingSpec, other.recordingSpec) && + Utils.enhancedDeepEquals(this.multistream, other.multistream) && + Utils.enhancedDeepEquals(this.userTags, other.userTags); } @Override public int hashCode() { - return Objects.hash( - name, - pull, - creatorId, - playbackPolicy, - profiles, - record, - recordingSpec, - multistream, - userTags); + return Utils.enhancedHash( + name, pull, creatorId, + playbackPolicy, profiles, record, + recordingSpec, multistream, userTags); } @Override @@ -365,37 +365,40 @@ public String toString() { "multistream", multistream, "userTags", userTags); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String name; - + private Optional pull = Optional.empty(); - + private Optional creatorId = Optional.empty(); - + private JsonNullable playbackPolicy = JsonNullable.undefined(); - + private JsonNullable> profiles = JsonNullable.undefined(); - + private Optional record = Optional.empty(); - + private Optional recordingSpec = Optional.empty(); - + private Optional multistream = Optional.empty(); - - private Optional> userTags = Optional.empty(); - + + private Optional> userTags = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder name(String name) { Utils.checkNotNull(name, "name"); this.name = name; return this; } + /** * Configuration for a stream that should be actively pulled from an * external source, rather than pushed to Livepeer. If specified, the @@ -418,6 +421,7 @@ public Builder pull(Optional pull) { return this; } + public Builder creatorId(InputCreatorId creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = Optional.ofNullable(creatorId); @@ -430,6 +434,7 @@ public Builder creatorId(Optional creatorId) { return this; } + /** * Whether the playback policy for an asset or stream is public or signed */ @@ -448,6 +453,7 @@ public Builder playbackPolicy(JsonNullable playbackPol return this; } + public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = JsonNullable.of(profiles); @@ -460,10 +466,10 @@ public Builder profiles(JsonNullable> profiles) { return this; } + /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ public Builder record(boolean record) { Utils.checkNotNull(record, "record"); @@ -474,7 +480,6 @@ public Builder record(boolean record) { /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ public Builder record(Optional record) { Utils.checkNotNull(record, "record"); @@ -482,6 +487,7 @@ public Builder record(Optional record) { return this; } + public Builder recordingSpec(NewStreamPayloadRecordingSpec recordingSpec) { Utils.checkNotNull(recordingSpec, "recordingSpec"); this.recordingSpec = Optional.ofNullable(recordingSpec); @@ -494,6 +500,7 @@ public Builder recordingSpec(Optional r return this; } + public Builder multistream(Multistream multistream) { Utils.checkNotNull(multistream, "multistream"); this.multistream = Optional.ofNullable(multistream); @@ -506,6 +513,7 @@ public Builder multistream(Optional multistream) { return this; } + /** * User input tags associated with the stream */ @@ -523,19 +531,14 @@ public Builder userTags(Optional> userTags) { this.userTags = userTags; return this; } - + public NewStreamPayload build() { + return new NewStreamPayload( - name, - pull, - creatorId, - playbackPolicy, - profiles, - record, - recordingSpec, - multistream, - userTags); + name, pull, creatorId, + playbackPolicy, profiles, record, + recordingSpec, multistream, userTags); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/NewStreamPayloadRecordingSpec.java b/src/main/java/studio/livepeer/livepeer/models/components/NewStreamPayloadRecordingSpec.java index e734fa2f..e5f792b5 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/NewStreamPayloadRecordingSpec.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/NewStreamPayloadRecordingSpec.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,7 +12,6 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; @@ -42,10 +39,11 @@ public JsonNullable> profiles() { return (JsonNullable>) profiles; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public NewStreamPayloadRecordingSpec withProfiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = JsonNullable.of(profiles); @@ -57,7 +55,7 @@ public NewStreamPayloadRecordingSpec withProfiles(JsonNullable> profiles = JsonNullable.undefined(); - + + private JsonNullable> profiles = JsonNullable.undefined(); + private Builder() { // force use of static builder() method } + public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = JsonNullable.of(profiles); @@ -102,11 +102,12 @@ public Builder profiles(JsonNullable> profiles) this.profiles = profiles; return this; } - + public NewStreamPayloadRecordingSpec build() { + return new NewStreamPayloadRecordingSpec( profiles); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/NftMetadata.java b/src/main/java/studio/livepeer/livepeer/models/components/NftMetadata.java index 313d3076..9faf790e 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/NftMetadata.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/NftMetadata.java @@ -1,35 +1,30 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * NftMetadata - Additional data to add to the NFT metadata exported to + * NftMetadata + * + *

Additional data to add to the NFT metadata exported to * IPFS. Will be deep merged with the default metadata * exported. - * */ - public class NftMetadata { - @JsonCreator public NftMetadata() { - - } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } - + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -43,7 +38,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( ); } @@ -51,17 +46,19 @@ public int hashCode() { public String toString() { return Utils.toString(NftMetadata.class); } - - public final static class Builder { - + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + private Builder() { // force use of static builder() method } - + public NftMetadata build() { + return new NftMetadata( ); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/NftMetadataTemplate.java b/src/main/java/studio/livepeer/livepeer/models/components/NftMetadataTemplate.java index b3c33845..509e0b18 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/NftMetadataTemplate.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/NftMetadataTemplate.java @@ -1,17 +1,19 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * NftMetadataTemplate - Name of the NFT metadata template to export. 'player' + * NftMetadataTemplate + * + *

Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ public enum NftMetadataTemplate { FILE("file"), @@ -20,11 +22,21 @@ public enum NftMetadataTemplate { @JsonValue private final String value; - private NftMetadataTemplate(String value) { + NftMetadataTemplate(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (NftMetadataTemplate o: NftMetadataTemplate.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/One.java b/src/main/java/studio/livepeer/livepeer/models/components/One.java index dc7aa07f..b5ce2702 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/One.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/One.java @@ -1,13 +1,16 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; /** - * One - 0: not mobile, 1: mobile screen share, 2: mobile camera. + * One + * + *

0: not mobile, 1: mobile screen share, 2: mobile camera. */ public enum One { ZERO(0L), @@ -17,11 +20,21 @@ public enum One { @JsonValue private final long value; - private One(long value) { + One(long value) { this.value = value; } public long value() { return value; } + + public static Optional fromValue(long value) { + for (One o: One.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Output.java b/src/main/java/studio/livepeer/livepeer/models/components/Output.java index 170848ed..ea9fe8ea 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Output.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Output.java @@ -1,36 +1,31 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import java.lang.Object; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Map; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * Output - Output of the task + * Output + * + *

Output of the task */ - public class Output { - /** * Output of the upload task */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("upload") - private Optional> upload; + private Optional upload; /** * Output of the export task @@ -48,7 +43,7 @@ public class Output { @JsonCreator public Output( - @JsonProperty("upload") Optional> upload, + @JsonProperty("upload") Optional upload, @JsonProperty("export") Optional export, @JsonProperty("exportData") Optional exportData) { Utils.checkNotNull(upload, "upload"); @@ -68,8 +63,8 @@ public Output() { */ @SuppressWarnings("unchecked") @JsonIgnore - public Optional> upload() { - return (Optional>) upload; + public Optional upload() { + return (Optional) upload; } /** @@ -90,23 +85,25 @@ public Optional exportData() { return (Optional) exportData; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Output of the upload task */ - public Output withUpload(Map upload) { + public Output withUpload(TaskUpload upload) { Utils.checkNotNull(upload, "upload"); this.upload = Optional.ofNullable(upload); return this; } + /** * Output of the upload task */ - public Output withUpload(Optional> upload) { + public Output withUpload(Optional upload) { Utils.checkNotNull(upload, "upload"); this.upload = upload; return this; @@ -121,6 +118,7 @@ public Output withExport(Export export) { return this; } + /** * Output of the export task */ @@ -139,6 +137,7 @@ public Output withExportData(ExportData exportData) { return this; } + /** * Output of the export data task */ @@ -147,7 +146,7 @@ public Output withExportData(Optional exportData) { this.exportData = exportData; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -158,17 +157,15 @@ public boolean equals(java.lang.Object o) { } Output other = (Output) o; return - Objects.deepEquals(this.upload, other.upload) && - Objects.deepEquals(this.export, other.export) && - Objects.deepEquals(this.exportData, other.exportData); + Utils.enhancedDeepEquals(this.upload, other.upload) && + Utils.enhancedDeepEquals(this.export, other.export) && + Utils.enhancedDeepEquals(this.exportData, other.exportData); } @Override public int hashCode() { - return Objects.hash( - upload, - export, - exportData); + return Utils.enhancedHash( + upload, export, exportData); } @Override @@ -178,23 +175,25 @@ public String toString() { "export", export, "exportData", exportData); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional> upload = Optional.empty(); - + + private Optional upload = Optional.empty(); + private Optional export = Optional.empty(); - - private Optional exportData = Optional.empty(); - + + private Optional exportData = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Output of the upload task */ - public Builder upload(Map upload) { + public Builder upload(TaskUpload upload) { Utils.checkNotNull(upload, "upload"); this.upload = Optional.ofNullable(upload); return this; @@ -203,12 +202,13 @@ public Builder upload(Map upload) { /** * Output of the upload task */ - public Builder upload(Optional> upload) { + public Builder upload(Optional upload) { Utils.checkNotNull(upload, "upload"); this.upload = upload; return this; } + /** * Output of the export task */ @@ -227,6 +227,7 @@ public Builder export(Optional export) { return this; } + /** * Output of the export data task */ @@ -244,13 +245,12 @@ public Builder exportData(Optional exportData) { this.exportData = exportData; return this; } - + public Output build() { + return new Output( - upload, - export, - exportData); + upload, export, exportData); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Outputs.java b/src/main/java/studio/livepeer/livepeer/models/components/Outputs.java index 9007ee19..2767c167 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Outputs.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Outputs.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,16 +11,15 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * Outputs - Output formats + * Outputs + * + *

Output formats */ - public class Outputs { - /** * HLS output format */ @@ -88,10 +85,11 @@ public Optional fmp4() { return (Optional) fmp4; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HLS output format */ @@ -101,6 +99,7 @@ public Outputs withHls(Hls hls) { return this; } + /** * HLS output format */ @@ -119,6 +118,7 @@ public Outputs withMp4(Mp4 mp4) { return this; } + /** * MP4 output format */ @@ -137,6 +137,7 @@ public Outputs withFmp4(Fmp4 fmp4) { return this; } + /** * FMP4 output format */ @@ -145,7 +146,7 @@ public Outputs withFmp4(Optional fmp4) { this.fmp4 = fmp4; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -156,17 +157,15 @@ public boolean equals(java.lang.Object o) { } Outputs other = (Outputs) o; return - Objects.deepEquals(this.hls, other.hls) && - Objects.deepEquals(this.mp4, other.mp4) && - Objects.deepEquals(this.fmp4, other.fmp4); + Utils.enhancedDeepEquals(this.hls, other.hls) && + Utils.enhancedDeepEquals(this.mp4, other.mp4) && + Utils.enhancedDeepEquals(this.fmp4, other.fmp4); } @Override public int hashCode() { - return Objects.hash( - hls, - mp4, - fmp4); + return Utils.enhancedHash( + hls, mp4, fmp4); } @Override @@ -176,19 +175,21 @@ public String toString() { "mp4", mp4, "fmp4", fmp4); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional hls = Optional.empty(); - + private Optional mp4 = Optional.empty(); - - private Optional fmp4 = Optional.empty(); - + + private Optional fmp4 = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HLS output format */ @@ -207,6 +208,7 @@ public Builder hls(Optional hls) { return this; } + /** * MP4 output format */ @@ -225,6 +227,7 @@ public Builder mp4(Optional mp4) { return this; } + /** * FMP4 output format */ @@ -242,13 +245,12 @@ public Builder fmp4(Optional fmp4) { this.fmp4 = fmp4; return this; } - + public Outputs build() { + return new Outputs( - hls, - mp4, - fmp4); + hls, mp4, fmp4); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Params.java b/src/main/java/studio/livepeer/livepeer/models/components/Params.java index 6a2b323c..a19d5197 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Params.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Params.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,16 +11,15 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * Params - Parameters of the task + * Params + * + *

Parameters of the task */ - public class Params { - /** * Parameters for the upload task */ @@ -51,6 +48,7 @@ public class Params { @JsonProperty("transcode-file") private Optional transcodeFile; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("clip") private Optional clip; @@ -75,7 +73,8 @@ public Params( } public Params() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); } /** @@ -120,10 +119,11 @@ public Optional clip() { return (Optional) clip; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Parameters for the upload task */ @@ -133,6 +133,7 @@ public Params withUpload(Upload upload) { return this; } + /** * Parameters for the upload task */ @@ -151,6 +152,7 @@ public Params withExport(ExportTaskParams export) { return this; } + /** * Parameters for the export task */ @@ -169,6 +171,7 @@ public Params withExportData(TaskExportData exportData) { return this; } + /** * Parameters for the export-data task */ @@ -187,6 +190,7 @@ public Params withTranscodeFile(TranscodeFile transcodeFile) { return this; } + /** * Parameters for the transcode-file task */ @@ -202,12 +206,13 @@ public Params withClip(Clip clip) { return this; } + public Params withClip(Optional clip) { Utils.checkNotNull(clip, "clip"); this.clip = clip; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -218,21 +223,18 @@ public boolean equals(java.lang.Object o) { } Params other = (Params) o; return - Objects.deepEquals(this.upload, other.upload) && - Objects.deepEquals(this.export, other.export) && - Objects.deepEquals(this.exportData, other.exportData) && - Objects.deepEquals(this.transcodeFile, other.transcodeFile) && - Objects.deepEquals(this.clip, other.clip); + Utils.enhancedDeepEquals(this.upload, other.upload) && + Utils.enhancedDeepEquals(this.export, other.export) && + Utils.enhancedDeepEquals(this.exportData, other.exportData) && + Utils.enhancedDeepEquals(this.transcodeFile, other.transcodeFile) && + Utils.enhancedDeepEquals(this.clip, other.clip); } @Override public int hashCode() { - return Objects.hash( - upload, - export, - exportData, - transcodeFile, - clip); + return Utils.enhancedHash( + upload, export, exportData, + transcodeFile, clip); } @Override @@ -244,23 +246,25 @@ public String toString() { "transcodeFile", transcodeFile, "clip", clip); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional upload = Optional.empty(); - + private Optional export = Optional.empty(); - + private Optional exportData = Optional.empty(); - + private Optional transcodeFile = Optional.empty(); - - private Optional clip = Optional.empty(); - + + private Optional clip = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Parameters for the upload task */ @@ -279,6 +283,7 @@ public Builder upload(Optional upload) { return this; } + /** * Parameters for the export task */ @@ -297,6 +302,7 @@ public Builder export(Optional export) { return this; } + /** * Parameters for the export-data task */ @@ -315,6 +321,7 @@ public Builder exportData(Optional exportData) { return this; } + /** * Parameters for the transcode-file task */ @@ -333,6 +340,7 @@ public Builder transcodeFile(Optional transcodeFile) { return this; } + public Builder clip(Clip clip) { Utils.checkNotNull(clip, "clip"); this.clip = Optional.ofNullable(clip); @@ -344,15 +352,13 @@ public Builder clip(Optional clip) { this.clip = clip; return this; } - + public Params build() { + return new Params( - upload, - export, - exportData, - transcodeFile, - clip); + upload, export, exportData, + transcodeFile, clip); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Participants.java b/src/main/java/studio/livepeer/livepeer/models/components/Participants.java index e00267f7..34d804ca 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Participants.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Participants.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,13 +11,11 @@ import java.lang.Long; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class Participants { - /** * participant ID */ @@ -65,7 +61,8 @@ public Participants( } public Participants() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -100,10 +97,11 @@ public Optional leftAt() { return leftAt; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * participant ID */ @@ -113,6 +111,7 @@ public Participants withIdentity(String identity) { return this; } + /** * participant ID */ @@ -131,6 +130,7 @@ public Participants withName(String name) { return this; } + /** * user defined participant name */ @@ -149,6 +149,7 @@ public Participants withJoinedAt(long joinedAt) { return this; } + /** * the time the participant joined */ @@ -167,6 +168,7 @@ public Participants withLeftAt(long leftAt) { return this; } + /** * the time the participant left */ @@ -175,7 +177,7 @@ public Participants withLeftAt(Optional leftAt) { this.leftAt = leftAt; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -186,18 +188,16 @@ public boolean equals(java.lang.Object o) { } Participants other = (Participants) o; return - Objects.deepEquals(this.identity, other.identity) && - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.joinedAt, other.joinedAt) && - Objects.deepEquals(this.leftAt, other.leftAt); + Utils.enhancedDeepEquals(this.identity, other.identity) && + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.joinedAt, other.joinedAt) && + Utils.enhancedDeepEquals(this.leftAt, other.leftAt); } @Override public int hashCode() { - return Objects.hash( - identity, - name, - joinedAt, + return Utils.enhancedHash( + identity, name, joinedAt, leftAt); } @@ -209,21 +209,23 @@ public String toString() { "joinedAt", joinedAt, "leftAt", leftAt); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional identity = Optional.empty(); - + private Optional name = Optional.empty(); - + private Optional joinedAt = Optional.empty(); - - private Optional leftAt = Optional.empty(); - + + private Optional leftAt = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * participant ID */ @@ -242,6 +244,7 @@ public Builder identity(Optional identity) { return this; } + /** * user defined participant name */ @@ -260,6 +263,7 @@ public Builder name(Optional name) { return this; } + /** * the time the participant joined */ @@ -278,6 +282,7 @@ public Builder joinedAt(Optional joinedAt) { return this; } + /** * the time the participant left */ @@ -295,14 +300,13 @@ public Builder leftAt(Optional leftAt) { this.leftAt = leftAt; return this; } - + public Participants build() { + return new Participants( - identity, - name, - joinedAt, + identity, name, joinedAt, leftAt); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Phase.java b/src/main/java/studio/livepeer/livepeer/models/components/Phase.java index 4239f4e4..32607027 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Phase.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Phase.java @@ -1,14 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * Phase - Phase of the asset storage + * Phase + * + *

Phase of the asset storage */ public enum Phase { WAITING("waiting"), @@ -20,11 +23,21 @@ public enum Phase { @JsonValue private final String value; - private Phase(String value) { + Phase(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (Phase o: Phase.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Pinata.java b/src/main/java/studio/livepeer/livepeer/models/components/Pinata.java index f8ade733..1c1b12c4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Pinata.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Pinata.java @@ -1,17 +1,14 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; @@ -19,11 +16,11 @@ import studio.livepeer.livepeer.utils.Utils; /** - * Pinata - Custom credentials for the Piñata service. Must have either - * a JWT or an API key and an API secret. + * Pinata * + *

Custom credentials for the Piñata service. Must have either + * a JWT or an API key and an API secret. */ - @JsonDeserialize(using = Pinata._Deserializer.class) public class Pinata { @@ -75,12 +72,12 @@ public boolean equals(java.lang.Object o) { return false; } Pinata other = (Pinata) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -88,8 +85,8 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(Pinata.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -100,3 +97,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Pinata1.java b/src/main/java/studio/livepeer/livepeer/models/components/Pinata1.java index 6911ca85..24aa9c08 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Pinata1.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Pinata1.java @@ -1,29 +1,24 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; public class Pinata1 { - @JsonCreator public Pinata1() { - - } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } - + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -37,7 +32,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( ); } @@ -45,17 +40,19 @@ public int hashCode() { public String toString() { return Utils.toString(Pinata1.class); } - - public final static class Builder { - + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + private Builder() { // force use of static builder() method } - + public Pinata1 build() { + return new Pinata1( ); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Pinata2.java b/src/main/java/studio/livepeer/livepeer/models/components/Pinata2.java index 9e1db416..33caf967 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Pinata2.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Pinata2.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; public class Pinata2 { - /** * Will be added to the pinata_api_key header. */ @@ -37,10 +33,11 @@ public String apiKey() { return apiKey; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Will be added to the pinata_api_key header. */ @@ -49,7 +46,7 @@ public Pinata2 withApiKey(String apiKey) { this.apiKey = apiKey; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } Pinata2 other = (Pinata2) o; return - Objects.deepEquals(this.apiKey, other.apiKey); + Utils.enhancedDeepEquals(this.apiKey, other.apiKey); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( apiKey); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(Pinata2.class, "apiKey", apiKey); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String apiKey; - + + private String apiKey; + private Builder() { // force use of static builder() method } + /** * Will be added to the pinata_api_key header. */ @@ -91,11 +90,12 @@ public Builder apiKey(String apiKey) { this.apiKey = apiKey; return this; } - + public Pinata2 build() { + return new Pinata2( apiKey); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfo.java b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfo.java index 2484e942..8bd8af14 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfo.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfo.java @@ -1,16 +1,13 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; @@ -19,6 +16,7 @@ public class PlaybackInfo { @JsonProperty("type") private PlaybackInfoType type; + @JsonProperty("meta") private Meta meta; @@ -42,10 +40,11 @@ public Meta meta() { return meta; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public PlaybackInfo withType(PlaybackInfoType type) { Utils.checkNotNull(type, "type"); this.type = type; @@ -57,7 +56,7 @@ public PlaybackInfo withMeta(Meta meta) { this.meta = meta; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -68,15 +67,14 @@ public boolean equals(java.lang.Object o) { } PlaybackInfo other = (PlaybackInfo) o; return - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.meta, other.meta); + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.meta, other.meta); } @Override public int hashCode() { - return Objects.hash( - type, - meta); + return Utils.enhancedHash( + type, meta); } @Override @@ -85,34 +83,37 @@ public String toString() { "type", type, "meta", meta); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private PlaybackInfoType type; - - private Meta meta; - + + private Meta meta; + private Builder() { // force use of static builder() method } + public Builder type(PlaybackInfoType type) { Utils.checkNotNull(type, "type"); this.type = type; return this; } + public Builder meta(Meta meta) { Utils.checkNotNull(meta, "meta"); this.meta = meta; return this; } - + public PlaybackInfo build() { + return new PlaybackInfo( - type, - meta); + type, meta); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoHrn.java b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoHrn.java index 52e5dd0b..9c836174 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoHrn.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoHrn.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum PlaybackInfoHrn { HLS_TS("HLS (TS)"); @@ -13,11 +14,21 @@ public enum PlaybackInfoHrn { @JsonValue private final String value; - private PlaybackInfoHrn(String value) { + PlaybackInfoHrn(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (PlaybackInfoHrn o: PlaybackInfoHrn.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoMetaDvrPlaybackType.java b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoMetaDvrPlaybackType.java index 868fc305..91e1a2cb 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoMetaDvrPlaybackType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoMetaDvrPlaybackType.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum PlaybackInfoMetaDvrPlaybackType { HTML5_APPLICATION_VND_APPLE_MPEGURL("html5/application/vnd.apple.mpegurl"); @@ -13,11 +14,21 @@ public enum PlaybackInfoMetaDvrPlaybackType { @JsonValue private final String value; - private PlaybackInfoMetaDvrPlaybackType(String value) { + PlaybackInfoMetaDvrPlaybackType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (PlaybackInfoMetaDvrPlaybackType o: PlaybackInfoMetaDvrPlaybackType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoMetaType.java b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoMetaType.java index 7f3285df..2db8d832 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoMetaType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoMetaType.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum PlaybackInfoMetaType { HTML5_APPLICATION_VND_APPLE_MPEGURL("html5/application/vnd.apple.mpegurl"), @@ -19,11 +20,21 @@ public enum PlaybackInfoMetaType { @JsonValue private final String value; - private PlaybackInfoMetaType(String value) { + PlaybackInfoMetaType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (PlaybackInfoMetaType o: PlaybackInfoMetaType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoSource.java b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoSource.java index 6c7a1f05..81b0f083 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoSource.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoSource.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,37 +11,41 @@ import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class PlaybackInfoSource { - /** * Human Readable Name */ @JsonProperty("hrn") private Hrn hrn; + @JsonProperty("type") private PlaybackInfoMetaType type; + @JsonProperty("url") private String url; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("size") private Optional size; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("width") private Optional width; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("height") private Optional height; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("bitrate") private Optional bitrate; @@ -77,7 +79,9 @@ public PlaybackInfoSource( Hrn hrn, PlaybackInfoMetaType type, String url) { - this(hrn, type, url, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(hrn, type, url, + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -118,10 +122,11 @@ public Optional bitrate() { return bitrate; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Human Readable Name */ @@ -149,6 +154,7 @@ public PlaybackInfoSource withSize(double size) { return this; } + public PlaybackInfoSource withSize(Optional size) { Utils.checkNotNull(size, "size"); this.size = size; @@ -161,6 +167,7 @@ public PlaybackInfoSource withWidth(double width) { return this; } + public PlaybackInfoSource withWidth(Optional width) { Utils.checkNotNull(width, "width"); this.width = width; @@ -173,6 +180,7 @@ public PlaybackInfoSource withHeight(double height) { return this; } + public PlaybackInfoSource withHeight(Optional height) { Utils.checkNotNull(height, "height"); this.height = height; @@ -185,12 +193,13 @@ public PlaybackInfoSource withBitrate(double bitrate) { return this; } + public PlaybackInfoSource withBitrate(Optional bitrate) { Utils.checkNotNull(bitrate, "bitrate"); this.bitrate = bitrate; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -201,24 +210,20 @@ public boolean equals(java.lang.Object o) { } PlaybackInfoSource other = (PlaybackInfoSource) o; return - Objects.deepEquals(this.hrn, other.hrn) && - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.size, other.size) && - Objects.deepEquals(this.width, other.width) && - Objects.deepEquals(this.height, other.height) && - Objects.deepEquals(this.bitrate, other.bitrate); + Utils.enhancedDeepEquals(this.hrn, other.hrn) && + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.size, other.size) && + Utils.enhancedDeepEquals(this.width, other.width) && + Utils.enhancedDeepEquals(this.height, other.height) && + Utils.enhancedDeepEquals(this.bitrate, other.bitrate); } @Override public int hashCode() { - return Objects.hash( - hrn, - type, - url, - size, - width, - height, + return Utils.enhancedHash( + hrn, type, url, + size, width, height, bitrate); } @@ -233,27 +238,29 @@ public String toString() { "height", height, "bitrate", bitrate); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Hrn hrn; - + private PlaybackInfoMetaType type; - + private String url; - + private Optional size = Optional.empty(); - + private Optional width = Optional.empty(); - + private Optional height = Optional.empty(); - - private Optional bitrate = Optional.empty(); - + + private Optional bitrate = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Human Readable Name */ @@ -263,18 +270,21 @@ public Builder hrn(Hrn hrn) { return this; } + public Builder type(PlaybackInfoMetaType type) { Utils.checkNotNull(type, "type"); this.type = type; return this; } + public Builder url(String url) { Utils.checkNotNull(url, "url"); this.url = url; return this; } + public Builder size(double size) { Utils.checkNotNull(size, "size"); this.size = Optional.ofNullable(size); @@ -287,6 +297,7 @@ public Builder size(Optional size) { return this; } + public Builder width(double width) { Utils.checkNotNull(width, "width"); this.width = Optional.ofNullable(width); @@ -299,6 +310,7 @@ public Builder width(Optional width) { return this; } + public Builder height(double height) { Utils.checkNotNull(height, "height"); this.height = Optional.ofNullable(height); @@ -311,6 +323,7 @@ public Builder height(Optional height) { return this; } + public Builder bitrate(double bitrate) { Utils.checkNotNull(bitrate, "bitrate"); this.bitrate = Optional.ofNullable(bitrate); @@ -322,17 +335,14 @@ public Builder bitrate(Optional bitrate) { this.bitrate = bitrate; return this; } - + public PlaybackInfoSource build() { + return new PlaybackInfoSource( - hrn, - type, - url, - size, - width, - height, + hrn, type, url, + size, width, height, bitrate); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoType.java b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoType.java index 6f88669a..7477d8d5 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackInfoType.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum PlaybackInfoType { LIVE("live"), @@ -15,11 +16,21 @@ public enum PlaybackInfoType { @JsonValue private final String value; - private PlaybackInfoType(String value) { + PlaybackInfoType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (PlaybackInfoType o: PlaybackInfoType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackPolicy.java b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackPolicy.java index 3d42da69..9be7c387 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/PlaybackPolicy.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/PlaybackPolicy.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -17,14 +15,14 @@ import java.lang.SuppressWarnings; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * PlaybackPolicy - Whether the playback policy for an asset or stream is public or signed + * PlaybackPolicy + * + *

Whether the playback policy for an asset or stream is public or signed */ - public class PlaybackPolicy { @JsonProperty("type") @@ -47,14 +45,14 @@ public class PlaybackPolicy { /** * Interval (in seconds) at which the playback policy should be * refreshed (default 600 seconds) - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("refreshInterval") private Optional refreshInterval; /** - * List of allowed origins for CORS playback (<scheme>://<hostname>:<port>, <scheme>://<hostname>) + * List of allowed origins for CORS playback (<scheme>://<hostname>:, + * <scheme>://<hostname>) */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("allowedOrigins") @@ -81,7 +79,8 @@ public PlaybackPolicy( public PlaybackPolicy( Type type) { - this(type, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(type, Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); } @JsonIgnore @@ -109,7 +108,6 @@ public Optional> webhookContext() { /** * Interval (in seconds) at which the playback policy should be * refreshed (default 600 seconds) - * */ @JsonIgnore public Optional refreshInterval() { @@ -117,7 +115,8 @@ public Optional refreshInterval() { } /** - * List of allowed origins for CORS playback (<scheme>://<hostname>:<port>, <scheme>://<hostname>) + * List of allowed origins for CORS playback (<scheme>://<hostname>:, + * <scheme>://<hostname>) */ @SuppressWarnings("unchecked") @JsonIgnore @@ -125,10 +124,11 @@ public Optional> allowedOrigins() { return (Optional>) allowedOrigins; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public PlaybackPolicy withType(Type type) { Utils.checkNotNull(type, "type"); this.type = type; @@ -144,6 +144,7 @@ public PlaybackPolicy withWebhookId(String webhookId) { return this; } + /** * ID of the webhook to use for playback policy */ @@ -162,6 +163,7 @@ public PlaybackPolicy withWebhookContext(Map webhookContext) { return this; } + /** * User-defined webhook context */ @@ -174,7 +176,6 @@ public PlaybackPolicy withWebhookContext(Optional> /** * Interval (in seconds) at which the playback policy should be * refreshed (default 600 seconds) - * */ public PlaybackPolicy withRefreshInterval(double refreshInterval) { Utils.checkNotNull(refreshInterval, "refreshInterval"); @@ -182,10 +183,10 @@ public PlaybackPolicy withRefreshInterval(double refreshInterval) { return this; } + /** * Interval (in seconds) at which the playback policy should be * refreshed (default 600 seconds) - * */ public PlaybackPolicy withRefreshInterval(Optional refreshInterval) { Utils.checkNotNull(refreshInterval, "refreshInterval"); @@ -194,7 +195,8 @@ public PlaybackPolicy withRefreshInterval(Optional refreshInterval) { } /** - * List of allowed origins for CORS playback (<scheme>://<hostname>:<port>, <scheme>://<hostname>) + * List of allowed origins for CORS playback (<scheme>://<hostname>:, + * <scheme>://<hostname>) */ public PlaybackPolicy withAllowedOrigins(List allowedOrigins) { Utils.checkNotNull(allowedOrigins, "allowedOrigins"); @@ -202,15 +204,17 @@ public PlaybackPolicy withAllowedOrigins(List allowedOrigins) { return this; } + /** - * List of allowed origins for CORS playback (<scheme>://<hostname>:<port>, <scheme>://<hostname>) + * List of allowed origins for CORS playback (<scheme>://<hostname>:, + * <scheme>://<hostname>) */ public PlaybackPolicy withAllowedOrigins(Optional> allowedOrigins) { Utils.checkNotNull(allowedOrigins, "allowedOrigins"); this.allowedOrigins = allowedOrigins; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -221,21 +225,18 @@ public boolean equals(java.lang.Object o) { } PlaybackPolicy other = (PlaybackPolicy) o; return - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.webhookId, other.webhookId) && - Objects.deepEquals(this.webhookContext, other.webhookContext) && - Objects.deepEquals(this.refreshInterval, other.refreshInterval) && - Objects.deepEquals(this.allowedOrigins, other.allowedOrigins); + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.webhookId, other.webhookId) && + Utils.enhancedDeepEquals(this.webhookContext, other.webhookContext) && + Utils.enhancedDeepEquals(this.refreshInterval, other.refreshInterval) && + Utils.enhancedDeepEquals(this.allowedOrigins, other.allowedOrigins); } @Override public int hashCode() { - return Objects.hash( - type, - webhookId, - webhookContext, - refreshInterval, - allowedOrigins); + return Utils.enhancedHash( + type, webhookId, webhookContext, + refreshInterval, allowedOrigins); } @Override @@ -247,29 +248,32 @@ public String toString() { "refreshInterval", refreshInterval, "allowedOrigins", allowedOrigins); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Type type; - + private Optional webhookId = Optional.empty(); - + private Optional> webhookContext = Optional.empty(); - + private Optional refreshInterval = Optional.empty(); - - private Optional> allowedOrigins = Optional.empty(); - + + private Optional> allowedOrigins = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder type(Type type) { Utils.checkNotNull(type, "type"); this.type = type; return this; } + /** * ID of the webhook to use for playback policy */ @@ -288,6 +292,7 @@ public Builder webhookId(Optional webhookId) { return this; } + /** * User-defined webhook context */ @@ -306,10 +311,10 @@ public Builder webhookContext(Optional> webhookCon return this; } + /** * Interval (in seconds) at which the playback policy should be * refreshed (default 600 seconds) - * */ public Builder refreshInterval(double refreshInterval) { Utils.checkNotNull(refreshInterval, "refreshInterval"); @@ -320,7 +325,6 @@ public Builder refreshInterval(double refreshInterval) { /** * Interval (in seconds) at which the playback policy should be * refreshed (default 600 seconds) - * */ public Builder refreshInterval(Optional refreshInterval) { Utils.checkNotNull(refreshInterval, "refreshInterval"); @@ -328,8 +332,10 @@ public Builder refreshInterval(Optional refreshInterval) { return this; } + /** - * List of allowed origins for CORS playback (<scheme>://<hostname>:<port>, <scheme>://<hostname>) + * List of allowed origins for CORS playback (<scheme>://<hostname>:, + * <scheme>://<hostname>) */ public Builder allowedOrigins(List allowedOrigins) { Utils.checkNotNull(allowedOrigins, "allowedOrigins"); @@ -338,22 +344,21 @@ public Builder allowedOrigins(List allowedOrigins) { } /** - * List of allowed origins for CORS playback (<scheme>://<hostname>:<port>, <scheme>://<hostname>) + * List of allowed origins for CORS playback (<scheme>://<hostname>:, + * <scheme>://<hostname>) */ public Builder allowedOrigins(Optional> allowedOrigins) { Utils.checkNotNull(allowedOrigins, "allowedOrigins"); this.allowedOrigins = allowedOrigins; return this; } - + public PlaybackPolicy build() { + return new PlaybackPolicy( - type, - webhookId, - webhookContext, - refreshInterval, - allowedOrigins); + type, webhookId, webhookContext, + refreshInterval, allowedOrigins); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/PrimaryType.java b/src/main/java/studio/livepeer/livepeer/models/components/PrimaryType.java index fb65a999..f4f47f5f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/PrimaryType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/PrimaryType.java @@ -1,14 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * PrimaryType - Video Metadata EIP-712 primaryType + * PrimaryType + * + *

Video Metadata EIP-712 primaryType */ public enum PrimaryType { VIDEO_ATTESTATION("VideoAttestation"); @@ -16,11 +19,21 @@ public enum PrimaryType { @JsonValue private final String value; - private PrimaryType(String value) { + PrimaryType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (PrimaryType o: PrimaryType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Profile.java b/src/main/java/studio/livepeer/livepeer/models/components/Profile.java index c93e0f06..a87f2241 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Profile.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Profile.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum Profile { H264_BASELINE("H264Baseline"), @@ -16,11 +17,21 @@ public enum Profile { @JsonValue private final String value; - private Profile(String value) { + Profile(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (Profile o: Profile.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Pull.java b/src/main/java/studio/livepeer/livepeer/models/components/Pull.java index c5bfdff7..e3880e67 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Pull.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Pull.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,18 +12,17 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.Map; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * Pull - Configuration for a stream that should be actively pulled from an + * Pull + * + *

Configuration for a stream that should be actively pulled from an * external source, rather than pushed to Livepeer. If specified, the * stream will not have a streamKey. */ - public class Pull { - /** * URL from which to pull from. */ @@ -72,7 +69,8 @@ public Pull( public Pull( String source) { - this(source, Optional.empty(), Optional.empty(), Optional.empty()); + this(source, Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -111,10 +109,11 @@ public Optional location() { return (Optional) location; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * URL from which to pull from. */ @@ -133,6 +132,7 @@ public Pull withHeaders(Map headers) { return this; } + /** * Headers to be sent with the request to the pull source. */ @@ -151,6 +151,7 @@ public Pull withIsMobile(IsMobile isMobile) { return this; } + /** * Indicates whether the stream will be pulled from a mobile source. */ @@ -170,6 +171,7 @@ public Pull withLocation(Location location) { return this; } + /** * Approximate location of the pull source. The location is used to * determine the closest Livepeer region to pull the stream from. @@ -179,7 +181,7 @@ public Pull withLocation(Optional location) { this.location = location; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -190,18 +192,16 @@ public boolean equals(java.lang.Object o) { } Pull other = (Pull) o; return - Objects.deepEquals(this.source, other.source) && - Objects.deepEquals(this.headers, other.headers) && - Objects.deepEquals(this.isMobile, other.isMobile) && - Objects.deepEquals(this.location, other.location); + Utils.enhancedDeepEquals(this.source, other.source) && + Utils.enhancedDeepEquals(this.headers, other.headers) && + Utils.enhancedDeepEquals(this.isMobile, other.isMobile) && + Utils.enhancedDeepEquals(this.location, other.location); } @Override public int hashCode() { - return Objects.hash( - source, - headers, - isMobile, + return Utils.enhancedHash( + source, headers, isMobile, location); } @@ -213,21 +213,23 @@ public String toString() { "isMobile", isMobile, "location", location); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String source; - + private Optional> headers = Optional.empty(); - + private Optional isMobile = Optional.empty(); - - private Optional location = Optional.empty(); - + + private Optional location = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * URL from which to pull from. */ @@ -237,6 +239,7 @@ public Builder source(String source) { return this; } + /** * Headers to be sent with the request to the pull source. */ @@ -255,6 +258,7 @@ public Builder headers(Optional> headers) { return this; } + /** * Indicates whether the stream will be pulled from a mobile source. */ @@ -273,6 +277,7 @@ public Builder isMobile(Optional isMobile) { return this; } + /** * Approximate location of the pull source. The location is used to * determine the closest Livepeer region to pull the stream from. @@ -292,14 +297,13 @@ public Builder location(Optional location) { this.location = location; return this; } - + public Pull build() { + return new Pull( - source, - headers, - isMobile, + source, headers, isMobile, location); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/RealtimeViewershipMetric.java b/src/main/java/studio/livepeer/livepeer/models/components/RealtimeViewershipMetric.java index 575b2a30..7391c12e 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/RealtimeViewershipMetric.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/RealtimeViewershipMetric.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,17 +12,15 @@ import java.lang.Long; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * RealtimeViewershipMetric - An individual metric about realtime viewership of a stream/asset. + * RealtimeViewershipMetric * + *

An individual metric about realtime viewership of a stream/asset. */ - public class RealtimeViewershipMetric { - /** * The playback ID associated with the metric. */ @@ -90,7 +86,8 @@ public RealtimeViewershipMetric( public RealtimeViewershipMetric( long viewCount, double errorRate) { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), viewCount, errorRate); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), viewCount, errorRate); } /** @@ -141,10 +138,11 @@ public double errorRate() { return errorRate; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The playback ID associated with the metric. */ @@ -154,6 +152,7 @@ public RealtimeViewershipMetric withPlaybackId(String playbackId) { return this; } + /** * The playback ID associated with the metric. */ @@ -172,6 +171,7 @@ public RealtimeViewershipMetric withDevice(String device) { return this; } + /** * The device used by the viewer. */ @@ -190,6 +190,7 @@ public RealtimeViewershipMetric withBrowser(String browser) { return this; } + /** * The browser used by the viewer. */ @@ -208,6 +209,7 @@ public RealtimeViewershipMetric withCountry(String country) { return this; } + /** * The country where the viewer is located. */ @@ -234,7 +236,7 @@ public RealtimeViewershipMetric withErrorRate(double errorRate) { this.errorRate = errorRate; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -245,23 +247,19 @@ public boolean equals(java.lang.Object o) { } RealtimeViewershipMetric other = (RealtimeViewershipMetric) o; return - Objects.deepEquals(this.playbackId, other.playbackId) && - Objects.deepEquals(this.device, other.device) && - Objects.deepEquals(this.browser, other.browser) && - Objects.deepEquals(this.country, other.country) && - Objects.deepEquals(this.viewCount, other.viewCount) && - Objects.deepEquals(this.errorRate, other.errorRate); + Utils.enhancedDeepEquals(this.playbackId, other.playbackId) && + Utils.enhancedDeepEquals(this.device, other.device) && + Utils.enhancedDeepEquals(this.browser, other.browser) && + Utils.enhancedDeepEquals(this.country, other.country) && + Utils.enhancedDeepEquals(this.viewCount, other.viewCount) && + Utils.enhancedDeepEquals(this.errorRate, other.errorRate); } @Override public int hashCode() { - return Objects.hash( - playbackId, - device, - browser, - country, - viewCount, - errorRate); + return Utils.enhancedHash( + playbackId, device, browser, + country, viewCount, errorRate); } @Override @@ -274,25 +272,27 @@ public String toString() { "viewCount", viewCount, "errorRate", errorRate); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional playbackId = Optional.empty(); - + private Optional device = Optional.empty(); - + private Optional browser = Optional.empty(); - + private Optional country = Optional.empty(); - + private Long viewCount; - - private Double errorRate; - + + private Double errorRate; + private Builder() { // force use of static builder() method } + /** * The playback ID associated with the metric. */ @@ -311,6 +311,7 @@ public Builder playbackId(Optional playbackId) { return this; } + /** * The device used by the viewer. */ @@ -329,6 +330,7 @@ public Builder device(Optional device) { return this; } + /** * The browser used by the viewer. */ @@ -347,6 +349,7 @@ public Builder browser(Optional browser) { return this; } + /** * The country where the viewer is located. */ @@ -365,6 +368,7 @@ public Builder country(Optional country) { return this; } + /** * The number of views for the stream/asset. */ @@ -374,6 +378,7 @@ public Builder viewCount(long viewCount) { return this; } + /** * The error rate for the stream/asset. */ @@ -382,16 +387,13 @@ public Builder errorRate(double errorRate) { this.errorRate = errorRate; return this; } - + public RealtimeViewershipMetric build() { + return new RealtimeViewershipMetric( - playbackId, - device, - browser, - country, - viewCount, - errorRate); + playbackId, device, browser, + country, viewCount, errorRate); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/RecordingSpec.java b/src/main/java/studio/livepeer/livepeer/models/components/RecordingSpec.java index 35168023..61ec7602 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/RecordingSpec.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/RecordingSpec.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,7 +12,6 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; @@ -42,10 +39,11 @@ public JsonNullable> profiles() { return (JsonNullable>) profiles; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public RecordingSpec withProfiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = JsonNullable.of(profiles); @@ -57,7 +55,7 @@ public RecordingSpec withProfiles(JsonNullable> this.profiles = profiles; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -68,12 +66,12 @@ public boolean equals(java.lang.Object o) { } RecordingSpec other = (RecordingSpec) o; return - Objects.deepEquals(this.profiles, other.profiles); + Utils.enhancedDeepEquals(this.profiles, other.profiles); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( profiles); } @@ -82,15 +80,17 @@ public String toString() { return Utils.toString(RecordingSpec.class, "profiles", profiles); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private JsonNullable> profiles = JsonNullable.undefined(); - + + private JsonNullable> profiles = JsonNullable.undefined(); + private Builder() { // force use of static builder() method } + public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = JsonNullable.of(profiles); @@ -102,11 +102,12 @@ public Builder profiles(JsonNullable> profiles) this.profiles = profiles; return this; } - + public RecordingSpec build() { + return new RecordingSpec( profiles); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/RecordingStatus.java b/src/main/java/studio/livepeer/livepeer/models/components/RecordingStatus.java index c844ad51..9987c236 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/RecordingStatus.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/RecordingStatus.java @@ -1,29 +1,43 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * RecordingStatus - The status of the recording process of this stream session. + * RecordingStatus + * + *

The status of the recording process of this stream session. */ public enum RecordingStatus { WAITING("waiting"), READY("ready"), FAILED("failed"), + DELETED("deleted"), NONE("none"); @JsonValue private final String value; - private RecordingStatus(String value) { + RecordingStatus(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (RecordingStatus o: RecordingStatus.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Renditions.java b/src/main/java/studio/livepeer/livepeer/models/components/Renditions.java index 5a71797e..6b827e6c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Renditions.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Renditions.java @@ -1,29 +1,24 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; public class Renditions { - @JsonCreator public Renditions() { - - } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } - + + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -37,7 +32,7 @@ public boolean equals(java.lang.Object o) { @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( ); } @@ -45,17 +40,19 @@ public int hashCode() { public String toString() { return Utils.toString(Renditions.class); } - - public final static class Builder { - + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + private Builder() { // force use of static builder() method } - + public Renditions build() { + return new Renditions( ); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Request.java b/src/main/java/studio/livepeer/livepeer/models/components/Request.java index 24c3f96d..eb15ef5d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Request.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Request.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,13 +12,11 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.Map; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class Request { - /** * URL used for the request */ @@ -66,7 +62,8 @@ public Request( } public Request() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -102,10 +99,11 @@ public Optional body() { return body; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * URL used for the request */ @@ -115,6 +113,7 @@ public Request withUrl(String url) { return this; } + /** * URL used for the request */ @@ -133,6 +132,7 @@ public Request withMethod(String method) { return this; } + /** * HTTP request method */ @@ -151,6 +151,7 @@ public Request withHeaders(Map headers) { return this; } + /** * HTTP request headers */ @@ -169,6 +170,7 @@ public Request withBody(String body) { return this; } + /** * request body */ @@ -177,7 +179,7 @@ public Request withBody(Optional body) { this.body = body; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -188,18 +190,16 @@ public boolean equals(java.lang.Object o) { } Request other = (Request) o; return - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.method, other.method) && - Objects.deepEquals(this.headers, other.headers) && - Objects.deepEquals(this.body, other.body); + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.method, other.method) && + Utils.enhancedDeepEquals(this.headers, other.headers) && + Utils.enhancedDeepEquals(this.body, other.body); } @Override public int hashCode() { - return Objects.hash( - url, - method, - headers, + return Utils.enhancedHash( + url, method, headers, body); } @@ -211,21 +211,23 @@ public String toString() { "headers", headers, "body", body); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional url = Optional.empty(); - + private Optional method = Optional.empty(); - + private Optional> headers = Optional.empty(); - - private Optional body = Optional.empty(); - + + private Optional body = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * URL used for the request */ @@ -244,6 +246,7 @@ public Builder url(Optional url) { return this; } + /** * HTTP request method */ @@ -262,6 +265,7 @@ public Builder method(Optional method) { return this; } + /** * HTTP request headers */ @@ -280,6 +284,7 @@ public Builder headers(Optional> headers) { return this; } + /** * request body */ @@ -297,14 +302,13 @@ public Builder body(Optional body) { this.body = body; return this; } - + public Request build() { + return new Request( - url, - method, - headers, + url, method, headers, body); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Response.java b/src/main/java/studio/livepeer/livepeer/models/components/Response.java index d000dbb6..db381603 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Response.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Response.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,13 +11,11 @@ import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class Response { - /** * response body */ @@ -82,10 +78,11 @@ public Optional statusText() { return statusText; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * response body */ @@ -95,6 +92,7 @@ public Response withBody(String body) { return this; } + /** * response body */ @@ -113,6 +111,7 @@ public Response withStatus(double status) { return this; } + /** * HTTP status code */ @@ -131,6 +130,7 @@ public Response withStatusText(String statusText) { return this; } + /** * response status text */ @@ -139,7 +139,7 @@ public Response withStatusText(Optional statusText) { this.statusText = statusText; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -150,17 +150,15 @@ public boolean equals(java.lang.Object o) { } Response other = (Response) o; return - Objects.deepEquals(this.body, other.body) && - Objects.deepEquals(this.status, other.status) && - Objects.deepEquals(this.statusText, other.statusText); + Utils.enhancedDeepEquals(this.body, other.body) && + Utils.enhancedDeepEquals(this.status, other.status) && + Utils.enhancedDeepEquals(this.statusText, other.statusText); } @Override public int hashCode() { - return Objects.hash( - body, - status, - statusText); + return Utils.enhancedHash( + body, status, statusText); } @Override @@ -170,19 +168,21 @@ public String toString() { "status", status, "statusText", statusText); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional body = Optional.empty(); - + private Optional status = Optional.empty(); - - private Optional statusText = Optional.empty(); - + + private Optional statusText = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * response body */ @@ -201,6 +201,7 @@ public Builder body(Optional body) { return this; } + /** * HTTP status code */ @@ -219,6 +220,7 @@ public Builder status(Optional status) { return this; } + /** * response status text */ @@ -236,13 +238,12 @@ public Builder statusText(Optional statusText) { this.statusText = statusText; return this; } - + public Response build() { + return new Response( - body, - status, - statusText); + body, status, statusText); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Room.java b/src/main/java/studio/livepeer/livepeer/models/components/Room.java index 6244c4a3..b9fac8d3 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Room.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Room.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,13 +12,11 @@ import java.lang.Override; import java.lang.String; import java.util.Map; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class Room { - /** * room ID */ @@ -48,6 +44,7 @@ public class Room { @JsonProperty("egressId") private Optional egressId; + @JsonProperty("participants") private Map participants; @@ -63,6 +60,7 @@ public Room( Utils.checkNotNull(updatedAt, "updatedAt"); Utils.checkNotNull(egressId, "egressId"); participants = Utils.emptyMapIfNull(participants); + Utils.checkNotNull(participants, "participants"); this.id = id; this.createdAt = createdAt; this.updatedAt = updatedAt; @@ -73,7 +71,8 @@ public Room( public Room( String id, Map participants) { - this(id, Optional.empty(), Optional.empty(), Optional.empty(), participants); + this(id, Optional.empty(), Optional.empty(), + Optional.empty(), participants); } /** @@ -113,10 +112,11 @@ public Map participants() { return participants; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * room ID */ @@ -135,6 +135,7 @@ public Room withCreatedAt(double createdAt) { return this; } + /** * Timestamp (in milliseconds) at which the room was created */ @@ -153,6 +154,7 @@ public Room withUpdatedAt(double updatedAt) { return this; } + /** * Timestamp (in milliseconds) at which room was updated */ @@ -171,6 +173,7 @@ public Room withEgressId(String egressId) { return this; } + /** * internal ID for egress output */ @@ -185,7 +188,7 @@ public Room withParticipants(Map participants) { this.participants = participants; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -196,21 +199,18 @@ public boolean equals(java.lang.Object o) { } Room other = (Room) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.createdAt, other.createdAt) && - Objects.deepEquals(this.updatedAt, other.updatedAt) && - Objects.deepEquals(this.egressId, other.egressId) && - Objects.deepEquals(this.participants, other.participants); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.createdAt, other.createdAt) && + Utils.enhancedDeepEquals(this.updatedAt, other.updatedAt) && + Utils.enhancedDeepEquals(this.egressId, other.egressId) && + Utils.enhancedDeepEquals(this.participants, other.participants); } @Override public int hashCode() { - return Objects.hash( - id, - createdAt, - updatedAt, - egressId, - participants); + return Utils.enhancedHash( + id, createdAt, updatedAt, + egressId, participants); } @Override @@ -222,23 +222,25 @@ public String toString() { "egressId", egressId, "participants", participants); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - + private Optional createdAt = Optional.empty(); - + private Optional updatedAt = Optional.empty(); - + private Optional egressId = Optional.empty(); - - private Map participants; - + + private Map participants; + private Builder() { // force use of static builder() method } + /** * room ID */ @@ -248,6 +250,7 @@ public Builder id(String id) { return this; } + /** * Timestamp (in milliseconds) at which the room was created */ @@ -266,6 +269,7 @@ public Builder createdAt(Optional createdAt) { return this; } + /** * Timestamp (in milliseconds) at which room was updated */ @@ -284,6 +288,7 @@ public Builder updatedAt(Optional updatedAt) { return this; } + /** * internal ID for egress output */ @@ -302,20 +307,19 @@ public Builder egressId(Optional egressId) { return this; } + public Builder participants(Map participants) { Utils.checkNotNull(participants, "participants"); this.participants = participants; return this; } - + public Room build() { + return new Room( - id, - createdAt, - updatedAt, - egressId, - participants); + id, createdAt, updatedAt, + egressId, participants); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/RoomEgressPayload.java b/src/main/java/studio/livepeer/livepeer/models/components/RoomEgressPayload.java index 0d7a006a..f812b77c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/RoomEgressPayload.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/RoomEgressPayload.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; public class RoomEgressPayload { - /** * The ID of the Livepeer Stream to stream to */ @@ -37,10 +33,11 @@ public String streamId() { return streamId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The ID of the Livepeer Stream to stream to */ @@ -49,7 +46,7 @@ public RoomEgressPayload withStreamId(String streamId) { this.streamId = streamId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } RoomEgressPayload other = (RoomEgressPayload) o; return - Objects.deepEquals(this.streamId, other.streamId); + Utils.enhancedDeepEquals(this.streamId, other.streamId); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( streamId); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(RoomEgressPayload.class, "streamId", streamId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String streamId; - + + private String streamId; + private Builder() { // force use of static builder() method } + /** * The ID of the Livepeer Stream to stream to */ @@ -91,11 +90,12 @@ public Builder streamId(String streamId) { this.streamId = streamId; return this; } - + public RoomEgressPayload build() { + return new RoomEgressPayload( streamId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/RoomUserPayload.java b/src/main/java/studio/livepeer/livepeer/models/components/RoomUserPayload.java index 9e29fc77..4567893b 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/RoomUserPayload.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/RoomUserPayload.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,13 +11,11 @@ import java.lang.Boolean; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class RoomUserPayload { - /** * Display name */ @@ -65,7 +61,8 @@ public RoomUserPayload( public RoomUserPayload( String name) { - this(name, Optional.empty(), Optional.empty(), Optional.empty()); + this(name, Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -100,10 +97,11 @@ public Optional metadata() { return metadata; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Display name */ @@ -122,6 +120,7 @@ public RoomUserPayload withCanPublish(boolean canPublish) { return this; } + /** * Whether a user is allowed to publish audio/video tracks */ @@ -140,6 +139,7 @@ public RoomUserPayload withCanPublishData(boolean canPublishData) { return this; } + /** * Whether a user is allowed to publish data messages to the room */ @@ -158,6 +158,7 @@ public RoomUserPayload withMetadata(String metadata) { return this; } + /** * User defined payload to store for the participant */ @@ -166,7 +167,7 @@ public RoomUserPayload withMetadata(Optional metadata) { this.metadata = metadata; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -177,18 +178,16 @@ public boolean equals(java.lang.Object o) { } RoomUserPayload other = (RoomUserPayload) o; return - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.canPublish, other.canPublish) && - Objects.deepEquals(this.canPublishData, other.canPublishData) && - Objects.deepEquals(this.metadata, other.metadata); + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.canPublish, other.canPublish) && + Utils.enhancedDeepEquals(this.canPublishData, other.canPublishData) && + Utils.enhancedDeepEquals(this.metadata, other.metadata); } @Override public int hashCode() { - return Objects.hash( - name, - canPublish, - canPublishData, + return Utils.enhancedHash( + name, canPublish, canPublishData, metadata); } @@ -200,21 +199,23 @@ public String toString() { "canPublishData", canPublishData, "metadata", metadata); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String name; - + private Optional canPublish = Optional.empty(); - + private Optional canPublishData = Optional.empty(); - - private Optional metadata = Optional.empty(); - + + private Optional metadata = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Display name */ @@ -224,6 +225,7 @@ public Builder name(String name) { return this; } + /** * Whether a user is allowed to publish audio/video tracks */ @@ -242,6 +244,7 @@ public Builder canPublish(Optional canPublish) { return this; } + /** * Whether a user is allowed to publish data messages to the room */ @@ -260,6 +263,7 @@ public Builder canPublishData(Optional canPublishData) { return this; } + /** * User defined payload to store for the participant */ @@ -277,14 +281,13 @@ public Builder metadata(Optional metadata) { this.metadata = metadata; return this; } - + public RoomUserPayload build() { + return new RoomUserPayload( - name, - canPublish, - canPublishData, + name, canPublish, canPublishData, metadata); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/RoomUserResponse.java b/src/main/java/studio/livepeer/livepeer/models/components/RoomUserResponse.java index a29271c5..576af383 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/RoomUserResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/RoomUserResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,13 +10,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class RoomUserResponse { - /** * The ID of the user */ @@ -27,14 +23,16 @@ public class RoomUserResponse { private Optional id; /** - * Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide for more info). + * Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide + * for more info). */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("joinUrl") private Optional joinUrl; /** - * Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming guide for more info). + * Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming + * guide for more info). */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("token") @@ -66,7 +64,8 @@ public Optional id() { } /** - * Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide for more info). + * Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide + * for more info). */ @JsonIgnore public Optional joinUrl() { @@ -74,17 +73,19 @@ public Optional joinUrl() { } /** - * Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming guide for more info). + * Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming + * guide for more info). */ @JsonIgnore public Optional token() { return token; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The ID of the user */ @@ -94,6 +95,7 @@ public RoomUserResponse withId(String id) { return this; } + /** * The ID of the user */ @@ -104,7 +106,8 @@ public RoomUserResponse withId(Optional id) { } /** - * Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide for more info). + * Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide + * for more info). */ public RoomUserResponse withJoinUrl(String joinUrl) { Utils.checkNotNull(joinUrl, "joinUrl"); @@ -112,8 +115,10 @@ public RoomUserResponse withJoinUrl(String joinUrl) { return this; } + /** - * Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide for more info). + * Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide + * for more info). */ public RoomUserResponse withJoinUrl(Optional joinUrl) { Utils.checkNotNull(joinUrl, "joinUrl"); @@ -122,7 +127,8 @@ public RoomUserResponse withJoinUrl(Optional joinUrl) { } /** - * Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming guide for more info). + * Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming + * guide for more info). */ public RoomUserResponse withToken(String token) { Utils.checkNotNull(token, "token"); @@ -130,15 +136,17 @@ public RoomUserResponse withToken(String token) { return this; } + /** - * Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming guide for more info). + * Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming + * guide for more info). */ public RoomUserResponse withToken(Optional token) { Utils.checkNotNull(token, "token"); this.token = token; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -149,17 +157,15 @@ public boolean equals(java.lang.Object o) { } RoomUserResponse other = (RoomUserResponse) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.joinUrl, other.joinUrl) && - Objects.deepEquals(this.token, other.token); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.joinUrl, other.joinUrl) && + Utils.enhancedDeepEquals(this.token, other.token); } @Override public int hashCode() { - return Objects.hash( - id, - joinUrl, - token); + return Utils.enhancedHash( + id, joinUrl, token); } @Override @@ -169,19 +175,21 @@ public String toString() { "joinUrl", joinUrl, "token", token); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional id = Optional.empty(); - + private Optional joinUrl = Optional.empty(); - - private Optional token = Optional.empty(); - + + private Optional token = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * The ID of the user */ @@ -200,8 +208,10 @@ public Builder id(Optional id) { return this; } + /** - * Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide for more info). + * Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide + * for more info). */ public Builder joinUrl(String joinUrl) { Utils.checkNotNull(joinUrl, "joinUrl"); @@ -210,7 +220,8 @@ public Builder joinUrl(String joinUrl) { } /** - * Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide for more info). + * Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide + * for more info). */ public Builder joinUrl(Optional joinUrl) { Utils.checkNotNull(joinUrl, "joinUrl"); @@ -218,8 +229,10 @@ public Builder joinUrl(Optional joinUrl) { return this; } + /** - * Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming guide for more info). + * Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming + * guide for more info). */ public Builder token(String token) { Utils.checkNotNull(token, "token"); @@ -228,20 +241,20 @@ public Builder token(String token) { } /** - * Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming guide for more info). + * Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming + * guide for more info). */ public Builder token(Optional token) { Utils.checkNotNull(token, "token"); this.token = token; return this; } - + public RoomUserResponse build() { + return new RoomUserResponse( - id, - joinUrl, - token); + id, joinUrl, token); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/RoomUserUpdatePayload.java b/src/main/java/studio/livepeer/livepeer/models/components/RoomUserUpdatePayload.java index cfaa2ec4..4be8e553 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/RoomUserUpdatePayload.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/RoomUserUpdatePayload.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,14 +12,12 @@ import java.lang.Boolean; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.LazySingletonValue; import studio.livepeer.livepeer.utils.Utils; public class RoomUserUpdatePayload { - /** * Whether a user is allowed to publish audio/video tracks (i.e. their microphone and webcam) */ @@ -84,10 +80,11 @@ public Optional metadata() { return metadata; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Whether a user is allowed to publish audio/video tracks (i.e. their microphone and webcam) */ @@ -97,6 +94,7 @@ public RoomUserUpdatePayload withCanPublish(boolean canPublish) { return this; } + /** * Whether a user is allowed to publish audio/video tracks (i.e. their microphone and webcam) */ @@ -115,6 +113,7 @@ public RoomUserUpdatePayload withCanPublishData(boolean canPublishData) { return this; } + /** * Whether a user is allowed to publish data messages to the room */ @@ -133,6 +132,7 @@ public RoomUserUpdatePayload withMetadata(String metadata) { return this; } + /** * User defined payload to store for the participant */ @@ -141,7 +141,7 @@ public RoomUserUpdatePayload withMetadata(Optional metadata) { this.metadata = metadata; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -152,17 +152,15 @@ public boolean equals(java.lang.Object o) { } RoomUserUpdatePayload other = (RoomUserUpdatePayload) o; return - Objects.deepEquals(this.canPublish, other.canPublish) && - Objects.deepEquals(this.canPublishData, other.canPublishData) && - Objects.deepEquals(this.metadata, other.metadata); + Utils.enhancedDeepEquals(this.canPublish, other.canPublish) && + Utils.enhancedDeepEquals(this.canPublishData, other.canPublishData) && + Utils.enhancedDeepEquals(this.metadata, other.metadata); } @Override public int hashCode() { - return Objects.hash( - canPublish, - canPublishData, - metadata); + return Utils.enhancedHash( + canPublish, canPublishData, metadata); } @Override @@ -172,19 +170,21 @@ public String toString() { "canPublishData", canPublishData, "metadata", metadata); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional canPublish; - + private Optional canPublishData; - - private Optional metadata = Optional.empty(); - + + private Optional metadata = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Whether a user is allowed to publish audio/video tracks (i.e. their microphone and webcam) */ @@ -203,6 +203,7 @@ public Builder canPublish(Optional canPublish) { return this; } + /** * Whether a user is allowed to publish data messages to the room */ @@ -221,6 +222,7 @@ public Builder canPublishData(Optional canPublishData) { return this; } + /** * User defined payload to store for the participant */ @@ -238,7 +240,7 @@ public Builder metadata(Optional metadata) { this.metadata = metadata; return this; } - + public RoomUserUpdatePayload build() { if (canPublish == null) { canPublish = _SINGLETON_VALUE_CanPublish.value(); @@ -246,12 +248,12 @@ public RoomUserUpdatePayload build() { if (canPublishData == null) { canPublishData = _SINGLETON_VALUE_CanPublishData.value(); } + return new RoomUserUpdatePayload( - canPublish, - canPublishData, - metadata); + canPublish, canPublishData, metadata); } + private static final LazySingletonValue> _SINGLETON_VALUE_CanPublish = new LazySingletonValue<>( "canPublish", @@ -265,4 +267,3 @@ public RoomUserUpdatePayload build() { new TypeReference>() {}); } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Security.java b/src/main/java/studio/livepeer/livepeer/models/components/Security.java index 7183964c..ada0e33a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Security.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Security.java @@ -1,20 +1,18 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; +import studio.livepeer.livepeer.utils.HasSecurity; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; -public class Security { +public class Security implements HasSecurity { @SpeakeasyMetadata("security:scheme=true,type=http,subtype=bearer,name=Authorization") private String apiKey; @@ -31,16 +29,17 @@ public String apiKey() { return apiKey; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Security withApiKey(String apiKey) { Utils.checkNotNull(apiKey, "apiKey"); this.apiKey = apiKey; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -51,12 +50,12 @@ public boolean equals(java.lang.Object o) { } Security other = (Security) o; return - Objects.deepEquals(this.apiKey, other.apiKey); + Utils.enhancedDeepEquals(this.apiKey, other.apiKey); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( apiKey); } @@ -65,25 +64,28 @@ public String toString() { return Utils.toString(Security.class, "apiKey", apiKey); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String apiKey; - + + private String apiKey; + private Builder() { // force use of static builder() method } + public Builder apiKey(String apiKey) { Utils.checkNotNull(apiKey, "apiKey"); this.apiKey = apiKey; return this; } - + public Security build() { + return new Security( apiKey); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Session.java b/src/main/java/studio/livepeer/livepeer/models/components/Session.java index 490e556c..ab6e2764 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Session.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Session.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -17,7 +15,6 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; @@ -30,6 +27,7 @@ public class Session { private Optional id; /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -38,6 +36,7 @@ public class Session { private Optional kind; /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -45,17 +44,21 @@ public class Session { @Deprecated private Optional userId; + @JsonProperty("name") private String name; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("lastSeen") private Optional lastSeen; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("sourceSegments") private Optional sourceSegments; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("transcodedSegments") private Optional transcodedSegments; @@ -74,10 +77,12 @@ public class Session { @JsonProperty("transcodedSegmentsDuration") private Optional transcodedSegmentsDuration; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("sourceBytes") private Optional sourceBytes; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("transcodedBytes") private Optional transcodedBytes; @@ -132,8 +137,8 @@ public class Session { private Optional projectId; /** - * Whether the stream should be recorded. Uses default settings. For more customization, create and configure an object store. - * + * Whether the stream should be recorded. Uses default settings. For more customization, create and + * configure an object store. */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("record") @@ -171,7 +176,6 @@ public class Session { * Profiles to transcode the stream into. If not specified, a default * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("profiles") @@ -180,7 +184,6 @@ public class Session { /** * Configuration for recording the stream. This can only be set if * `record` is true. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("recordingSpec") @@ -267,7 +270,15 @@ public Session( public Session( String name) { - this(Optional.empty(), Optional.empty(), Optional.empty(), name, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + name, Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } @JsonIgnore @@ -276,6 +287,7 @@ public Optional id() { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -285,6 +297,7 @@ public Optional kind() { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -397,8 +410,8 @@ public Optional projectId() { } /** - * Whether the stream should be recorded. Uses default settings. For more customization, create and configure an object store. - * + * Whether the stream should be recorded. Uses default settings. For more customization, create and + * configure an object store. */ @JsonIgnore public Optional record() { @@ -442,7 +455,6 @@ public Optional playbackId() { * Profiles to transcode the stream into. If not specified, a default * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -453,7 +465,6 @@ public Optional> profiles() { /** * Configuration for recording the stream. This can only be set if * `record` is true. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -461,16 +472,18 @@ public Optional recordingSpec() { return (Optional) recordingSpec; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Session withId(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); return this; } + public Session withId(Optional id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -478,6 +491,7 @@ public Session withId(Optional id) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -487,7 +501,9 @@ public Session withKind(String kind) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -498,6 +514,7 @@ public Session withKind(Optional kind) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -507,7 +524,9 @@ public Session withUserId(String userId) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -529,6 +548,7 @@ public Session withLastSeen(double lastSeen) { return this; } + public Session withLastSeen(Optional lastSeen) { Utils.checkNotNull(lastSeen, "lastSeen"); this.lastSeen = lastSeen; @@ -541,6 +561,7 @@ public Session withSourceSegments(double sourceSegments) { return this; } + public Session withSourceSegments(Optional sourceSegments) { Utils.checkNotNull(sourceSegments, "sourceSegments"); this.sourceSegments = sourceSegments; @@ -553,6 +574,7 @@ public Session withTranscodedSegments(double transcodedSegments) { return this; } + public Session withTranscodedSegments(Optional transcodedSegments) { Utils.checkNotNull(transcodedSegments, "transcodedSegments"); this.transcodedSegments = transcodedSegments; @@ -568,6 +590,7 @@ public Session withSourceSegmentsDuration(double sourceSegmentsDuration) { return this; } + /** * Duration of all the source segments, sec */ @@ -586,6 +609,7 @@ public Session withTranscodedSegmentsDuration(double transcodedSegmentsDuration) return this; } + /** * Duration of all the transcoded segments, sec */ @@ -601,6 +625,7 @@ public Session withSourceBytes(double sourceBytes) { return this; } + public Session withSourceBytes(Optional sourceBytes) { Utils.checkNotNull(sourceBytes, "sourceBytes"); this.sourceBytes = sourceBytes; @@ -613,6 +638,7 @@ public Session withTranscodedBytes(double transcodedBytes) { return this; } + public Session withTranscodedBytes(Optional transcodedBytes) { Utils.checkNotNull(transcodedBytes, "transcodedBytes"); this.transcodedBytes = transcodedBytes; @@ -628,6 +654,7 @@ public Session withIngestRate(double ingestRate) { return this; } + /** * Rate at which sourceBytes increases (bytes/second) */ @@ -646,6 +673,7 @@ public Session withOutgoingRate(double outgoingRate) { return this; } + /** * Rate at which transcodedBytes increases (bytes/second) */ @@ -700,6 +728,7 @@ public Session withCreatedAt(double createdAt) { return this; } + /** * Timestamp (in milliseconds) at which stream object was created */ @@ -718,6 +747,7 @@ public Session withParentId(String parentId) { return this; } + /** * Points to parent stream object */ @@ -736,6 +766,7 @@ public Session withProjectId(String projectId) { return this; } + /** * The ID of the project */ @@ -746,8 +777,8 @@ public Session withProjectId(Optional projectId) { } /** - * Whether the stream should be recorded. Uses default settings. For more customization, create and configure an object store. - * + * Whether the stream should be recorded. Uses default settings. For more customization, create and + * configure an object store. */ public Session withRecord(boolean record) { Utils.checkNotNull(record, "record"); @@ -755,9 +786,10 @@ public Session withRecord(boolean record) { return this; } + /** - * Whether the stream should be recorded. Uses default settings. For more customization, create and configure an object store. - * + * Whether the stream should be recorded. Uses default settings. For more customization, create and + * configure an object store. */ public Session withRecord(Optional record) { Utils.checkNotNull(record, "record"); @@ -774,6 +806,7 @@ public Session withRecordingStatus(RecordingStatus recordingStatus) { return this; } + /** * The status of the recording process of this stream session. */ @@ -792,6 +825,7 @@ public Session withRecordingUrl(String recordingUrl) { return this; } + /** * URL for accessing the recording of this stream session. */ @@ -810,6 +844,7 @@ public Session withMp4Url(String mp4Url) { return this; } + /** * The URL for the stream session recording packaged in an MP4. */ @@ -828,6 +863,7 @@ public Session withPlaybackId(String playbackId) { return this; } + /** * The playback ID to use with the Playback Info endpoint to retrieve playback URLs. */ @@ -841,7 +877,6 @@ public Session withPlaybackId(Optional playbackId) { * Profiles to transcode the stream into. If not specified, a default * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. - * */ public Session withProfiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -849,11 +884,11 @@ public Session withProfiles(List profiles) { return this; } + /** * Profiles to transcode the stream into. If not specified, a default * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. - * */ public Session withProfiles(Optional> profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -864,7 +899,6 @@ public Session withProfiles(Optional> profiles) { /** * Configuration for recording the stream. This can only be set if * `record` is true. - * */ public Session withRecordingSpec(RecordingSpec recordingSpec) { Utils.checkNotNull(recordingSpec, "recordingSpec"); @@ -872,17 +906,17 @@ public Session withRecordingSpec(RecordingSpec recordingSpec) { return this; } + /** * Configuration for recording the stream. This can only be set if * `record` is true. - * */ public Session withRecordingSpec(Optional recordingSpec) { Utils.checkNotNull(recordingSpec, "recordingSpec"); this.recordingSpec = recordingSpec; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -893,60 +927,44 @@ public boolean equals(java.lang.Object o) { } Session other = (Session) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.kind, other.kind) && - Objects.deepEquals(this.userId, other.userId) && - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.lastSeen, other.lastSeen) && - Objects.deepEquals(this.sourceSegments, other.sourceSegments) && - Objects.deepEquals(this.transcodedSegments, other.transcodedSegments) && - Objects.deepEquals(this.sourceSegmentsDuration, other.sourceSegmentsDuration) && - Objects.deepEquals(this.transcodedSegmentsDuration, other.transcodedSegmentsDuration) && - Objects.deepEquals(this.sourceBytes, other.sourceBytes) && - Objects.deepEquals(this.transcodedBytes, other.transcodedBytes) && - Objects.deepEquals(this.ingestRate, other.ingestRate) && - Objects.deepEquals(this.outgoingRate, other.outgoingRate) && - Objects.deepEquals(this.isHealthy, other.isHealthy) && - Objects.deepEquals(this.issues, other.issues) && - Objects.deepEquals(this.createdAt, other.createdAt) && - Objects.deepEquals(this.parentId, other.parentId) && - Objects.deepEquals(this.projectId, other.projectId) && - Objects.deepEquals(this.record, other.record) && - Objects.deepEquals(this.recordingStatus, other.recordingStatus) && - Objects.deepEquals(this.recordingUrl, other.recordingUrl) && - Objects.deepEquals(this.mp4Url, other.mp4Url) && - Objects.deepEquals(this.playbackId, other.playbackId) && - Objects.deepEquals(this.profiles, other.profiles) && - Objects.deepEquals(this.recordingSpec, other.recordingSpec); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.kind, other.kind) && + Utils.enhancedDeepEquals(this.userId, other.userId) && + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.lastSeen, other.lastSeen) && + Utils.enhancedDeepEquals(this.sourceSegments, other.sourceSegments) && + Utils.enhancedDeepEquals(this.transcodedSegments, other.transcodedSegments) && + Utils.enhancedDeepEquals(this.sourceSegmentsDuration, other.sourceSegmentsDuration) && + Utils.enhancedDeepEquals(this.transcodedSegmentsDuration, other.transcodedSegmentsDuration) && + Utils.enhancedDeepEquals(this.sourceBytes, other.sourceBytes) && + Utils.enhancedDeepEquals(this.transcodedBytes, other.transcodedBytes) && + Utils.enhancedDeepEquals(this.ingestRate, other.ingestRate) && + Utils.enhancedDeepEquals(this.outgoingRate, other.outgoingRate) && + Utils.enhancedDeepEquals(this.isHealthy, other.isHealthy) && + Utils.enhancedDeepEquals(this.issues, other.issues) && + Utils.enhancedDeepEquals(this.createdAt, other.createdAt) && + Utils.enhancedDeepEquals(this.parentId, other.parentId) && + Utils.enhancedDeepEquals(this.projectId, other.projectId) && + Utils.enhancedDeepEquals(this.record, other.record) && + Utils.enhancedDeepEquals(this.recordingStatus, other.recordingStatus) && + Utils.enhancedDeepEquals(this.recordingUrl, other.recordingUrl) && + Utils.enhancedDeepEquals(this.mp4Url, other.mp4Url) && + Utils.enhancedDeepEquals(this.playbackId, other.playbackId) && + Utils.enhancedDeepEquals(this.profiles, other.profiles) && + Utils.enhancedDeepEquals(this.recordingSpec, other.recordingSpec); } @Override public int hashCode() { - return Objects.hash( - id, - kind, - userId, - name, - lastSeen, - sourceSegments, - transcodedSegments, - sourceSegmentsDuration, - transcodedSegmentsDuration, - sourceBytes, - transcodedBytes, - ingestRate, - outgoingRate, - isHealthy, - issues, - createdAt, - parentId, - projectId, - record, - recordingStatus, - recordingUrl, - mp4Url, - playbackId, - profiles, + return Utils.enhancedHash( + id, kind, userId, + name, lastSeen, sourceSegments, + transcodedSegments, sourceSegmentsDuration, transcodedSegmentsDuration, + sourceBytes, transcodedBytes, ingestRate, + outgoingRate, isHealthy, issues, + createdAt, parentId, projectId, + record, recordingStatus, recordingUrl, + mp4Url, playbackId, profiles, recordingSpec); } @@ -979,65 +997,67 @@ public String toString() { "profiles", profiles, "recordingSpec", recordingSpec); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional id = Optional.empty(); - + @Deprecated private Optional kind = Optional.empty(); - + @Deprecated private Optional userId = Optional.empty(); - + private String name; - + private Optional lastSeen = Optional.empty(); - + private Optional sourceSegments = Optional.empty(); - + private Optional transcodedSegments = Optional.empty(); - + private Optional sourceSegmentsDuration = Optional.empty(); - + private Optional transcodedSegmentsDuration = Optional.empty(); - + private Optional sourceBytes = Optional.empty(); - + private Optional transcodedBytes = Optional.empty(); - + private Optional ingestRate = Optional.empty(); - + private Optional outgoingRate = Optional.empty(); - + private JsonNullable isHealthy = JsonNullable.undefined(); - + private JsonNullable> issues = JsonNullable.undefined(); - + private Optional createdAt = Optional.empty(); - + private Optional parentId = Optional.empty(); - + private Optional projectId = Optional.empty(); - + private Optional record = Optional.empty(); - + private Optional recordingStatus = Optional.empty(); - + private Optional recordingUrl = Optional.empty(); - + private Optional mp4Url = Optional.empty(); - + private Optional playbackId = Optional.empty(); - + private Optional> profiles = Optional.empty(); - - private Optional recordingSpec = Optional.empty(); - + + private Optional recordingSpec = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); @@ -1050,7 +1070,9 @@ public Builder id(Optional id) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -1061,6 +1083,7 @@ public Builder kind(String kind) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -1070,7 +1093,9 @@ public Builder kind(Optional kind) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -1081,6 +1106,7 @@ public Builder userId(String userId) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -1090,12 +1116,14 @@ public Builder userId(Optional userId) { return this; } + public Builder name(String name) { Utils.checkNotNull(name, "name"); this.name = name; return this; } + public Builder lastSeen(double lastSeen) { Utils.checkNotNull(lastSeen, "lastSeen"); this.lastSeen = Optional.ofNullable(lastSeen); @@ -1108,6 +1136,7 @@ public Builder lastSeen(Optional lastSeen) { return this; } + public Builder sourceSegments(double sourceSegments) { Utils.checkNotNull(sourceSegments, "sourceSegments"); this.sourceSegments = Optional.ofNullable(sourceSegments); @@ -1120,6 +1149,7 @@ public Builder sourceSegments(Optional sourceSegments) { return this; } + public Builder transcodedSegments(double transcodedSegments) { Utils.checkNotNull(transcodedSegments, "transcodedSegments"); this.transcodedSegments = Optional.ofNullable(transcodedSegments); @@ -1132,6 +1162,7 @@ public Builder transcodedSegments(Optional transcodedSegments) { return this; } + /** * Duration of all the source segments, sec */ @@ -1150,6 +1181,7 @@ public Builder sourceSegmentsDuration(Optional sourceSegmentsDuration) { return this; } + /** * Duration of all the transcoded segments, sec */ @@ -1168,6 +1200,7 @@ public Builder transcodedSegmentsDuration(Optional transcodedSegmentsDur return this; } + public Builder sourceBytes(double sourceBytes) { Utils.checkNotNull(sourceBytes, "sourceBytes"); this.sourceBytes = Optional.ofNullable(sourceBytes); @@ -1180,6 +1213,7 @@ public Builder sourceBytes(Optional sourceBytes) { return this; } + public Builder transcodedBytes(double transcodedBytes) { Utils.checkNotNull(transcodedBytes, "transcodedBytes"); this.transcodedBytes = Optional.ofNullable(transcodedBytes); @@ -1192,6 +1226,7 @@ public Builder transcodedBytes(Optional transcodedBytes) { return this; } + /** * Rate at which sourceBytes increases (bytes/second) */ @@ -1210,6 +1245,7 @@ public Builder ingestRate(Optional ingestRate) { return this; } + /** * Rate at which transcodedBytes increases (bytes/second) */ @@ -1228,6 +1264,7 @@ public Builder outgoingRate(Optional outgoingRate) { return this; } + /** * Indicates whether the stream is healthy or not. */ @@ -1246,6 +1283,7 @@ public Builder isHealthy(JsonNullable isHealthy) { return this; } + /** * A string array of human-readable errors describing issues affecting the stream, if any. */ @@ -1264,6 +1302,7 @@ public Builder issues(JsonNullable> issues) { return this; } + /** * Timestamp (in milliseconds) at which stream object was created */ @@ -1282,6 +1321,7 @@ public Builder createdAt(Optional createdAt) { return this; } + /** * Points to parent stream object */ @@ -1300,6 +1340,7 @@ public Builder parentId(Optional parentId) { return this; } + /** * The ID of the project */ @@ -1318,9 +1359,10 @@ public Builder projectId(Optional projectId) { return this; } + /** - * Whether the stream should be recorded. Uses default settings. For more customization, create and configure an object store. - * + * Whether the stream should be recorded. Uses default settings. For more customization, create and + * configure an object store. */ public Builder record(boolean record) { Utils.checkNotNull(record, "record"); @@ -1329,8 +1371,8 @@ public Builder record(boolean record) { } /** - * Whether the stream should be recorded. Uses default settings. For more customization, create and configure an object store. - * + * Whether the stream should be recorded. Uses default settings. For more customization, create and + * configure an object store. */ public Builder record(Optional record) { Utils.checkNotNull(record, "record"); @@ -1338,6 +1380,7 @@ public Builder record(Optional record) { return this; } + /** * The status of the recording process of this stream session. */ @@ -1356,6 +1399,7 @@ public Builder recordingStatus(Optional recordingStat return this; } + /** * URL for accessing the recording of this stream session. */ @@ -1374,6 +1418,7 @@ public Builder recordingUrl(Optional recordingUrl) { return this; } + /** * The URL for the stream session recording packaged in an MP4. */ @@ -1392,6 +1437,7 @@ public Builder mp4Url(Optional mp4Url) { return this; } + /** * The playback ID to use with the Playback Info endpoint to retrieve playback URLs. */ @@ -1410,11 +1456,11 @@ public Builder playbackId(Optional playbackId) { return this; } + /** * Profiles to transcode the stream into. If not specified, a default * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. - * */ public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -1426,7 +1472,6 @@ public Builder profiles(List profiles) { * Profiles to transcode the stream into. If not specified, a default * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. - * */ public Builder profiles(Optional> profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -1434,10 +1479,10 @@ public Builder profiles(Optional> profiles) { return this; } + /** * Configuration for recording the stream. This can only be set if * `record` is true. - * */ public Builder recordingSpec(RecordingSpec recordingSpec) { Utils.checkNotNull(recordingSpec, "recordingSpec"); @@ -1448,42 +1493,26 @@ public Builder recordingSpec(RecordingSpec recordingSpec) { /** * Configuration for recording the stream. This can only be set if * `record` is true. - * */ public Builder recordingSpec(Optional recordingSpec) { Utils.checkNotNull(recordingSpec, "recordingSpec"); this.recordingSpec = recordingSpec; return this; } - + public Session build() { + return new Session( - id, - kind, - userId, - name, - lastSeen, - sourceSegments, - transcodedSegments, - sourceSegmentsDuration, - transcodedSegmentsDuration, - sourceBytes, - transcodedBytes, - ingestRate, - outgoingRate, - isHealthy, - issues, - createdAt, - parentId, - projectId, - record, - recordingStatus, - recordingUrl, - mp4Url, - playbackId, - profiles, + id, kind, userId, + name, lastSeen, sourceSegments, + transcodedSegments, sourceSegmentsDuration, transcodedSegmentsDuration, + sourceBytes, transcodedBytes, ingestRate, + outgoingRate, isHealthy, issues, + createdAt, parentId, projectId, + record, recordingStatus, recordingUrl, + mp4Url, playbackId, profiles, recordingSpec); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/SignatureType.java b/src/main/java/studio/livepeer/livepeer/models/components/SignatureType.java index 98759a35..67f4e5a7 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/SignatureType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/SignatureType.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum SignatureType { EIP712("eip712"), @@ -14,11 +15,21 @@ public enum SignatureType { @JsonValue private final String value; - private SignatureType(String value) { + SignatureType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (SignatureType o: SignatureType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/SigningKey.java b/src/main/java/studio/livepeer/livepeer/models/components/SigningKey.java index 002e0477..af569010 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/SigningKey.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/SigningKey.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -15,7 +13,6 @@ import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -34,6 +31,7 @@ public class SigningKey { private Optional name; /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -55,6 +53,7 @@ public class SigningKey { @JsonProperty("lastSeen") private Optional lastSeen; + @JsonProperty("publicKey") private String publicKey; @@ -102,7 +101,9 @@ public SigningKey( public SigningKey( String publicKey) { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), publicKey, Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), publicKey, + Optional.empty(), Optional.empty()); } @JsonIgnore @@ -119,6 +120,7 @@ public Optional name() { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -164,16 +166,18 @@ public Optional projectId() { return projectId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public SigningKey withId(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); return this; } + public SigningKey withId(Optional id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -189,6 +193,7 @@ public SigningKey withName(String name) { return this; } + /** * Name of the signing key */ @@ -199,6 +204,7 @@ public SigningKey withName(Optional name) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -208,7 +214,9 @@ public SigningKey withUserId(String userId) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -227,6 +235,7 @@ public SigningKey withCreatedAt(double createdAt) { return this; } + /** * Timestamp (in milliseconds) at which the signing-key was created */ @@ -245,6 +254,7 @@ public SigningKey withLastSeen(double lastSeen) { return this; } + /** * Timestamp (in milliseconds) at which the signing-key was last used */ @@ -269,6 +279,7 @@ public SigningKey withDisabled(boolean disabled) { return this; } + /** * Disable the signing key to allow rotation safely */ @@ -287,6 +298,7 @@ public SigningKey withProjectId(String projectId) { return this; } + /** * The ID of the project */ @@ -295,7 +307,7 @@ public SigningKey withProjectId(Optional projectId) { this.projectId = projectId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -306,27 +318,22 @@ public boolean equals(java.lang.Object o) { } SigningKey other = (SigningKey) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.userId, other.userId) && - Objects.deepEquals(this.createdAt, other.createdAt) && - Objects.deepEquals(this.lastSeen, other.lastSeen) && - Objects.deepEquals(this.publicKey, other.publicKey) && - Objects.deepEquals(this.disabled, other.disabled) && - Objects.deepEquals(this.projectId, other.projectId); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.userId, other.userId) && + Utils.enhancedDeepEquals(this.createdAt, other.createdAt) && + Utils.enhancedDeepEquals(this.lastSeen, other.lastSeen) && + Utils.enhancedDeepEquals(this.publicKey, other.publicKey) && + Utils.enhancedDeepEquals(this.disabled, other.disabled) && + Utils.enhancedDeepEquals(this.projectId, other.projectId); } @Override public int hashCode() { - return Objects.hash( - id, - name, - userId, - createdAt, - lastSeen, - publicKey, - disabled, - projectId); + return Utils.enhancedHash( + id, name, userId, + createdAt, lastSeen, publicKey, + disabled, projectId); } @Override @@ -341,30 +348,32 @@ public String toString() { "disabled", disabled, "projectId", projectId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional id = Optional.empty(); - + private Optional name = Optional.empty(); - + @Deprecated private Optional userId = Optional.empty(); - + private Optional createdAt = Optional.empty(); - + private Optional lastSeen = Optional.empty(); - + private String publicKey; - + private Optional disabled = Optional.empty(); - - private Optional projectId = Optional.empty(); - + + private Optional projectId = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); @@ -377,6 +386,7 @@ public Builder id(Optional id) { return this; } + /** * Name of the signing key */ @@ -395,7 +405,9 @@ public Builder name(Optional name) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -406,6 +418,7 @@ public Builder userId(String userId) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -415,6 +428,7 @@ public Builder userId(Optional userId) { return this; } + /** * Timestamp (in milliseconds) at which the signing-key was created */ @@ -433,6 +447,7 @@ public Builder createdAt(Optional createdAt) { return this; } + /** * Timestamp (in milliseconds) at which the signing-key was last used */ @@ -451,12 +466,14 @@ public Builder lastSeen(Optional lastSeen) { return this; } + public Builder publicKey(String publicKey) { Utils.checkNotNull(publicKey, "publicKey"); this.publicKey = publicKey; return this; } + /** * Disable the signing key to allow rotation safely */ @@ -475,6 +492,7 @@ public Builder disabled(Optional disabled) { return this; } + /** * The ID of the project */ @@ -492,18 +510,14 @@ public Builder projectId(Optional projectId) { this.projectId = projectId; return this; } - + public SigningKey build() { + return new SigningKey( - id, - name, - userId, - createdAt, - lastSeen, - publicKey, - disabled, - projectId); + id, name, userId, + createdAt, lastSeen, publicKey, + disabled, projectId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Source.java b/src/main/java/studio/livepeer/livepeer/models/components/Source.java index 56d92774..9f2a48af 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Source.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Source.java @@ -1,24 +1,20 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; import studio.livepeer.livepeer.utils.Utils.TypeReferenceWithShape; import studio.livepeer.livepeer.utils.Utils; - @JsonDeserialize(using = Source._Deserializer.class) public class Source { @@ -76,12 +72,12 @@ public boolean equals(java.lang.Object o) { return false; } Source other = (Source) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -89,9 +85,9 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(Source.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -102,3 +98,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Source1.java b/src/main/java/studio/livepeer/livepeer/models/components/Source1.java index c03e873b..daa05793 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Source1.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Source1.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,7 +11,6 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -36,6 +33,7 @@ public class Source1 { @JsonProperty("gatewayUrl") private Optional gatewayUrl; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("encryption") private Optional encryption; @@ -59,7 +57,8 @@ public Source1( public Source1( SourceType type, String url) { - this(type, url, Optional.empty(), Optional.empty()); + this(type, url, Optional.empty(), + Optional.empty()); } @JsonIgnore @@ -89,10 +88,11 @@ public Optional encryption() { return (Optional) encryption; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Source1 withType(SourceType type) { Utils.checkNotNull(type, "type"); this.type = type; @@ -117,6 +117,7 @@ public Source1 withGatewayUrl(String gatewayUrl) { return this; } + /** * Gateway URL from asset if parsed from provided URL on upload. */ @@ -132,12 +133,13 @@ public Source1 withEncryption(EncryptionOutput encryption) { return this; } + public Source1 withEncryption(Optional encryption) { Utils.checkNotNull(encryption, "encryption"); this.encryption = encryption; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -148,18 +150,16 @@ public boolean equals(java.lang.Object o) { } Source1 other = (Source1) o; return - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.gatewayUrl, other.gatewayUrl) && - Objects.deepEquals(this.encryption, other.encryption); + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.gatewayUrl, other.gatewayUrl) && + Utils.enhancedDeepEquals(this.encryption, other.encryption); } @Override public int hashCode() { - return Objects.hash( - type, - url, - gatewayUrl, + return Utils.enhancedHash( + type, url, gatewayUrl, encryption); } @@ -171,27 +171,30 @@ public String toString() { "gatewayUrl", gatewayUrl, "encryption", encryption); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private SourceType type; - + private String url; - + private Optional gatewayUrl = Optional.empty(); - - private Optional encryption = Optional.empty(); - + + private Optional encryption = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder type(SourceType type) { Utils.checkNotNull(type, "type"); this.type = type; return this; } + /** * URL from which the asset was uploaded. */ @@ -201,6 +204,7 @@ public Builder url(String url) { return this; } + /** * Gateway URL from asset if parsed from provided URL on upload. */ @@ -219,6 +223,7 @@ public Builder gatewayUrl(Optional gatewayUrl) { return this; } + public Builder encryption(EncryptionOutput encryption) { Utils.checkNotNull(encryption, "encryption"); this.encryption = Optional.ofNullable(encryption); @@ -230,14 +235,13 @@ public Builder encryption(Optional encryption) { this.encryption = encryption; return this; } - + public Source1 build() { + return new Source1( - type, - url, - gatewayUrl, + type, url, gatewayUrl, encryption); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Source3.java b/src/main/java/studio/livepeer/livepeer/models/components/Source3.java index 8cb3b689..9511a1b3 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Source3.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Source3.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,7 +11,6 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -23,6 +20,7 @@ public class Source3 { @JsonProperty("type") private AssetSource3Type type; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("encryption") private Optional encryption; @@ -89,7 +87,9 @@ public Source3( public Source3( AssetSource3Type type) { - this(type, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(type, Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } @JsonIgnore @@ -143,10 +143,11 @@ public Optional assetId() { return assetId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Source3 withType(AssetSource3Type type) { Utils.checkNotNull(type, "type"); this.type = type; @@ -159,6 +160,7 @@ public Source3 withEncryption(EncryptionOutput encryption) { return this; } + public Source3 withEncryption(Optional encryption) { Utils.checkNotNull(encryption, "encryption"); this.encryption = encryption; @@ -174,6 +176,7 @@ public Source3 withSourceId(String sourceId) { return this; } + /** * ID of the asset or stream from which this asset was created. */ @@ -192,6 +195,7 @@ public Source3 withSessionId(String sessionId) { return this; } + /** * ID of the session from which this asset was created. */ @@ -210,6 +214,7 @@ public Source3 withPlaybackId(String playbackId) { return this; } + /** * Playback ID of the asset or stream from which this asset was created. */ @@ -228,6 +233,7 @@ public Source3 withRequesterId(String requesterId) { return this; } + /** * ID of the requester from which this asset was created. */ @@ -246,6 +252,7 @@ public Source3 withAssetId(String assetId) { return this; } + /** * ID of the asset from which this asset was created. */ @@ -254,7 +261,7 @@ public Source3 withAssetId(Optional assetId) { this.assetId = assetId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -265,24 +272,20 @@ public boolean equals(java.lang.Object o) { } Source3 other = (Source3) o; return - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.encryption, other.encryption) && - Objects.deepEquals(this.sourceId, other.sourceId) && - Objects.deepEquals(this.sessionId, other.sessionId) && - Objects.deepEquals(this.playbackId, other.playbackId) && - Objects.deepEquals(this.requesterId, other.requesterId) && - Objects.deepEquals(this.assetId, other.assetId); + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.encryption, other.encryption) && + Utils.enhancedDeepEquals(this.sourceId, other.sourceId) && + Utils.enhancedDeepEquals(this.sessionId, other.sessionId) && + Utils.enhancedDeepEquals(this.playbackId, other.playbackId) && + Utils.enhancedDeepEquals(this.requesterId, other.requesterId) && + Utils.enhancedDeepEquals(this.assetId, other.assetId); } @Override public int hashCode() { - return Objects.hash( - type, - encryption, - sourceId, - sessionId, - playbackId, - requesterId, + return Utils.enhancedHash( + type, encryption, sourceId, + sessionId, playbackId, requesterId, assetId); } @@ -297,33 +300,36 @@ public String toString() { "requesterId", requesterId, "assetId", assetId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private AssetSource3Type type; - + private Optional encryption = Optional.empty(); - + private Optional sourceId = Optional.empty(); - + private Optional sessionId = Optional.empty(); - + private Optional playbackId = Optional.empty(); - + private Optional requesterId = Optional.empty(); - - private Optional assetId = Optional.empty(); - + + private Optional assetId = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder type(AssetSource3Type type) { Utils.checkNotNull(type, "type"); this.type = type; return this; } + public Builder encryption(EncryptionOutput encryption) { Utils.checkNotNull(encryption, "encryption"); this.encryption = Optional.ofNullable(encryption); @@ -336,6 +342,7 @@ public Builder encryption(Optional encryption) { return this; } + /** * ID of the asset or stream from which this asset was created. */ @@ -354,6 +361,7 @@ public Builder sourceId(Optional sourceId) { return this; } + /** * ID of the session from which this asset was created. */ @@ -372,6 +380,7 @@ public Builder sessionId(Optional sessionId) { return this; } + /** * Playback ID of the asset or stream from which this asset was created. */ @@ -390,6 +399,7 @@ public Builder playbackId(Optional playbackId) { return this; } + /** * ID of the requester from which this asset was created. */ @@ -408,6 +418,7 @@ public Builder requesterId(Optional requesterId) { return this; } + /** * ID of the asset from which this asset was created. */ @@ -425,17 +436,14 @@ public Builder assetId(Optional assetId) { this.assetId = assetId; return this; } - + public Source3 build() { + return new Source3( - type, - encryption, - sourceId, - sessionId, - playbackId, - requesterId, + type, encryption, sourceId, + sessionId, playbackId, requesterId, assetId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/SourceType.java b/src/main/java/studio/livepeer/livepeer/models/components/SourceType.java index 8dc55140..10f6201f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/SourceType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/SourceType.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum SourceType { URL("url"); @@ -13,11 +14,21 @@ public enum SourceType { @JsonValue private final String value; - private SourceType(String value) { + SourceType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (SourceType o: SourceType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Spec.java b/src/main/java/studio/livepeer/livepeer/models/components/Spec.java index ccfe2558..9b971831 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Spec.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Spec.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,19 +12,16 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.LazySingletonValue; import studio.livepeer.livepeer.utils.Utils; public class Spec { - /** * Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("nftMetadataTemplate") @@ -36,7 +31,6 @@ public class Spec { * Additional data to add to the NFT metadata exported to * IPFS. Will be deep merged with the default metadata * exported. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("nftMetadata") @@ -60,7 +54,6 @@ public Spec() { * Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -72,7 +65,6 @@ public Optional nftMetadataTemplate() { * Additional data to add to the NFT metadata exported to * IPFS. Will be deep merged with the default metadata * exported. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -80,15 +72,15 @@ public Optional nftMetadata() { return (Optional) nftMetadata; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ public Spec withNftMetadataTemplate(NftMetadataTemplate nftMetadataTemplate) { Utils.checkNotNull(nftMetadataTemplate, "nftMetadataTemplate"); @@ -96,11 +88,11 @@ public Spec withNftMetadataTemplate(NftMetadataTemplate nftMetadataTemplate) { return this; } + /** * Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ public Spec withNftMetadataTemplate(Optional nftMetadataTemplate) { Utils.checkNotNull(nftMetadataTemplate, "nftMetadataTemplate"); @@ -112,7 +104,6 @@ public Spec withNftMetadataTemplate(Optional nftM * Additional data to add to the NFT metadata exported to * IPFS. Will be deep merged with the default metadata * exported. - * */ public Spec withNftMetadata(NftMetadata nftMetadata) { Utils.checkNotNull(nftMetadata, "nftMetadata"); @@ -120,18 +111,18 @@ public Spec withNftMetadata(NftMetadata nftMetadata) { return this; } + /** * Additional data to add to the NFT metadata exported to * IPFS. Will be deep merged with the default metadata * exported. - * */ public Spec withNftMetadata(Optional nftMetadata) { Utils.checkNotNull(nftMetadata, "nftMetadata"); this.nftMetadata = nftMetadata; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -142,15 +133,14 @@ public boolean equals(java.lang.Object o) { } Spec other = (Spec) o; return - Objects.deepEquals(this.nftMetadataTemplate, other.nftMetadataTemplate) && - Objects.deepEquals(this.nftMetadata, other.nftMetadata); + Utils.enhancedDeepEquals(this.nftMetadataTemplate, other.nftMetadataTemplate) && + Utils.enhancedDeepEquals(this.nftMetadata, other.nftMetadata); } @Override public int hashCode() { - return Objects.hash( - nftMetadataTemplate, - nftMetadata); + return Utils.enhancedHash( + nftMetadataTemplate, nftMetadata); } @Override @@ -159,22 +149,23 @@ public String toString() { "nftMetadataTemplate", nftMetadataTemplate, "nftMetadata", nftMetadata); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional nftMetadataTemplate; - - private Optional nftMetadata = Optional.empty(); - + + private Optional nftMetadata = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ public Builder nftMetadataTemplate(NftMetadataTemplate nftMetadataTemplate) { Utils.checkNotNull(nftMetadataTemplate, "nftMetadataTemplate"); @@ -186,7 +177,6 @@ public Builder nftMetadataTemplate(NftMetadataTemplate nftMetadataTemplate) { * Name of the NFT metadata template to export. 'player' * will embed the Livepeer Player on the NFT while 'file' * will reference only the immutable MP4 files. - * */ public Builder nftMetadataTemplate(Optional nftMetadataTemplate) { Utils.checkNotNull(nftMetadataTemplate, "nftMetadataTemplate"); @@ -194,11 +184,11 @@ public Builder nftMetadataTemplate(Optional nftMe return this; } + /** * Additional data to add to the NFT metadata exported to * IPFS. Will be deep merged with the default metadata * exported. - * */ public Builder nftMetadata(NftMetadata nftMetadata) { Utils.checkNotNull(nftMetadata, "nftMetadata"); @@ -210,23 +200,23 @@ public Builder nftMetadata(NftMetadata nftMetadata) { * Additional data to add to the NFT metadata exported to * IPFS. Will be deep merged with the default metadata * exported. - * */ public Builder nftMetadata(Optional nftMetadata) { Utils.checkNotNull(nftMetadata, "nftMetadata"); this.nftMetadata = nftMetadata; return this; } - + public Spec build() { if (nftMetadataTemplate == null) { nftMetadataTemplate = _SINGLETON_VALUE_NftMetadataTemplate.value(); } + return new Spec( - nftMetadataTemplate, - nftMetadata); + nftMetadataTemplate, nftMetadata); } + private static final LazySingletonValue> _SINGLETON_VALUE_NftMetadataTemplate = new LazySingletonValue<>( "nftMetadataTemplate", @@ -234,4 +224,3 @@ public Spec build() { new TypeReference>() {}); } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Status.java b/src/main/java/studio/livepeer/livepeer/models/components/Status.java index ad571341..d660cea1 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Status.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Status.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,16 +12,15 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * Status - status of webhook + * Status + * + *

status of webhook */ - public class Status { - /** * failure timestamp and error message with status code */ @@ -34,7 +31,6 @@ public class Status { /** * Timestamp (in milliseconds) at which the webhook last was * triggered - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("lastTriggeredAt") @@ -66,17 +62,17 @@ public Optional lastFailure() { /** * Timestamp (in milliseconds) at which the webhook last was * triggered - * */ @JsonIgnore public Optional lastTriggeredAt() { return lastTriggeredAt; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * failure timestamp and error message with status code */ @@ -86,6 +82,7 @@ public Status withLastFailure(LastFailure lastFailure) { return this; } + /** * failure timestamp and error message with status code */ @@ -98,7 +95,6 @@ public Status withLastFailure(Optional lastFailure) { /** * Timestamp (in milliseconds) at which the webhook last was * triggered - * */ public Status withLastTriggeredAt(double lastTriggeredAt) { Utils.checkNotNull(lastTriggeredAt, "lastTriggeredAt"); @@ -106,17 +102,17 @@ public Status withLastTriggeredAt(double lastTriggeredAt) { return this; } + /** * Timestamp (in milliseconds) at which the webhook last was * triggered - * */ public Status withLastTriggeredAt(Optional lastTriggeredAt) { Utils.checkNotNull(lastTriggeredAt, "lastTriggeredAt"); this.lastTriggeredAt = lastTriggeredAt; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -127,15 +123,14 @@ public boolean equals(java.lang.Object o) { } Status other = (Status) o; return - Objects.deepEquals(this.lastFailure, other.lastFailure) && - Objects.deepEquals(this.lastTriggeredAt, other.lastTriggeredAt); + Utils.enhancedDeepEquals(this.lastFailure, other.lastFailure) && + Utils.enhancedDeepEquals(this.lastTriggeredAt, other.lastTriggeredAt); } @Override public int hashCode() { - return Objects.hash( - lastFailure, - lastTriggeredAt); + return Utils.enhancedHash( + lastFailure, lastTriggeredAt); } @Override @@ -144,17 +139,19 @@ public String toString() { "lastFailure", lastFailure, "lastTriggeredAt", lastTriggeredAt); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional lastFailure = Optional.empty(); - - private Optional lastTriggeredAt = Optional.empty(); - + + private Optional lastTriggeredAt = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * failure timestamp and error message with status code */ @@ -173,10 +170,10 @@ public Builder lastFailure(Optional lastFailure) { return this; } + /** * Timestamp (in milliseconds) at which the webhook last was * triggered - * */ public Builder lastTriggeredAt(double lastTriggeredAt) { Utils.checkNotNull(lastTriggeredAt, "lastTriggeredAt"); @@ -187,19 +184,18 @@ public Builder lastTriggeredAt(double lastTriggeredAt) { /** * Timestamp (in milliseconds) at which the webhook last was * triggered - * */ public Builder lastTriggeredAt(Optional lastTriggeredAt) { Utils.checkNotNull(lastTriggeredAt, "lastTriggeredAt"); this.lastTriggeredAt = lastTriggeredAt; return this; } - + public Status build() { + return new Status( - lastFailure, - lastTriggeredAt); + lastFailure, lastTriggeredAt); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Storage.java b/src/main/java/studio/livepeer/livepeer/models/components/Storage.java index 5f51c6f0..3a501ebb 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Storage.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Storage.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,18 +11,15 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; public class Storage { - /** * Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("ipfs") @@ -45,7 +40,6 @@ public Storage() { * Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -53,15 +47,15 @@ public JsonNullable ipfs() { return (JsonNullable) ipfs; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ public Storage withIpfs(Ipfs ipfs) { Utils.checkNotNull(ipfs, "ipfs"); @@ -73,14 +67,13 @@ public Storage withIpfs(Ipfs ipfs) { * Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ public Storage withIpfs(JsonNullable ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = ipfs; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -91,12 +84,12 @@ public boolean equals(java.lang.Object o) { } Storage other = (Storage) o; return - Objects.deepEquals(this.ipfs, other.ipfs); + Utils.enhancedDeepEquals(this.ipfs, other.ipfs); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( ipfs); } @@ -105,20 +98,21 @@ public String toString() { return Utils.toString(Storage.class, "ipfs", ipfs); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private JsonNullable ipfs = JsonNullable.undefined(); - + + private JsonNullable ipfs = JsonNullable.undefined(); + private Builder() { // force use of static builder() method } + /** * Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ public Builder ipfs(Ipfs ipfs) { Utils.checkNotNull(ipfs, "ipfs"); @@ -130,18 +124,18 @@ public Builder ipfs(Ipfs ipfs) { * Set to true to make default export to IPFS. To customize the * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. - * */ public Builder ipfs(JsonNullable ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = ipfs; return this; } - + public Storage build() { + return new Storage( ipfs); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Storage1.java b/src/main/java/studio/livepeer/livepeer/models/components/Storage1.java index 32998840..bf7427f4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Storage1.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Storage1.java @@ -1,24 +1,21 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * Storage1 - Storage for the output files + * Storage1 + * + *

Storage for the output files */ - public class Storage1 { - /** * Type of service used for output files */ @@ -26,7 +23,8 @@ public class Storage1 { private StorageType type; /** - * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) + * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, + * GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) */ @JsonProperty("endpoint") private String endpoint; @@ -68,7 +66,8 @@ public StorageType type() { } /** - * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) + * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, + * GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) */ @JsonIgnore public String endpoint() { @@ -91,10 +90,11 @@ public StorageCredentials credentials() { return credentials; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Type of service used for output files */ @@ -105,7 +105,8 @@ public Storage1 withType(StorageType type) { } /** - * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) + * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, + * GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) */ public Storage1 withEndpoint(String endpoint) { Utils.checkNotNull(endpoint, "endpoint"); @@ -130,7 +131,7 @@ public Storage1 withCredentials(StorageCredentials credentials) { this.credentials = credentials; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -141,18 +142,16 @@ public boolean equals(java.lang.Object o) { } Storage1 other = (Storage1) o; return - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.endpoint, other.endpoint) && - Objects.deepEquals(this.bucket, other.bucket) && - Objects.deepEquals(this.credentials, other.credentials); + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.endpoint, other.endpoint) && + Utils.enhancedDeepEquals(this.bucket, other.bucket) && + Utils.enhancedDeepEquals(this.credentials, other.credentials); } @Override public int hashCode() { - return Objects.hash( - type, - endpoint, - bucket, + return Utils.enhancedHash( + type, endpoint, bucket, credentials); } @@ -164,21 +163,23 @@ public String toString() { "bucket", bucket, "credentials", credentials); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private StorageType type; - + private String endpoint; - + private String bucket; - - private StorageCredentials credentials; - + + private StorageCredentials credentials; + private Builder() { // force use of static builder() method } + /** * Type of service used for output files */ @@ -188,8 +189,10 @@ public Builder type(StorageType type) { return this; } + /** - * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) + * Service endpoint URL (AWS S3 endpoint list: https://docs.aws.amazon.com/general/latest/gr/s3.html, + * GCP S3 endpoint: https://storage.googleapis.com, Storj: https://gateway.storjshare.io) */ public Builder endpoint(String endpoint) { Utils.checkNotNull(endpoint, "endpoint"); @@ -197,6 +200,7 @@ public Builder endpoint(String endpoint) { return this; } + /** * Bucket with output files */ @@ -206,6 +210,7 @@ public Builder bucket(String bucket) { return this; } + /** * Credentials for the output video storage */ @@ -214,14 +219,13 @@ public Builder credentials(StorageCredentials credentials) { this.credentials = credentials; return this; } - + public Storage1 build() { + return new Storage1( - type, - endpoint, - bucket, + type, endpoint, bucket, credentials); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Storage2.java b/src/main/java/studio/livepeer/livepeer/models/components/Storage2.java index 2a3c404c..20437c9c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Storage2.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Storage2.java @@ -1,24 +1,21 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * Storage2 - Storage for the output files + * Storage2 + * + *

Storage for the output files */ - public class Storage2 { - /** * Type of service used for output files */ @@ -28,7 +25,6 @@ public class Storage2 { /** * Delegation proof for Livepeer to be able to upload to * web3.storage - * */ @JsonProperty("credentials") private TranscodePayloadStorageCredentials credentials; @@ -54,17 +50,17 @@ public TranscodePayloadStorageType type() { /** * Delegation proof for Livepeer to be able to upload to * web3.storage - * */ @JsonIgnore public TranscodePayloadStorageCredentials credentials() { return credentials; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Type of service used for output files */ @@ -77,14 +73,13 @@ public Storage2 withType(TranscodePayloadStorageType type) { /** * Delegation proof for Livepeer to be able to upload to * web3.storage - * */ public Storage2 withCredentials(TranscodePayloadStorageCredentials credentials) { Utils.checkNotNull(credentials, "credentials"); this.credentials = credentials; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -95,15 +90,14 @@ public boolean equals(java.lang.Object o) { } Storage2 other = (Storage2) o; return - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.credentials, other.credentials); + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.credentials, other.credentials); } @Override public int hashCode() { - return Objects.hash( - type, - credentials); + return Utils.enhancedHash( + type, credentials); } @Override @@ -112,17 +106,19 @@ public String toString() { "type", type, "credentials", credentials); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private TranscodePayloadStorageType type; - - private TranscodePayloadStorageCredentials credentials; - + + private TranscodePayloadStorageCredentials credentials; + private Builder() { // force use of static builder() method } + /** * Type of service used for output files */ @@ -132,22 +128,22 @@ public Builder type(TranscodePayloadStorageType type) { return this; } + /** * Delegation proof for Livepeer to be able to upload to * web3.storage - * */ public Builder credentials(TranscodePayloadStorageCredentials credentials) { Utils.checkNotNull(credentials, "credentials"); this.credentials = credentials; return this; } - + public Storage2 build() { + return new Storage2( - type, - credentials); + type, credentials); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/StorageCredentials.java b/src/main/java/studio/livepeer/livepeer/models/components/StorageCredentials.java index 122cb187..3481e2d7 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/StorageCredentials.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/StorageCredentials.java @@ -1,24 +1,21 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * StorageCredentials - Credentials for the output video storage + * StorageCredentials + * + *

Credentials for the output video storage */ - public class StorageCredentials { - /** * Access Key ID */ @@ -57,10 +54,11 @@ public String secretAccessKey() { return secretAccessKey; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Access Key ID */ @@ -78,7 +76,7 @@ public StorageCredentials withSecretAccessKey(String secretAccessKey) { this.secretAccessKey = secretAccessKey; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -89,15 +87,14 @@ public boolean equals(java.lang.Object o) { } StorageCredentials other = (StorageCredentials) o; return - Objects.deepEquals(this.accessKeyId, other.accessKeyId) && - Objects.deepEquals(this.secretAccessKey, other.secretAccessKey); + Utils.enhancedDeepEquals(this.accessKeyId, other.accessKeyId) && + Utils.enhancedDeepEquals(this.secretAccessKey, other.secretAccessKey); } @Override public int hashCode() { - return Objects.hash( - accessKeyId, - secretAccessKey); + return Utils.enhancedHash( + accessKeyId, secretAccessKey); } @Override @@ -106,17 +103,19 @@ public String toString() { "accessKeyId", accessKeyId, "secretAccessKey", secretAccessKey); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String accessKeyId; - - private String secretAccessKey; - + + private String secretAccessKey; + private Builder() { // force use of static builder() method } + /** * Access Key ID */ @@ -126,6 +125,7 @@ public Builder accessKeyId(String accessKeyId) { return this; } + /** * Secret Access Key */ @@ -134,12 +134,12 @@ public Builder secretAccessKey(String secretAccessKey) { this.secretAccessKey = secretAccessKey; return this; } - + public StorageCredentials build() { + return new StorageCredentials( - accessKeyId, - secretAccessKey); + accessKeyId, secretAccessKey); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/StorageStatus.java b/src/main/java/studio/livepeer/livepeer/models/components/StorageStatus.java index aee5bc91..9a096b2f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/StorageStatus.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/StorageStatus.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,13 +11,11 @@ import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class StorageStatus { - /** * Phase of the asset storage */ @@ -40,6 +36,7 @@ public class StorageStatus { @JsonProperty("errorMessage") private Optional errorMessage; + @JsonProperty("tasks") private Tasks tasks; @@ -62,7 +59,8 @@ public StorageStatus( public StorageStatus( Phase phase, Tasks tasks) { - this(phase, Optional.empty(), Optional.empty(), tasks); + this(phase, Optional.empty(), Optional.empty(), + tasks); } /** @@ -94,10 +92,11 @@ public Tasks tasks() { return tasks; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Phase of the asset storage */ @@ -116,6 +115,7 @@ public StorageStatus withProgress(double progress) { return this; } + /** * Current progress of the task updating the storage. */ @@ -134,6 +134,7 @@ public StorageStatus withErrorMessage(String errorMessage) { return this; } + /** * Error message if the last storage changed failed. */ @@ -148,7 +149,7 @@ public StorageStatus withTasks(Tasks tasks) { this.tasks = tasks; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -159,18 +160,16 @@ public boolean equals(java.lang.Object o) { } StorageStatus other = (StorageStatus) o; return - Objects.deepEquals(this.phase, other.phase) && - Objects.deepEquals(this.progress, other.progress) && - Objects.deepEquals(this.errorMessage, other.errorMessage) && - Objects.deepEquals(this.tasks, other.tasks); + Utils.enhancedDeepEquals(this.phase, other.phase) && + Utils.enhancedDeepEquals(this.progress, other.progress) && + Utils.enhancedDeepEquals(this.errorMessage, other.errorMessage) && + Utils.enhancedDeepEquals(this.tasks, other.tasks); } @Override public int hashCode() { - return Objects.hash( - phase, - progress, - errorMessage, + return Utils.enhancedHash( + phase, progress, errorMessage, tasks); } @@ -182,21 +181,23 @@ public String toString() { "errorMessage", errorMessage, "tasks", tasks); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Phase phase; - + private Optional progress = Optional.empty(); - + private Optional errorMessage = Optional.empty(); - - private Tasks tasks; - + + private Tasks tasks; + private Builder() { // force use of static builder() method } + /** * Phase of the asset storage */ @@ -206,6 +207,7 @@ public Builder phase(Phase phase) { return this; } + /** * Current progress of the task updating the storage. */ @@ -224,6 +226,7 @@ public Builder progress(Optional progress) { return this; } + /** * Error message if the last storage changed failed. */ @@ -242,19 +245,19 @@ public Builder errorMessage(Optional errorMessage) { return this; } + public Builder tasks(Tasks tasks) { Utils.checkNotNull(tasks, "tasks"); this.tasks = tasks; return this; } - + public StorageStatus build() { + return new StorageStatus( - phase, - progress, - errorMessage, + phase, progress, errorMessage, tasks); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/StorageType.java b/src/main/java/studio/livepeer/livepeer/models/components/StorageType.java index ebd256ea..620b8a8f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/StorageType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/StorageType.java @@ -1,14 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * StorageType - Type of service used for output files + * StorageType + * + *

Type of service used for output files */ public enum StorageType { S3("s3"); @@ -16,11 +19,21 @@ public enum StorageType { @JsonValue private final String value; - private StorageType(String value) { + StorageType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (StorageType o: StorageType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Stream.java b/src/main/java/studio/livepeer/livepeer/models/components/Stream.java index a237dda5..9eb30fc7 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Stream.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Stream.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -18,7 +16,6 @@ import java.lang.SuppressWarnings; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; @@ -30,10 +27,12 @@ public class Stream { @JsonProperty("id") private Optional id; + @JsonProperty("name") private String name; /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -41,6 +40,7 @@ public class Stream { @Deprecated private Optional kind; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("creatorId") private Optional creatorId; @@ -52,14 +52,17 @@ public class Stream { @JsonProperty("userTags") private Optional> userTags; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("lastSeen") private Optional lastSeen; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("sourceSegments") private Optional sourceSegments; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("transcodedSegments") private Optional transcodedSegments; @@ -78,10 +81,12 @@ public class Stream { @JsonProperty("transcodedSegmentsDuration") private Optional transcodedSegmentsDuration; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("sourceBytes") private Optional sourceBytes; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("transcodedBytes") private Optional transcodedBytes; @@ -176,7 +181,6 @@ public class Stream { * Profiles to transcode the stream into. If not specified, a default * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("profiles") @@ -192,7 +196,6 @@ public class Stream { /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("record") @@ -201,12 +204,12 @@ public class Stream { /** * Configuration for recording the stream. This can only be set if * `record` is true. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("recordingSpec") private Optional recordingSpec; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("multistream") private Optional multistream; @@ -226,6 +229,7 @@ public class Stream { private JsonNullable lastTerminatedAt; /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -233,6 +237,7 @@ public class Stream { @Deprecated private Optional userId; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("renditions") private Optional renditions; @@ -342,7 +347,17 @@ public Stream( public Stream( String name) { - this(Optional.empty(), name, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), JsonNullable.undefined(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), JsonNullable.undefined(), Optional.empty(), Optional.empty()); + this(Optional.empty(), name, Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + JsonNullable.undefined(), JsonNullable.undefined(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), JsonNullable.undefined(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + JsonNullable.undefined(), Optional.empty(), Optional.empty()); } @JsonIgnore @@ -356,6 +371,7 @@ public String name() { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -525,7 +541,6 @@ public JsonNullable playbackPolicy() { * Profiles to transcode the stream into. If not specified, a default * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -544,7 +559,6 @@ public Optional projectId() { /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ @JsonIgnore public Optional record() { @@ -554,7 +568,6 @@ public Optional record() { /** * Configuration for recording the stream. This can only be set if * `record` is true. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -585,6 +598,7 @@ public JsonNullable lastTerminatedAt() { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -599,16 +613,18 @@ public Optional renditions() { return (Optional) renditions; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Stream withId(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); return this; } + public Stream withId(Optional id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -622,6 +638,7 @@ public Stream withName(String name) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -631,7 +648,9 @@ public Stream withKind(String kind) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -647,6 +666,7 @@ public Stream withCreatorId(CreatorId creatorId) { return this; } + public Stream withCreatorId(Optional creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = creatorId; @@ -662,6 +682,7 @@ public Stream withUserTags(Map userTags) { return this; } + /** * User input tags associated with the stream */ @@ -677,6 +698,7 @@ public Stream withLastSeen(double lastSeen) { return this; } + public Stream withLastSeen(Optional lastSeen) { Utils.checkNotNull(lastSeen, "lastSeen"); this.lastSeen = lastSeen; @@ -689,6 +711,7 @@ public Stream withSourceSegments(double sourceSegments) { return this; } + public Stream withSourceSegments(Optional sourceSegments) { Utils.checkNotNull(sourceSegments, "sourceSegments"); this.sourceSegments = sourceSegments; @@ -701,6 +724,7 @@ public Stream withTranscodedSegments(double transcodedSegments) { return this; } + public Stream withTranscodedSegments(Optional transcodedSegments) { Utils.checkNotNull(transcodedSegments, "transcodedSegments"); this.transcodedSegments = transcodedSegments; @@ -716,6 +740,7 @@ public Stream withSourceSegmentsDuration(double sourceSegmentsDuration) { return this; } + /** * Duration of all the source segments, sec */ @@ -734,6 +759,7 @@ public Stream withTranscodedSegmentsDuration(double transcodedSegmentsDuration) return this; } + /** * Duration of all the transcoded segments, sec */ @@ -749,6 +775,7 @@ public Stream withSourceBytes(double sourceBytes) { return this; } + public Stream withSourceBytes(Optional sourceBytes) { Utils.checkNotNull(sourceBytes, "sourceBytes"); this.sourceBytes = sourceBytes; @@ -761,6 +788,7 @@ public Stream withTranscodedBytes(double transcodedBytes) { return this; } + public Stream withTranscodedBytes(Optional transcodedBytes) { Utils.checkNotNull(transcodedBytes, "transcodedBytes"); this.transcodedBytes = transcodedBytes; @@ -776,6 +804,7 @@ public Stream withIngestRate(double ingestRate) { return this; } + /** * Rate at which sourceBytes increases (bytes/second) */ @@ -794,6 +823,7 @@ public Stream withOutgoingRate(double outgoingRate) { return this; } + /** * Rate at which transcodedBytes increases (bytes/second) */ @@ -812,6 +842,7 @@ public Stream withIsActive(boolean isActive) { return this; } + /** * If currently active */ @@ -866,6 +897,7 @@ public Stream withCreatedByTokenName(String createdByTokenName) { return this; } + /** * Name of the token used to create this object */ @@ -884,6 +916,7 @@ public Stream withCreatedAt(double createdAt) { return this; } + /** * Timestamp (in milliseconds) at which stream object was created */ @@ -902,6 +935,7 @@ public Stream withParentId(String parentId) { return this; } + /** * Points to parent stream object */ @@ -920,6 +954,7 @@ public Stream withStreamKey(String streamKey) { return this; } + /** * Used to form RTMP ingest URL */ @@ -940,6 +975,7 @@ public Stream withPull(StreamPull pull) { return this; } + /** * Configuration for a stream that should be actively pulled from an * external source, rather than pushed to Livepeer. If specified, the @@ -960,6 +996,7 @@ public Stream withPlaybackId(String playbackId) { return this; } + /** * The playback ID to use with the Playback Info endpoint to retrieve playback URLs. */ @@ -991,7 +1028,6 @@ public Stream withPlaybackPolicy(JsonNullable playback * Profiles to transcode the stream into. If not specified, a default * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. - * */ public Stream withProfiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -999,11 +1035,11 @@ public Stream withProfiles(List profiles) { return this; } + /** * Profiles to transcode the stream into. If not specified, a default * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. - * */ public Stream withProfiles(Optional> profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -1020,6 +1056,7 @@ public Stream withProjectId(String projectId) { return this; } + /** * The ID of the project */ @@ -1032,7 +1069,6 @@ public Stream withProjectId(Optional projectId) { /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ public Stream withRecord(boolean record) { Utils.checkNotNull(record, "record"); @@ -1040,10 +1076,10 @@ public Stream withRecord(boolean record) { return this; } + /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ public Stream withRecord(Optional record) { Utils.checkNotNull(record, "record"); @@ -1054,7 +1090,6 @@ public Stream withRecord(Optional record) { /** * Configuration for recording the stream. This can only be set if * `record` is true. - * */ public Stream withRecordingSpec(StreamRecordingSpec recordingSpec) { Utils.checkNotNull(recordingSpec, "recordingSpec"); @@ -1062,10 +1097,10 @@ public Stream withRecordingSpec(StreamRecordingSpec recordingSpec) { return this; } + /** * Configuration for recording the stream. This can only be set if * `record` is true. - * */ public Stream withRecordingSpec(Optional recordingSpec) { Utils.checkNotNull(recordingSpec, "recordingSpec"); @@ -1079,6 +1114,7 @@ public Stream withMultistream(StreamMultistream multistream) { return this; } + public Stream withMultistream(Optional multistream) { Utils.checkNotNull(multistream, "multistream"); this.multistream = multistream; @@ -1094,6 +1130,7 @@ public Stream withSuspended(boolean suspended) { return this; } + /** * If currently suspended */ @@ -1122,6 +1159,7 @@ public Stream withLastTerminatedAt(JsonNullable lastTerminatedAt) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -1131,7 +1169,9 @@ public Stream withUserId(String userId) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -1147,12 +1187,13 @@ public Stream withRenditions(Renditions renditions) { return this; } + public Stream withRenditions(Optional renditions) { Utils.checkNotNull(renditions, "renditions"); this.renditions = renditions; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -1163,77 +1204,55 @@ public boolean equals(java.lang.Object o) { } Stream other = (Stream) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.kind, other.kind) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.userTags, other.userTags) && - Objects.deepEquals(this.lastSeen, other.lastSeen) && - Objects.deepEquals(this.sourceSegments, other.sourceSegments) && - Objects.deepEquals(this.transcodedSegments, other.transcodedSegments) && - Objects.deepEquals(this.sourceSegmentsDuration, other.sourceSegmentsDuration) && - Objects.deepEquals(this.transcodedSegmentsDuration, other.transcodedSegmentsDuration) && - Objects.deepEquals(this.sourceBytes, other.sourceBytes) && - Objects.deepEquals(this.transcodedBytes, other.transcodedBytes) && - Objects.deepEquals(this.ingestRate, other.ingestRate) && - Objects.deepEquals(this.outgoingRate, other.outgoingRate) && - Objects.deepEquals(this.isActive, other.isActive) && - Objects.deepEquals(this.isHealthy, other.isHealthy) && - Objects.deepEquals(this.issues, other.issues) && - Objects.deepEquals(this.createdByTokenName, other.createdByTokenName) && - Objects.deepEquals(this.createdAt, other.createdAt) && - Objects.deepEquals(this.parentId, other.parentId) && - Objects.deepEquals(this.streamKey, other.streamKey) && - Objects.deepEquals(this.pull, other.pull) && - Objects.deepEquals(this.playbackId, other.playbackId) && - Objects.deepEquals(this.playbackPolicy, other.playbackPolicy) && - Objects.deepEquals(this.profiles, other.profiles) && - Objects.deepEquals(this.projectId, other.projectId) && - Objects.deepEquals(this.record, other.record) && - Objects.deepEquals(this.recordingSpec, other.recordingSpec) && - Objects.deepEquals(this.multistream, other.multistream) && - Objects.deepEquals(this.suspended, other.suspended) && - Objects.deepEquals(this.lastTerminatedAt, other.lastTerminatedAt) && - Objects.deepEquals(this.userId, other.userId) && - Objects.deepEquals(this.renditions, other.renditions); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.kind, other.kind) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.userTags, other.userTags) && + Utils.enhancedDeepEquals(this.lastSeen, other.lastSeen) && + Utils.enhancedDeepEquals(this.sourceSegments, other.sourceSegments) && + Utils.enhancedDeepEquals(this.transcodedSegments, other.transcodedSegments) && + Utils.enhancedDeepEquals(this.sourceSegmentsDuration, other.sourceSegmentsDuration) && + Utils.enhancedDeepEquals(this.transcodedSegmentsDuration, other.transcodedSegmentsDuration) && + Utils.enhancedDeepEquals(this.sourceBytes, other.sourceBytes) && + Utils.enhancedDeepEquals(this.transcodedBytes, other.transcodedBytes) && + Utils.enhancedDeepEquals(this.ingestRate, other.ingestRate) && + Utils.enhancedDeepEquals(this.outgoingRate, other.outgoingRate) && + Utils.enhancedDeepEquals(this.isActive, other.isActive) && + Utils.enhancedDeepEquals(this.isHealthy, other.isHealthy) && + Utils.enhancedDeepEquals(this.issues, other.issues) && + Utils.enhancedDeepEquals(this.createdByTokenName, other.createdByTokenName) && + Utils.enhancedDeepEquals(this.createdAt, other.createdAt) && + Utils.enhancedDeepEquals(this.parentId, other.parentId) && + Utils.enhancedDeepEquals(this.streamKey, other.streamKey) && + Utils.enhancedDeepEquals(this.pull, other.pull) && + Utils.enhancedDeepEquals(this.playbackId, other.playbackId) && + Utils.enhancedDeepEquals(this.playbackPolicy, other.playbackPolicy) && + Utils.enhancedDeepEquals(this.profiles, other.profiles) && + Utils.enhancedDeepEquals(this.projectId, other.projectId) && + Utils.enhancedDeepEquals(this.record, other.record) && + Utils.enhancedDeepEquals(this.recordingSpec, other.recordingSpec) && + Utils.enhancedDeepEquals(this.multistream, other.multistream) && + Utils.enhancedDeepEquals(this.suspended, other.suspended) && + Utils.enhancedDeepEquals(this.lastTerminatedAt, other.lastTerminatedAt) && + Utils.enhancedDeepEquals(this.userId, other.userId) && + Utils.enhancedDeepEquals(this.renditions, other.renditions); } @Override public int hashCode() { - return Objects.hash( - id, - name, - kind, - creatorId, - userTags, - lastSeen, - sourceSegments, - transcodedSegments, - sourceSegmentsDuration, - transcodedSegmentsDuration, - sourceBytes, - transcodedBytes, - ingestRate, - outgoingRate, - isActive, - isHealthy, - issues, - createdByTokenName, - createdAt, - parentId, - streamKey, - pull, - playbackId, - playbackPolicy, - profiles, - projectId, - record, - recordingSpec, - multistream, - suspended, - lastTerminatedAt, - userId, - renditions); + return Utils.enhancedHash( + id, name, kind, + creatorId, userTags, lastSeen, + sourceSegments, transcodedSegments, sourceSegmentsDuration, + transcodedSegmentsDuration, sourceBytes, transcodedBytes, + ingestRate, outgoingRate, isActive, + isHealthy, issues, createdByTokenName, + createdAt, parentId, streamKey, + pull, playbackId, playbackPolicy, + profiles, projectId, record, + recordingSpec, multistream, suspended, + lastTerminatedAt, userId, renditions); } @Override @@ -1273,81 +1292,83 @@ public String toString() { "userId", userId, "renditions", renditions); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional id = Optional.empty(); - + private String name; - + @Deprecated private Optional kind = Optional.empty(); - + private Optional creatorId = Optional.empty(); - + private Optional> userTags = Optional.empty(); - + private Optional lastSeen = Optional.empty(); - + private Optional sourceSegments = Optional.empty(); - + private Optional transcodedSegments = Optional.empty(); - + private Optional sourceSegmentsDuration = Optional.empty(); - + private Optional transcodedSegmentsDuration = Optional.empty(); - + private Optional sourceBytes = Optional.empty(); - + private Optional transcodedBytes = Optional.empty(); - + private Optional ingestRate = Optional.empty(); - + private Optional outgoingRate = Optional.empty(); - + private Optional isActive = Optional.empty(); - + private JsonNullable isHealthy = JsonNullable.undefined(); - + private JsonNullable> issues = JsonNullable.undefined(); - + private Optional createdByTokenName = Optional.empty(); - + private Optional createdAt = Optional.empty(); - + private Optional parentId = Optional.empty(); - + private Optional streamKey = Optional.empty(); - + private Optional pull = Optional.empty(); - + private Optional playbackId = Optional.empty(); - + private JsonNullable playbackPolicy = JsonNullable.undefined(); - + private Optional> profiles = Optional.empty(); - + private Optional projectId = Optional.empty(); - + private Optional record = Optional.empty(); - + private Optional recordingSpec = Optional.empty(); - + private Optional multistream = Optional.empty(); - + private Optional suspended = Optional.empty(); - + private JsonNullable lastTerminatedAt = JsonNullable.undefined(); - + @Deprecated private Optional userId = Optional.empty(); - - private Optional renditions = Optional.empty(); - + + private Optional renditions = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); @@ -1360,13 +1381,16 @@ public Builder id(Optional id) { return this; } + public Builder name(String name) { Utils.checkNotNull(name, "name"); this.name = name; return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -1377,6 +1401,7 @@ public Builder kind(String kind) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -1386,6 +1411,7 @@ public Builder kind(Optional kind) { return this; } + public Builder creatorId(CreatorId creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = Optional.ofNullable(creatorId); @@ -1398,6 +1424,7 @@ public Builder creatorId(Optional creatorId) { return this; } + /** * User input tags associated with the stream */ @@ -1416,6 +1443,7 @@ public Builder userTags(Optional> userTags return this; } + public Builder lastSeen(double lastSeen) { Utils.checkNotNull(lastSeen, "lastSeen"); this.lastSeen = Optional.ofNullable(lastSeen); @@ -1428,6 +1456,7 @@ public Builder lastSeen(Optional lastSeen) { return this; } + public Builder sourceSegments(double sourceSegments) { Utils.checkNotNull(sourceSegments, "sourceSegments"); this.sourceSegments = Optional.ofNullable(sourceSegments); @@ -1440,6 +1469,7 @@ public Builder sourceSegments(Optional sourceSegments) { return this; } + public Builder transcodedSegments(double transcodedSegments) { Utils.checkNotNull(transcodedSegments, "transcodedSegments"); this.transcodedSegments = Optional.ofNullable(transcodedSegments); @@ -1452,6 +1482,7 @@ public Builder transcodedSegments(Optional transcodedSegments) { return this; } + /** * Duration of all the source segments, sec */ @@ -1470,6 +1501,7 @@ public Builder sourceSegmentsDuration(Optional sourceSegmentsDuration) { return this; } + /** * Duration of all the transcoded segments, sec */ @@ -1488,6 +1520,7 @@ public Builder transcodedSegmentsDuration(Optional transcodedSegmentsDur return this; } + public Builder sourceBytes(double sourceBytes) { Utils.checkNotNull(sourceBytes, "sourceBytes"); this.sourceBytes = Optional.ofNullable(sourceBytes); @@ -1500,6 +1533,7 @@ public Builder sourceBytes(Optional sourceBytes) { return this; } + public Builder transcodedBytes(double transcodedBytes) { Utils.checkNotNull(transcodedBytes, "transcodedBytes"); this.transcodedBytes = Optional.ofNullable(transcodedBytes); @@ -1512,6 +1546,7 @@ public Builder transcodedBytes(Optional transcodedBytes) { return this; } + /** * Rate at which sourceBytes increases (bytes/second) */ @@ -1530,6 +1565,7 @@ public Builder ingestRate(Optional ingestRate) { return this; } + /** * Rate at which transcodedBytes increases (bytes/second) */ @@ -1548,6 +1584,7 @@ public Builder outgoingRate(Optional outgoingRate) { return this; } + /** * If currently active */ @@ -1566,6 +1603,7 @@ public Builder isActive(Optional isActive) { return this; } + /** * Indicates whether the stream is healthy or not. */ @@ -1584,6 +1622,7 @@ public Builder isHealthy(JsonNullable isHealthy) { return this; } + /** * A string array of human-readable errors describing issues affecting the stream, if any. */ @@ -1602,6 +1641,7 @@ public Builder issues(JsonNullable> issues) { return this; } + /** * Name of the token used to create this object */ @@ -1620,6 +1660,7 @@ public Builder createdByTokenName(Optional createdByTokenName) { return this; } + /** * Timestamp (in milliseconds) at which stream object was created */ @@ -1638,6 +1679,7 @@ public Builder createdAt(Optional createdAt) { return this; } + /** * Points to parent stream object */ @@ -1656,6 +1698,7 @@ public Builder parentId(Optional parentId) { return this; } + /** * Used to form RTMP ingest URL */ @@ -1674,6 +1717,7 @@ public Builder streamKey(Optional streamKey) { return this; } + /** * Configuration for a stream that should be actively pulled from an * external source, rather than pushed to Livepeer. If specified, the @@ -1696,6 +1740,7 @@ public Builder pull(Optional pull) { return this; } + /** * The playback ID to use with the Playback Info endpoint to retrieve playback URLs. */ @@ -1714,6 +1759,7 @@ public Builder playbackId(Optional playbackId) { return this; } + /** * Whether the playback policy for an asset or stream is public or signed */ @@ -1732,11 +1778,11 @@ public Builder playbackPolicy(JsonNullable playbackPol return this; } + /** * Profiles to transcode the stream into. If not specified, a default * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. - * */ public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -1748,7 +1794,6 @@ public Builder profiles(List profiles) { * Profiles to transcode the stream into. If not specified, a default * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. - * */ public Builder profiles(Optional> profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -1756,6 +1801,7 @@ public Builder profiles(Optional> profiles) { return this; } + /** * The ID of the project */ @@ -1774,10 +1820,10 @@ public Builder projectId(Optional projectId) { return this; } + /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ public Builder record(boolean record) { Utils.checkNotNull(record, "record"); @@ -1788,7 +1834,6 @@ public Builder record(boolean record) { /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ public Builder record(Optional record) { Utils.checkNotNull(record, "record"); @@ -1796,10 +1841,10 @@ public Builder record(Optional record) { return this; } + /** * Configuration for recording the stream. This can only be set if * `record` is true. - * */ public Builder recordingSpec(StreamRecordingSpec recordingSpec) { Utils.checkNotNull(recordingSpec, "recordingSpec"); @@ -1810,7 +1855,6 @@ public Builder recordingSpec(StreamRecordingSpec recordingSpec) { /** * Configuration for recording the stream. This can only be set if * `record` is true. - * */ public Builder recordingSpec(Optional recordingSpec) { Utils.checkNotNull(recordingSpec, "recordingSpec"); @@ -1818,6 +1862,7 @@ public Builder recordingSpec(Optional recordingSp return this; } + public Builder multistream(StreamMultistream multistream) { Utils.checkNotNull(multistream, "multistream"); this.multistream = Optional.ofNullable(multistream); @@ -1830,6 +1875,7 @@ public Builder multistream(Optional multistream) { return this; } + /** * If currently suspended */ @@ -1848,6 +1894,7 @@ public Builder suspended(Optional suspended) { return this; } + /** * Timestamp (in milliseconds) when the stream was last terminated */ @@ -1866,7 +1913,9 @@ public Builder lastTerminatedAt(JsonNullable lastTerminatedAt) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -1877,6 +1926,7 @@ public Builder userId(String userId) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -1886,6 +1936,7 @@ public Builder userId(Optional userId) { return this; } + public Builder renditions(Renditions renditions) { Utils.checkNotNull(renditions, "renditions"); this.renditions = Optional.ofNullable(renditions); @@ -1897,43 +1948,22 @@ public Builder renditions(Optional renditions) { this.renditions = renditions; return this; } - + public Stream build() { + return new Stream( - id, - name, - kind, - creatorId, - userTags, - lastSeen, - sourceSegments, - transcodedSegments, - sourceSegmentsDuration, - transcodedSegmentsDuration, - sourceBytes, - transcodedBytes, - ingestRate, - outgoingRate, - isActive, - isHealthy, - issues, - createdByTokenName, - createdAt, - parentId, - streamKey, - pull, - playbackId, - playbackPolicy, - profiles, - projectId, - record, - recordingSpec, - multistream, - suspended, - lastTerminatedAt, - userId, - renditions); + id, name, kind, + creatorId, userTags, lastSeen, + sourceSegments, transcodedSegments, sourceSegmentsDuration, + transcodedSegmentsDuration, sourceBytes, transcodedBytes, + ingestRate, outgoingRate, isActive, + isHealthy, issues, createdByTokenName, + createdAt, parentId, streamKey, + pull, playbackId, playbackPolicy, + profiles, projectId, record, + recordingSpec, multistream, suspended, + lastTerminatedAt, userId, renditions); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/StreamIsMobile.java b/src/main/java/studio/livepeer/livepeer/models/components/StreamIsMobile.java index 492e4c0c..8cc733a9 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/StreamIsMobile.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/StreamIsMobile.java @@ -1,17 +1,15 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Boolean; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; @@ -19,9 +17,10 @@ import studio.livepeer.livepeer.utils.Utils; /** - * StreamIsMobile - Indicates whether the stream will be pulled from a mobile source. + * StreamIsMobile + * + *

Indicates whether the stream will be pulled from a mobile source. */ - @JsonDeserialize(using = StreamIsMobile._Deserializer.class) public class StreamIsMobile { @@ -73,12 +72,12 @@ public boolean equals(java.lang.Object o) { return false; } StreamIsMobile other = (StreamIsMobile) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -86,8 +85,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -98,3 +97,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/StreamLocation.java b/src/main/java/studio/livepeer/livepeer/models/components/StreamLocation.java index e3764117..bfe779a4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/StreamLocation.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/StreamLocation.java @@ -1,26 +1,23 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * StreamLocation - Approximate location of the pull source. The location is used to + * StreamLocation + * + *

Approximate location of the pull source. The location is used to * determine the closest Livepeer region to pull the stream from. */ - public class StreamLocation { - /** * Latitude of the pull source in degrees. North is positive, * south is negative. @@ -63,10 +60,11 @@ public double lon() { return lon; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Latitude of the pull source in degrees. North is positive, * south is negative. @@ -86,7 +84,7 @@ public StreamLocation withLon(double lon) { this.lon = lon; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -97,15 +95,14 @@ public boolean equals(java.lang.Object o) { } StreamLocation other = (StreamLocation) o; return - Objects.deepEquals(this.lat, other.lat) && - Objects.deepEquals(this.lon, other.lon); + Utils.enhancedDeepEquals(this.lat, other.lat) && + Utils.enhancedDeepEquals(this.lon, other.lon); } @Override public int hashCode() { - return Objects.hash( - lat, - lon); + return Utils.enhancedHash( + lat, lon); } @Override @@ -114,17 +111,19 @@ public String toString() { "lat", lat, "lon", lon); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Double lat; - - private Double lon; - + + private Double lon; + private Builder() { // force use of static builder() method } + /** * Latitude of the pull source in degrees. North is positive, * south is negative. @@ -135,6 +134,7 @@ public Builder lat(double lat) { return this; } + /** * Longitude of the pull source in degrees. East is positive, * west is negative. @@ -144,12 +144,12 @@ public Builder lon(double lon) { this.lon = lon; return this; } - + public StreamLocation build() { + return new StreamLocation( - lat, - lon); + lat, lon); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/StreamMultistream.java b/src/main/java/studio/livepeer/livepeer/models/components/StreamMultistream.java index 417d92e4..c34380da 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/StreamMultistream.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/StreamMultistream.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,17 +12,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class StreamMultistream { - /** * References to targets where this stream will be simultaneously * streamed to - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("targets") @@ -44,7 +39,6 @@ public StreamMultistream() { /** * References to targets where this stream will be simultaneously * streamed to - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -52,14 +46,14 @@ public Optional> targets() { return (Optional>) targets; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * References to targets where this stream will be simultaneously * streamed to - * */ public StreamMultistream withTargets(List targets) { Utils.checkNotNull(targets, "targets"); @@ -67,17 +61,17 @@ public StreamMultistream withTargets(List targets) { return this; } + /** * References to targets where this stream will be simultaneously * streamed to - * */ public StreamMultistream withTargets(Optional> targets) { Utils.checkNotNull(targets, "targets"); this.targets = targets; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -88,12 +82,12 @@ public boolean equals(java.lang.Object o) { } StreamMultistream other = (StreamMultistream) o; return - Objects.deepEquals(this.targets, other.targets); + Utils.enhancedDeepEquals(this.targets, other.targets); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( targets); } @@ -102,19 +96,20 @@ public String toString() { return Utils.toString(StreamMultistream.class, "targets", targets); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional> targets = Optional.empty(); - + + private Optional> targets = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * References to targets where this stream will be simultaneously * streamed to - * */ public Builder targets(List targets) { Utils.checkNotNull(targets, "targets"); @@ -125,18 +120,18 @@ public Builder targets(List targets) { /** * References to targets where this stream will be simultaneously * streamed to - * */ public Builder targets(Optional> targets) { Utils.checkNotNull(targets, "targets"); this.targets = targets; return this; } - + public StreamMultistream build() { + return new StreamMultistream( targets); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/StreamPatchPayload.java b/src/main/java/studio/livepeer/livepeer/models/components/StreamPatchPayload.java index ea3da9fa..98a14cc0 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/StreamPatchPayload.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/StreamPatchPayload.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -16,7 +14,6 @@ import java.lang.SuppressWarnings; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Optional; import org.openapitools.jackson.nullable.JsonNullable; import studio.livepeer.livepeer.utils.Utils; @@ -31,7 +28,6 @@ public class StreamPatchPayload { /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("record") @@ -44,6 +40,7 @@ public class StreamPatchPayload { @JsonProperty("suspended") private Optional suspended; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("multistream") private Optional multistream; @@ -55,10 +52,12 @@ public class StreamPatchPayload { @JsonProperty("playbackPolicy") private JsonNullable playbackPolicy; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("profiles") private JsonNullable> profiles; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("recordingSpec") private Optional recordingSpec; @@ -70,6 +69,11 @@ public class StreamPatchPayload { @JsonProperty("userTags") private Optional> userTags; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("name") + private Optional name; + @JsonCreator public StreamPatchPayload( @JsonProperty("creatorId") Optional creatorId, @@ -79,7 +83,8 @@ public StreamPatchPayload( @JsonProperty("playbackPolicy") JsonNullable playbackPolicy, @JsonProperty("profiles") JsonNullable> profiles, @JsonProperty("recordingSpec") Optional recordingSpec, - @JsonProperty("userTags") Optional> userTags) { + @JsonProperty("userTags") Optional> userTags, + @JsonProperty("name") Optional name) { Utils.checkNotNull(creatorId, "creatorId"); Utils.checkNotNull(record, "record"); Utils.checkNotNull(suspended, "suspended"); @@ -88,6 +93,7 @@ public StreamPatchPayload( Utils.checkNotNull(profiles, "profiles"); Utils.checkNotNull(recordingSpec, "recordingSpec"); Utils.checkNotNull(userTags, "userTags"); + Utils.checkNotNull(name, "name"); this.creatorId = creatorId; this.record = record; this.suspended = suspended; @@ -96,10 +102,13 @@ public StreamPatchPayload( this.profiles = profiles; this.recordingSpec = recordingSpec; this.userTags = userTags; + this.name = name; } public StreamPatchPayload() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined(), + Optional.empty(), Optional.empty(), Optional.empty()); } @SuppressWarnings("unchecked") @@ -111,7 +120,6 @@ public Optional creatorId() { /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ @JsonIgnore public Optional record() { @@ -162,16 +170,23 @@ public Optional> userTags() { return (Optional>) userTags; } - public final static Builder builder() { + @JsonIgnore + public Optional name() { + return name; + } + + public static Builder builder() { return new Builder(); } + public StreamPatchPayload withCreatorId(InputCreatorId creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = Optional.ofNullable(creatorId); return this; } + public StreamPatchPayload withCreatorId(Optional creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = creatorId; @@ -181,7 +196,6 @@ public StreamPatchPayload withCreatorId(Optional creat /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ public StreamPatchPayload withRecord(boolean record) { Utils.checkNotNull(record, "record"); @@ -189,10 +203,10 @@ public StreamPatchPayload withRecord(boolean record) { return this; } + /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ public StreamPatchPayload withRecord(Optional record) { Utils.checkNotNull(record, "record"); @@ -209,6 +223,7 @@ public StreamPatchPayload withSuspended(boolean suspended) { return this; } + /** * If currently suspended */ @@ -224,6 +239,7 @@ public StreamPatchPayload withMultistream(Multistream multistream) { return this; } + public StreamPatchPayload withMultistream(Optional multistream) { Utils.checkNotNull(multistream, "multistream"); this.multistream = multistream; @@ -266,6 +282,7 @@ public StreamPatchPayload withRecordingSpec(RecordingSpec recordingSpec) { return this; } + public StreamPatchPayload withRecordingSpec(Optional recordingSpec) { Utils.checkNotNull(recordingSpec, "recordingSpec"); this.recordingSpec = recordingSpec; @@ -281,6 +298,7 @@ public StreamPatchPayload withUserTags(Map userTags) { return this; } + /** * User input tags associated with the stream */ @@ -289,7 +307,20 @@ public StreamPatchPayload withUserTags(Optional> this.userTags = userTags; return this; } - + + public StreamPatchPayload withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = Optional.ofNullable(name); + return this; + } + + + public StreamPatchPayload withName(Optional name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -300,27 +331,23 @@ public boolean equals(java.lang.Object o) { } StreamPatchPayload other = (StreamPatchPayload) o; return - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.record, other.record) && - Objects.deepEquals(this.suspended, other.suspended) && - Objects.deepEquals(this.multistream, other.multistream) && - Objects.deepEquals(this.playbackPolicy, other.playbackPolicy) && - Objects.deepEquals(this.profiles, other.profiles) && - Objects.deepEquals(this.recordingSpec, other.recordingSpec) && - Objects.deepEquals(this.userTags, other.userTags); + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.record, other.record) && + Utils.enhancedDeepEquals(this.suspended, other.suspended) && + Utils.enhancedDeepEquals(this.multistream, other.multistream) && + Utils.enhancedDeepEquals(this.playbackPolicy, other.playbackPolicy) && + Utils.enhancedDeepEquals(this.profiles, other.profiles) && + Utils.enhancedDeepEquals(this.recordingSpec, other.recordingSpec) && + Utils.enhancedDeepEquals(this.userTags, other.userTags) && + Utils.enhancedDeepEquals(this.name, other.name); } @Override public int hashCode() { - return Objects.hash( - creatorId, - record, - suspended, - multistream, - playbackPolicy, - profiles, - recordingSpec, - userTags); + return Utils.enhancedHash( + creatorId, record, suspended, + multistream, playbackPolicy, profiles, + recordingSpec, userTags, name); } @Override @@ -333,31 +360,36 @@ public String toString() { "playbackPolicy", playbackPolicy, "profiles", profiles, "recordingSpec", recordingSpec, - "userTags", userTags); + "userTags", userTags, + "name", name); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional creatorId = Optional.empty(); - + private Optional record = Optional.empty(); - + private Optional suspended = Optional.empty(); - + private Optional multistream = Optional.empty(); - + private JsonNullable playbackPolicy = JsonNullable.undefined(); - + private JsonNullable> profiles = JsonNullable.undefined(); - + private Optional recordingSpec = Optional.empty(); - - private Optional> userTags = Optional.empty(); - + + private Optional> userTags = Optional.empty(); + + private Optional name = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder creatorId(InputCreatorId creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = Optional.ofNullable(creatorId); @@ -370,10 +402,10 @@ public Builder creatorId(Optional creatorId) { return this; } + /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ public Builder record(boolean record) { Utils.checkNotNull(record, "record"); @@ -384,7 +416,6 @@ public Builder record(boolean record) { /** * Should this stream be recorded? Uses default settings. For more * customization, create and configure an object store. - * */ public Builder record(Optional record) { Utils.checkNotNull(record, "record"); @@ -392,6 +423,7 @@ public Builder record(Optional record) { return this; } + /** * If currently suspended */ @@ -410,6 +442,7 @@ public Builder suspended(Optional suspended) { return this; } + public Builder multistream(Multistream multistream) { Utils.checkNotNull(multistream, "multistream"); this.multistream = Optional.ofNullable(multistream); @@ -422,6 +455,7 @@ public Builder multistream(Optional multistream) { return this; } + /** * Whether the playback policy for an asset or stream is public or signed */ @@ -440,6 +474,7 @@ public Builder playbackPolicy(JsonNullable playbackPol return this; } + public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = JsonNullable.of(profiles); @@ -452,6 +487,7 @@ public Builder profiles(JsonNullable> profiles) { return this; } + public Builder recordingSpec(RecordingSpec recordingSpec) { Utils.checkNotNull(recordingSpec, "recordingSpec"); this.recordingSpec = Optional.ofNullable(recordingSpec); @@ -464,6 +500,7 @@ public Builder recordingSpec(Optional recordingSpec) { return this; } + /** * User input tags associated with the stream */ @@ -481,18 +518,27 @@ public Builder userTags(Optional> userTags) { this.userTags = userTags; return this; } - + + + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = Optional.ofNullable(name); + return this; + } + + public Builder name(Optional name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + public StreamPatchPayload build() { + return new StreamPatchPayload( - creatorId, - record, - suspended, - multistream, - playbackPolicy, - profiles, - recordingSpec, - userTags); + creatorId, record, suspended, + multistream, playbackPolicy, profiles, + recordingSpec, userTags, name); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/StreamPull.java b/src/main/java/studio/livepeer/livepeer/models/components/StreamPull.java index e074db2c..ee3f8415 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/StreamPull.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/StreamPull.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,18 +12,17 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.Map; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * StreamPull - Configuration for a stream that should be actively pulled from an + * StreamPull + * + *

Configuration for a stream that should be actively pulled from an * external source, rather than pushed to Livepeer. If specified, the * stream will not have a streamKey. */ - public class StreamPull { - /** * URL from which to pull from. */ @@ -72,7 +69,8 @@ public StreamPull( public StreamPull( String source) { - this(source, Optional.empty(), Optional.empty(), Optional.empty()); + this(source, Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -111,10 +109,11 @@ public Optional location() { return (Optional) location; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * URL from which to pull from. */ @@ -133,6 +132,7 @@ public StreamPull withHeaders(Map headers) { return this; } + /** * Headers to be sent with the request to the pull source. */ @@ -151,6 +151,7 @@ public StreamPull withIsMobile(StreamIsMobile isMobile) { return this; } + /** * Indicates whether the stream will be pulled from a mobile source. */ @@ -170,6 +171,7 @@ public StreamPull withLocation(StreamLocation location) { return this; } + /** * Approximate location of the pull source. The location is used to * determine the closest Livepeer region to pull the stream from. @@ -179,7 +181,7 @@ public StreamPull withLocation(Optional location) { this.location = location; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -190,18 +192,16 @@ public boolean equals(java.lang.Object o) { } StreamPull other = (StreamPull) o; return - Objects.deepEquals(this.source, other.source) && - Objects.deepEquals(this.headers, other.headers) && - Objects.deepEquals(this.isMobile, other.isMobile) && - Objects.deepEquals(this.location, other.location); + Utils.enhancedDeepEquals(this.source, other.source) && + Utils.enhancedDeepEquals(this.headers, other.headers) && + Utils.enhancedDeepEquals(this.isMobile, other.isMobile) && + Utils.enhancedDeepEquals(this.location, other.location); } @Override public int hashCode() { - return Objects.hash( - source, - headers, - isMobile, + return Utils.enhancedHash( + source, headers, isMobile, location); } @@ -213,21 +213,23 @@ public String toString() { "isMobile", isMobile, "location", location); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String source; - + private Optional> headers = Optional.empty(); - + private Optional isMobile = Optional.empty(); - - private Optional location = Optional.empty(); - + + private Optional location = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * URL from which to pull from. */ @@ -237,6 +239,7 @@ public Builder source(String source) { return this; } + /** * Headers to be sent with the request to the pull source. */ @@ -255,6 +258,7 @@ public Builder headers(Optional> headers) { return this; } + /** * Indicates whether the stream will be pulled from a mobile source. */ @@ -273,6 +277,7 @@ public Builder isMobile(Optional isMobile) { return this; } + /** * Approximate location of the pull source. The location is used to * determine the closest Livepeer region to pull the stream from. @@ -292,14 +297,13 @@ public Builder location(Optional location) { this.location = location; return this; } - + public StreamPull build() { + return new StreamPull( - source, - headers, - isMobile, + source, headers, isMobile, location); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/StreamRecordingSpec.java b/src/main/java/studio/livepeer/livepeer/models/components/StreamRecordingSpec.java index 772f19fc..cb537768 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/StreamRecordingSpec.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/StreamRecordingSpec.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,23 +12,20 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * StreamRecordingSpec - Configuration for recording the stream. This can only be set if - * `record` is true. + * StreamRecordingSpec * + *

Configuration for recording the stream. This can only be set if + * `record` is true. */ - public class StreamRecordingSpec { - /** * Profiles to process the recording of this stream into. If not * specified, default profiles will be derived based on the stream * input. Keep in mind that the source rendition is always kept. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("profiles") @@ -51,7 +46,6 @@ public StreamRecordingSpec() { * Profiles to process the recording of this stream into. If not * specified, default profiles will be derived based on the stream * input. Keep in mind that the source rendition is always kept. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -59,15 +53,15 @@ public Optional> profiles() { return (Optional>) profiles; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Profiles to process the recording of this stream into. If not * specified, default profiles will be derived based on the stream * input. Keep in mind that the source rendition is always kept. - * */ public StreamRecordingSpec withProfiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -75,18 +69,18 @@ public StreamRecordingSpec withProfiles(List profiles) { return this; } + /** * Profiles to process the recording of this stream into. If not * specified, default profiles will be derived based on the stream * input. Keep in mind that the source rendition is always kept. - * */ public StreamRecordingSpec withProfiles(Optional> profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = profiles; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -97,12 +91,12 @@ public boolean equals(java.lang.Object o) { } StreamRecordingSpec other = (StreamRecordingSpec) o; return - Objects.deepEquals(this.profiles, other.profiles); + Utils.enhancedDeepEquals(this.profiles, other.profiles); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( profiles); } @@ -111,20 +105,21 @@ public String toString() { return Utils.toString(StreamRecordingSpec.class, "profiles", profiles); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional> profiles = Optional.empty(); - + + private Optional> profiles = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Profiles to process the recording of this stream into. If not * specified, default profiles will be derived based on the stream * input. Keep in mind that the source rendition is always kept. - * */ public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); @@ -136,18 +131,18 @@ public Builder profiles(List profiles) { * Profiles to process the recording of this stream into. If not * specified, default profiles will be derived based on the stream * input. Keep in mind that the source rendition is always kept. - * */ public Builder profiles(Optional> profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = profiles; return this; } - + public StreamRecordingSpec build() { + return new StreamRecordingSpec( profiles); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/StreamUserTags.java b/src/main/java/studio/livepeer/livepeer/models/components/StreamUserTags.java index e9cf7af3..874c630d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/StreamUserTags.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/StreamUserTags.java @@ -1,25 +1,22 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Double; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; import studio.livepeer.livepeer.utils.Utils.TypeReferenceWithShape; import studio.livepeer.livepeer.utils.Utils; - @JsonDeserialize(using = StreamUserTags._Deserializer.class) public class StreamUserTags { @@ -77,12 +74,12 @@ public boolean equals(java.lang.Object o) { return false; } StreamUserTags other = (StreamUserTags) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -90,9 +87,9 @@ public static final class _Deserializer extends OneOfDeserializer>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -103,3 +100,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Target.java b/src/main/java/studio/livepeer/livepeer/models/components/Target.java index 046449f8..b2a9f93d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Target.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Target.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -15,18 +13,15 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.LazySingletonValue; import studio.livepeer.livepeer.utils.Utils; public class Target { - /** * Name of transcoding profile that should be sent. Use * "source" for pushing source stream data - * */ @JsonProperty("profile") private String profile; @@ -34,7 +29,6 @@ public class Target { /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("videoOnly") @@ -51,7 +45,6 @@ public class Target { * Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("spec") @@ -75,13 +68,13 @@ public Target( public Target( String profile) { - this(profile, Optional.empty(), Optional.empty(), Optional.empty()); + this(profile, Optional.empty(), Optional.empty(), + Optional.empty()); } /** * Name of transcoding profile that should be sent. Use * "source" for pushing source stream data - * */ @JsonIgnore public String profile() { @@ -91,7 +84,6 @@ public String profile() { /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ @JsonIgnore public Optional videoOnly() { @@ -110,7 +102,6 @@ public Optional id() { * Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -118,14 +109,14 @@ public Optional spec() { return (Optional) spec; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Name of transcoding profile that should be sent. Use * "source" for pushing source stream data - * */ public Target withProfile(String profile) { Utils.checkNotNull(profile, "profile"); @@ -136,7 +127,6 @@ public Target withProfile(String profile) { /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ public Target withVideoOnly(boolean videoOnly) { Utils.checkNotNull(videoOnly, "videoOnly"); @@ -144,10 +134,10 @@ public Target withVideoOnly(boolean videoOnly) { return this; } + /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ public Target withVideoOnly(Optional videoOnly) { Utils.checkNotNull(videoOnly, "videoOnly"); @@ -164,6 +154,7 @@ public Target withId(String id) { return this; } + /** * ID of multistream target object where to push this stream */ @@ -177,7 +168,6 @@ public Target withId(Optional id) { * Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ public Target withSpec(TargetSpec spec) { Utils.checkNotNull(spec, "spec"); @@ -185,18 +175,18 @@ public Target withSpec(TargetSpec spec) { return this; } + /** * Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ public Target withSpec(Optional spec) { Utils.checkNotNull(spec, "spec"); this.spec = spec; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -207,18 +197,16 @@ public boolean equals(java.lang.Object o) { } Target other = (Target) o; return - Objects.deepEquals(this.profile, other.profile) && - Objects.deepEquals(this.videoOnly, other.videoOnly) && - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.spec, other.spec); + Utils.enhancedDeepEquals(this.profile, other.profile) && + Utils.enhancedDeepEquals(this.videoOnly, other.videoOnly) && + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.spec, other.spec); } @Override public int hashCode() { - return Objects.hash( - profile, - videoOnly, - id, + return Utils.enhancedHash( + profile, videoOnly, id, spec); } @@ -230,25 +218,26 @@ public String toString() { "id", id, "spec", spec); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String profile; - + private Optional videoOnly; - + private Optional id = Optional.empty(); - - private Optional spec = Optional.empty(); - + + private Optional spec = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Name of transcoding profile that should be sent. Use * "source" for pushing source stream data - * */ public Builder profile(String profile) { Utils.checkNotNull(profile, "profile"); @@ -256,10 +245,10 @@ public Builder profile(String profile) { return this; } + /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ public Builder videoOnly(boolean videoOnly) { Utils.checkNotNull(videoOnly, "videoOnly"); @@ -270,7 +259,6 @@ public Builder videoOnly(boolean videoOnly) { /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ public Builder videoOnly(Optional videoOnly) { Utils.checkNotNull(videoOnly, "videoOnly"); @@ -278,6 +266,7 @@ public Builder videoOnly(Optional videoOnly) { return this; } + /** * ID of multistream target object where to push this stream */ @@ -296,11 +285,11 @@ public Builder id(Optional id) { return this; } + /** * Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ public Builder spec(TargetSpec spec) { Utils.checkNotNull(spec, "spec"); @@ -312,25 +301,24 @@ public Builder spec(TargetSpec spec) { * Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ public Builder spec(Optional spec) { Utils.checkNotNull(spec, "spec"); this.spec = spec; return this; } - + public Target build() { if (videoOnly == null) { videoOnly = _SINGLETON_VALUE_VideoOnly.value(); } + return new Target( - profile, - videoOnly, - id, + profile, videoOnly, id, spec); } + private static final LazySingletonValue> _SINGLETON_VALUE_VideoOnly = new LazySingletonValue<>( "videoOnly", @@ -338,4 +326,3 @@ public Target build() { new TypeReference>() {}); } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TargetAddPayload.java b/src/main/java/studio/livepeer/livepeer/models/components/TargetAddPayload.java index 84a3401c..db38d49d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TargetAddPayload.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TargetAddPayload.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -15,18 +13,15 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.LazySingletonValue; import studio.livepeer.livepeer.utils.Utils; public class TargetAddPayload { - /** * Name of transcoding profile that should be sent. Use * "source" for pushing source stream data - * */ @JsonProperty("profile") private String profile; @@ -34,7 +29,6 @@ public class TargetAddPayload { /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("videoOnly") @@ -51,7 +45,6 @@ public class TargetAddPayload { * Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("spec") @@ -75,13 +68,13 @@ public TargetAddPayload( public TargetAddPayload( String profile) { - this(profile, Optional.empty(), Optional.empty(), Optional.empty()); + this(profile, Optional.empty(), Optional.empty(), + Optional.empty()); } /** * Name of transcoding profile that should be sent. Use * "source" for pushing source stream data - * */ @JsonIgnore public String profile() { @@ -91,7 +84,6 @@ public String profile() { /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ @JsonIgnore public Optional videoOnly() { @@ -110,7 +102,6 @@ public Optional id() { * Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -118,14 +109,14 @@ public Optional spec() { return (Optional) spec; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Name of transcoding profile that should be sent. Use * "source" for pushing source stream data - * */ public TargetAddPayload withProfile(String profile) { Utils.checkNotNull(profile, "profile"); @@ -136,7 +127,6 @@ public TargetAddPayload withProfile(String profile) { /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ public TargetAddPayload withVideoOnly(boolean videoOnly) { Utils.checkNotNull(videoOnly, "videoOnly"); @@ -144,10 +134,10 @@ public TargetAddPayload withVideoOnly(boolean videoOnly) { return this; } + /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ public TargetAddPayload withVideoOnly(Optional videoOnly) { Utils.checkNotNull(videoOnly, "videoOnly"); @@ -164,6 +154,7 @@ public TargetAddPayload withId(String id) { return this; } + /** * ID of multistream target object where to push this stream */ @@ -177,7 +168,6 @@ public TargetAddPayload withId(Optional id) { * Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ public TargetAddPayload withSpec(TargetAddPayloadSpec spec) { Utils.checkNotNull(spec, "spec"); @@ -185,18 +175,18 @@ public TargetAddPayload withSpec(TargetAddPayloadSpec spec) { return this; } + /** * Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ public TargetAddPayload withSpec(Optional spec) { Utils.checkNotNull(spec, "spec"); this.spec = spec; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -207,18 +197,16 @@ public boolean equals(java.lang.Object o) { } TargetAddPayload other = (TargetAddPayload) o; return - Objects.deepEquals(this.profile, other.profile) && - Objects.deepEquals(this.videoOnly, other.videoOnly) && - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.spec, other.spec); + Utils.enhancedDeepEquals(this.profile, other.profile) && + Utils.enhancedDeepEquals(this.videoOnly, other.videoOnly) && + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.spec, other.spec); } @Override public int hashCode() { - return Objects.hash( - profile, - videoOnly, - id, + return Utils.enhancedHash( + profile, videoOnly, id, spec); } @@ -230,25 +218,26 @@ public String toString() { "id", id, "spec", spec); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String profile; - + private Optional videoOnly; - + private Optional id = Optional.empty(); - - private Optional spec = Optional.empty(); - + + private Optional spec = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Name of transcoding profile that should be sent. Use * "source" for pushing source stream data - * */ public Builder profile(String profile) { Utils.checkNotNull(profile, "profile"); @@ -256,10 +245,10 @@ public Builder profile(String profile) { return this; } + /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ public Builder videoOnly(boolean videoOnly) { Utils.checkNotNull(videoOnly, "videoOnly"); @@ -270,7 +259,6 @@ public Builder videoOnly(boolean videoOnly) { /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ public Builder videoOnly(Optional videoOnly) { Utils.checkNotNull(videoOnly, "videoOnly"); @@ -278,6 +266,7 @@ public Builder videoOnly(Optional videoOnly) { return this; } + /** * ID of multistream target object where to push this stream */ @@ -296,11 +285,11 @@ public Builder id(Optional id) { return this; } + /** * Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ public Builder spec(TargetAddPayloadSpec spec) { Utils.checkNotNull(spec, "spec"); @@ -312,25 +301,24 @@ public Builder spec(TargetAddPayloadSpec spec) { * Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ public Builder spec(Optional spec) { Utils.checkNotNull(spec, "spec"); this.spec = spec; return this; } - + public TargetAddPayload build() { if (videoOnly == null) { videoOnly = _SINGLETON_VALUE_VideoOnly.value(); } + return new TargetAddPayload( - profile, - videoOnly, - id, + profile, videoOnly, id, spec); } + private static final LazySingletonValue> _SINGLETON_VALUE_VideoOnly = new LazySingletonValue<>( "videoOnly", @@ -338,4 +326,3 @@ public TargetAddPayload build() { new TypeReference>() {}); } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TargetAddPayloadSpec.java b/src/main/java/studio/livepeer/livepeer/models/components/TargetAddPayloadSpec.java index ddf45512..ec26d23b 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TargetAddPayloadSpec.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TargetAddPayloadSpec.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,17 +10,16 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * TargetAddPayloadSpec - Inline multistream target object. Will automatically + * TargetAddPayloadSpec + * + *

Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ - public class TargetAddPayloadSpec { @JsonInclude(Include.NON_ABSENT) @@ -63,16 +60,18 @@ public String url() { return url; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public TargetAddPayloadSpec withName(String name) { Utils.checkNotNull(name, "name"); this.name = Optional.ofNullable(name); return this; } + public TargetAddPayloadSpec withName(Optional name) { Utils.checkNotNull(name, "name"); this.name = name; @@ -87,7 +86,7 @@ public TargetAddPayloadSpec withUrl(String url) { this.url = url; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -98,15 +97,14 @@ public boolean equals(java.lang.Object o) { } TargetAddPayloadSpec other = (TargetAddPayloadSpec) o; return - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.url, other.url); + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.url, other.url); } @Override public int hashCode() { - return Objects.hash( - name, - url); + return Utils.enhancedHash( + name, url); } @Override @@ -115,17 +113,19 @@ public String toString() { "name", name, "url", url); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional name = Optional.empty(); - - private String url; - + + private String url; + private Builder() { // force use of static builder() method } + public Builder name(String name) { Utils.checkNotNull(name, "name"); this.name = Optional.ofNullable(name); @@ -138,6 +138,7 @@ public Builder name(Optional name) { return this; } + /** * Livepeer-compatible multistream target URL (RTMP(S) or SRT) */ @@ -146,12 +147,12 @@ public Builder url(String url) { this.url = url; return this; } - + public TargetAddPayloadSpec build() { + return new TargetAddPayloadSpec( - name, - url); + name, url); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TargetOutput.java b/src/main/java/studio/livepeer/livepeer/models/components/TargetOutput.java index cfa43315..f17482ad 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TargetOutput.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TargetOutput.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,18 +12,15 @@ import java.lang.Boolean; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.LazySingletonValue; import studio.livepeer.livepeer.utils.Utils; public class TargetOutput { - /** * Name of transcoding profile that should be sent. Use * "source" for pushing source stream data - * */ @JsonProperty("profile") private String profile; @@ -33,7 +28,6 @@ public class TargetOutput { /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("videoOnly") @@ -67,7 +61,6 @@ public TargetOutput( /** * Name of transcoding profile that should be sent. Use * "source" for pushing source stream data - * */ @JsonIgnore public String profile() { @@ -77,7 +70,6 @@ public String profile() { /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ @JsonIgnore public Optional videoOnly() { @@ -92,14 +84,14 @@ public Optional id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Name of transcoding profile that should be sent. Use * "source" for pushing source stream data - * */ public TargetOutput withProfile(String profile) { Utils.checkNotNull(profile, "profile"); @@ -110,7 +102,6 @@ public TargetOutput withProfile(String profile) { /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ public TargetOutput withVideoOnly(boolean videoOnly) { Utils.checkNotNull(videoOnly, "videoOnly"); @@ -118,10 +109,10 @@ public TargetOutput withVideoOnly(boolean videoOnly) { return this; } + /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ public TargetOutput withVideoOnly(Optional videoOnly) { Utils.checkNotNull(videoOnly, "videoOnly"); @@ -138,6 +129,7 @@ public TargetOutput withId(String id) { return this; } + /** * ID of multistream target object where to push this stream */ @@ -146,7 +138,7 @@ public TargetOutput withId(Optional id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,17 +149,15 @@ public boolean equals(java.lang.Object o) { } TargetOutput other = (TargetOutput) o; return - Objects.deepEquals(this.profile, other.profile) && - Objects.deepEquals(this.videoOnly, other.videoOnly) && - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.profile, other.profile) && + Utils.enhancedDeepEquals(this.videoOnly, other.videoOnly) && + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( - profile, - videoOnly, - id); + return Utils.enhancedHash( + profile, videoOnly, id); } @Override @@ -177,23 +167,24 @@ public String toString() { "videoOnly", videoOnly, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String profile; - + private Optional videoOnly; - - private Optional id = Optional.empty(); - + + private Optional id = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Name of transcoding profile that should be sent. Use * "source" for pushing source stream data - * */ public Builder profile(String profile) { Utils.checkNotNull(profile, "profile"); @@ -201,10 +192,10 @@ public Builder profile(String profile) { return this; } + /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ public Builder videoOnly(boolean videoOnly) { Utils.checkNotNull(videoOnly, "videoOnly"); @@ -215,7 +206,6 @@ public Builder videoOnly(boolean videoOnly) { /** * If true, the stream audio will be muted and only silent * video will be pushed to the target. - * */ public Builder videoOnly(Optional videoOnly) { Utils.checkNotNull(videoOnly, "videoOnly"); @@ -223,6 +213,7 @@ public Builder videoOnly(Optional videoOnly) { return this; } + /** * ID of multistream target object where to push this stream */ @@ -240,17 +231,17 @@ public Builder id(Optional id) { this.id = id; return this; } - + public TargetOutput build() { if (videoOnly == null) { videoOnly = _SINGLETON_VALUE_VideoOnly.value(); } + return new TargetOutput( - profile, - videoOnly, - id); + profile, videoOnly, id); } + private static final LazySingletonValue> _SINGLETON_VALUE_VideoOnly = new LazySingletonValue<>( "videoOnly", @@ -258,4 +249,3 @@ public TargetOutput build() { new TypeReference>() {}); } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TargetSpec.java b/src/main/java/studio/livepeer/livepeer/models/components/TargetSpec.java index 01f7632e..848e97dc 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TargetSpec.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TargetSpec.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,17 +10,16 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * TargetSpec - Inline multistream target object. Will automatically + * TargetSpec + * + *

Inline multistream target object. Will automatically * create the target resource to be used by the created * stream. - * */ - public class TargetSpec { @JsonInclude(Include.NON_ABSENT) @@ -63,16 +60,18 @@ public String url() { return url; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public TargetSpec withName(String name) { Utils.checkNotNull(name, "name"); this.name = Optional.ofNullable(name); return this; } + public TargetSpec withName(Optional name) { Utils.checkNotNull(name, "name"); this.name = name; @@ -87,7 +86,7 @@ public TargetSpec withUrl(String url) { this.url = url; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -98,15 +97,14 @@ public boolean equals(java.lang.Object o) { } TargetSpec other = (TargetSpec) o; return - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.url, other.url); + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.url, other.url); } @Override public int hashCode() { - return Objects.hash( - name, - url); + return Utils.enhancedHash( + name, url); } @Override @@ -115,17 +113,19 @@ public String toString() { "name", name, "url", url); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional name = Optional.empty(); - - private String url; - + + private String url; + private Builder() { // force use of static builder() method } + public Builder name(String name) { Utils.checkNotNull(name, "name"); this.name = Optional.ofNullable(name); @@ -138,6 +138,7 @@ public Builder name(Optional name) { return this; } + /** * Livepeer-compatible multistream target URL (RTMP(S) or SRT) */ @@ -146,12 +147,12 @@ public Builder url(String url) { this.url = url; return this; } - + public TargetSpec build() { + return new TargetSpec( - name, - url); + name, url); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Task.java b/src/main/java/studio/livepeer/livepeer/models/components/Task.java index 82d95a61..445eeea1 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Task.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Task.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,13 +12,11 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class Task { - /** * Task ID */ @@ -45,7 +41,6 @@ public class Task { /** * Timestamp (in milliseconds) at which the task was scheduled for * execution (e.g. after file upload finished). - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("scheduledAt") @@ -65,6 +60,13 @@ public class Task { @JsonProperty("outputAssetId") private Optional outputAssetId; + /** + * ID of the project + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("projectId") + private Optional projectId; + /** * ID of the requester hash(IP + SALT + PlaybackId) */ @@ -101,6 +103,7 @@ public Task( @JsonProperty("scheduledAt") Optional scheduledAt, @JsonProperty("inputAssetId") Optional inputAssetId, @JsonProperty("outputAssetId") Optional outputAssetId, + @JsonProperty("projectId") Optional projectId, @JsonProperty("requesterId") Optional requesterId, @JsonProperty("params") Optional params, @JsonProperty("status") Optional status, @@ -111,6 +114,7 @@ public Task( Utils.checkNotNull(scheduledAt, "scheduledAt"); Utils.checkNotNull(inputAssetId, "inputAssetId"); Utils.checkNotNull(outputAssetId, "outputAssetId"); + Utils.checkNotNull(projectId, "projectId"); Utils.checkNotNull(requesterId, "requesterId"); Utils.checkNotNull(params, "params"); Utils.checkNotNull(status, "status"); @@ -121,6 +125,7 @@ public Task( this.scheduledAt = scheduledAt; this.inputAssetId = inputAssetId; this.outputAssetId = outputAssetId; + this.projectId = projectId; this.requesterId = requesterId; this.params = params; this.status = status; @@ -128,7 +133,10 @@ public Task( } public Task() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); } /** @@ -159,7 +167,6 @@ public Optional createdAt() { /** * Timestamp (in milliseconds) at which the task was scheduled for * execution (e.g. after file upload finished). - * */ @JsonIgnore public Optional scheduledAt() { @@ -182,6 +189,14 @@ public Optional outputAssetId() { return outputAssetId; } + /** + * ID of the project + */ + @JsonIgnore + public Optional projectId() { + return projectId; + } + /** * ID of the requester hash(IP + SALT + PlaybackId) */ @@ -217,10 +232,11 @@ public Optional output() { return (Optional) output; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Task ID */ @@ -230,6 +246,7 @@ public Task withId(String id) { return this; } + /** * Task ID */ @@ -248,6 +265,7 @@ public Task withType(TaskType type) { return this; } + /** * Type of the task */ @@ -266,6 +284,7 @@ public Task withCreatedAt(double createdAt) { return this; } + /** * Timestamp (in milliseconds) at which task was created */ @@ -278,7 +297,6 @@ public Task withCreatedAt(Optional createdAt) { /** * Timestamp (in milliseconds) at which the task was scheduled for * execution (e.g. after file upload finished). - * */ public Task withScheduledAt(double scheduledAt) { Utils.checkNotNull(scheduledAt, "scheduledAt"); @@ -286,10 +304,10 @@ public Task withScheduledAt(double scheduledAt) { return this; } + /** * Timestamp (in milliseconds) at which the task was scheduled for * execution (e.g. after file upload finished). - * */ public Task withScheduledAt(Optional scheduledAt) { Utils.checkNotNull(scheduledAt, "scheduledAt"); @@ -306,6 +324,7 @@ public Task withInputAssetId(String inputAssetId) { return this; } + /** * ID of the input asset */ @@ -324,6 +343,7 @@ public Task withOutputAssetId(String outputAssetId) { return this; } + /** * ID of the output asset */ @@ -333,6 +353,25 @@ public Task withOutputAssetId(Optional outputAssetId) { return this; } + /** + * ID of the project + */ + public Task withProjectId(String projectId) { + Utils.checkNotNull(projectId, "projectId"); + this.projectId = Optional.ofNullable(projectId); + return this; + } + + + /** + * ID of the project + */ + public Task withProjectId(Optional projectId) { + Utils.checkNotNull(projectId, "projectId"); + this.projectId = projectId; + return this; + } + /** * ID of the requester hash(IP + SALT + PlaybackId) */ @@ -342,6 +381,7 @@ public Task withRequesterId(String requesterId) { return this; } + /** * ID of the requester hash(IP + SALT + PlaybackId) */ @@ -360,6 +400,7 @@ public Task withParams(Params params) { return this; } + /** * Parameters of the task */ @@ -378,6 +419,7 @@ public Task withStatus(TaskStatus status) { return this; } + /** * Status of the task */ @@ -396,6 +438,7 @@ public Task withOutput(Output output) { return this; } + /** * Output of the task */ @@ -404,7 +447,7 @@ public Task withOutput(Optional output) { this.output = output; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -415,31 +458,26 @@ public boolean equals(java.lang.Object o) { } Task other = (Task) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.createdAt, other.createdAt) && - Objects.deepEquals(this.scheduledAt, other.scheduledAt) && - Objects.deepEquals(this.inputAssetId, other.inputAssetId) && - Objects.deepEquals(this.outputAssetId, other.outputAssetId) && - Objects.deepEquals(this.requesterId, other.requesterId) && - Objects.deepEquals(this.params, other.params) && - Objects.deepEquals(this.status, other.status) && - Objects.deepEquals(this.output, other.output); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.createdAt, other.createdAt) && + Utils.enhancedDeepEquals(this.scheduledAt, other.scheduledAt) && + Utils.enhancedDeepEquals(this.inputAssetId, other.inputAssetId) && + Utils.enhancedDeepEquals(this.outputAssetId, other.outputAssetId) && + Utils.enhancedDeepEquals(this.projectId, other.projectId) && + Utils.enhancedDeepEquals(this.requesterId, other.requesterId) && + Utils.enhancedDeepEquals(this.params, other.params) && + Utils.enhancedDeepEquals(this.status, other.status) && + Utils.enhancedDeepEquals(this.output, other.output); } @Override public int hashCode() { - return Objects.hash( - id, - type, - createdAt, - scheduledAt, - inputAssetId, - outputAssetId, - requesterId, - params, - status, - output); + return Utils.enhancedHash( + id, type, createdAt, + scheduledAt, inputAssetId, outputAssetId, + projectId, requesterId, params, + status, output); } @Override @@ -451,38 +489,43 @@ public String toString() { "scheduledAt", scheduledAt, "inputAssetId", inputAssetId, "outputAssetId", outputAssetId, + "projectId", projectId, "requesterId", requesterId, "params", params, "status", status, "output", output); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional id = Optional.empty(); - + private Optional type = Optional.empty(); - + private Optional createdAt = Optional.empty(); - + private Optional scheduledAt = Optional.empty(); - + private Optional inputAssetId = Optional.empty(); - + private Optional outputAssetId = Optional.empty(); - + + private Optional projectId = Optional.empty(); + private Optional requesterId = Optional.empty(); - + private Optional params = Optional.empty(); - + private Optional status = Optional.empty(); - - private Optional output = Optional.empty(); - + + private Optional output = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Task ID */ @@ -501,6 +544,7 @@ public Builder id(Optional id) { return this; } + /** * Type of the task */ @@ -519,6 +563,7 @@ public Builder type(Optional type) { return this; } + /** * Timestamp (in milliseconds) at which task was created */ @@ -537,10 +582,10 @@ public Builder createdAt(Optional createdAt) { return this; } + /** * Timestamp (in milliseconds) at which the task was scheduled for * execution (e.g. after file upload finished). - * */ public Builder scheduledAt(double scheduledAt) { Utils.checkNotNull(scheduledAt, "scheduledAt"); @@ -551,7 +596,6 @@ public Builder scheduledAt(double scheduledAt) { /** * Timestamp (in milliseconds) at which the task was scheduled for * execution (e.g. after file upload finished). - * */ public Builder scheduledAt(Optional scheduledAt) { Utils.checkNotNull(scheduledAt, "scheduledAt"); @@ -559,6 +603,7 @@ public Builder scheduledAt(Optional scheduledAt) { return this; } + /** * ID of the input asset */ @@ -577,6 +622,7 @@ public Builder inputAssetId(Optional inputAssetId) { return this; } + /** * ID of the output asset */ @@ -595,6 +641,26 @@ public Builder outputAssetId(Optional outputAssetId) { return this; } + + /** + * ID of the project + */ + public Builder projectId(String projectId) { + Utils.checkNotNull(projectId, "projectId"); + this.projectId = Optional.ofNullable(projectId); + return this; + } + + /** + * ID of the project + */ + public Builder projectId(Optional projectId) { + Utils.checkNotNull(projectId, "projectId"); + this.projectId = projectId; + return this; + } + + /** * ID of the requester hash(IP + SALT + PlaybackId) */ @@ -613,6 +679,7 @@ public Builder requesterId(Optional requesterId) { return this; } + /** * Parameters of the task */ @@ -631,6 +698,7 @@ public Builder params(Optional params) { return this; } + /** * Status of the task */ @@ -649,6 +717,7 @@ public Builder status(Optional status) { return this; } + /** * Output of the task */ @@ -666,20 +735,15 @@ public Builder output(Optional output) { this.output = output; return this; } - + public Task build() { + return new Task( - id, - type, - createdAt, - scheduledAt, - inputAssetId, - outputAssetId, - requesterId, - params, - status, - output); + id, type, createdAt, + scheduledAt, inputAssetId, outputAssetId, + projectId, requesterId, params, + status, output); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TaskExportData.java b/src/main/java/studio/livepeer/livepeer/models/components/TaskExportData.java index 94fa304b..fe7c946a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TaskExportData.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TaskExportData.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,22 +11,22 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * TaskExportData - Parameters for the export-data task + * TaskExportData + * + *

Parameters for the export-data task */ - public class TaskExportData { - /** * File content to store into IPFS */ @JsonProperty("content") private Content content; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("ipfs") private Optional ipfs; @@ -65,7 +63,8 @@ public TaskExportData( public TaskExportData( Content content) { - this(content, Optional.empty(), Optional.empty(), Optional.empty()); + this(content, Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -98,10 +97,11 @@ public Optional id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * File content to store into IPFS */ @@ -117,6 +117,7 @@ public TaskExportData withIpfs(IpfsExportParams ipfs) { return this; } + public TaskExportData withIpfs(Optional ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = ipfs; @@ -132,6 +133,7 @@ public TaskExportData withType(String type) { return this; } + /** * Optional type of content */ @@ -150,6 +152,7 @@ public TaskExportData withId(String id) { return this; } + /** * Optional ID of the content */ @@ -158,7 +161,7 @@ public TaskExportData withId(Optional id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -169,18 +172,16 @@ public boolean equals(java.lang.Object o) { } TaskExportData other = (TaskExportData) o; return - Objects.deepEquals(this.content, other.content) && - Objects.deepEquals(this.ipfs, other.ipfs) && - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.content, other.content) && + Utils.enhancedDeepEquals(this.ipfs, other.ipfs) && + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( - content, - ipfs, - type, + return Utils.enhancedHash( + content, ipfs, type, id); } @@ -192,21 +193,23 @@ public String toString() { "type", type, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Content content; - + private Optional ipfs = Optional.empty(); - + private Optional type = Optional.empty(); - - private Optional id = Optional.empty(); - + + private Optional id = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * File content to store into IPFS */ @@ -216,6 +219,7 @@ public Builder content(Content content) { return this; } + public Builder ipfs(IpfsExportParams ipfs) { Utils.checkNotNull(ipfs, "ipfs"); this.ipfs = Optional.ofNullable(ipfs); @@ -228,6 +232,7 @@ public Builder ipfs(Optional ipfs) { return this; } + /** * Optional type of content */ @@ -246,6 +251,7 @@ public Builder type(Optional type) { return this; } + /** * Optional ID of the content */ @@ -263,14 +269,13 @@ public Builder id(Optional id) { this.id = id; return this; } - + public TaskExportData build() { + return new TaskExportData( - content, - ipfs, - type, + content, ipfs, type, id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TaskHls.java b/src/main/java/studio/livepeer/livepeer/models/components/TaskHls.java index 1a26e0ed..acdc0776 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TaskHls.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TaskHls.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,16 +10,15 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * TaskHls - HLS output format + * TaskHls + * + *

HLS output format */ - public class TaskHls { - /** * Path for the HLS output */ @@ -48,10 +45,11 @@ public Optional path() { return path; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Path for the HLS output */ @@ -61,6 +59,7 @@ public TaskHls withPath(String path) { return this; } + /** * Path for the HLS output */ @@ -69,7 +68,7 @@ public TaskHls withPath(Optional path) { this.path = path; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -80,12 +79,12 @@ public boolean equals(java.lang.Object o) { } TaskHls other = (TaskHls) o; return - Objects.deepEquals(this.path, other.path); + Utils.enhancedDeepEquals(this.path, other.path); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( path); } @@ -94,15 +93,17 @@ public String toString() { return Utils.toString(TaskHls.class, "path", path); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional path = Optional.empty(); - + + private Optional path = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Path for the HLS output */ @@ -120,11 +121,12 @@ public Builder path(Optional path) { this.path = path; return this; } - + public TaskHls build() { + return new TaskHls( path); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TaskInput.java b/src/main/java/studio/livepeer/livepeer/models/components/TaskInput.java index 9db4ed2b..c554445f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TaskInput.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TaskInput.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,20 +10,18 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * TaskInput - Input video file to transcode + * TaskInput + * + *

Input video file to transcode */ - public class TaskInput { - /** * URL of a video to transcode, accepts object-store format * "s3+https" - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("url") @@ -45,21 +41,20 @@ public TaskInput() { /** * URL of a video to transcode, accepts object-store format * "s3+https" - * */ @JsonIgnore public Optional url() { return url; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * URL of a video to transcode, accepts object-store format * "s3+https" - * */ public TaskInput withUrl(String url) { Utils.checkNotNull(url, "url"); @@ -67,17 +62,17 @@ public TaskInput withUrl(String url) { return this; } + /** * URL of a video to transcode, accepts object-store format * "s3+https" - * */ public TaskInput withUrl(Optional url) { Utils.checkNotNull(url, "url"); this.url = url; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -88,12 +83,12 @@ public boolean equals(java.lang.Object o) { } TaskInput other = (TaskInput) o; return - Objects.deepEquals(this.url, other.url); + Utils.enhancedDeepEquals(this.url, other.url); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( url); } @@ -102,19 +97,20 @@ public String toString() { return Utils.toString(TaskInput.class, "url", url); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional url = Optional.empty(); - + + private Optional url = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * URL of a video to transcode, accepts object-store format * "s3+https" - * */ public Builder url(String url) { Utils.checkNotNull(url, "url"); @@ -125,18 +121,18 @@ public Builder url(String url) { /** * URL of a video to transcode, accepts object-store format * "s3+https" - * */ public Builder url(Optional url) { Utils.checkNotNull(url, "url"); this.url = url; return this; } - + public TaskInput build() { + return new TaskInput( url); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TaskIpfs.java b/src/main/java/studio/livepeer/livepeer/models/components/TaskIpfs.java index db7c9402..68c48594 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TaskIpfs.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TaskIpfs.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,13 +10,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class TaskIpfs { - /** * IPFS CID of the exported video file */ @@ -56,7 +52,6 @@ public class TaskIpfs { /** * URL to access metadata file via HTTP through an IPFS * gateway - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("nftMetadataGatewayUrl") @@ -86,7 +81,8 @@ public TaskIpfs( public TaskIpfs( String videoFileCid) { - this(videoFileCid, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(videoFileCid, Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty()); } /** @@ -132,17 +128,17 @@ public Optional nftMetadataUrl() { /** * URL to access metadata file via HTTP through an IPFS * gateway - * */ @JsonIgnore public Optional nftMetadataGatewayUrl() { return nftMetadataGatewayUrl; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * IPFS CID of the exported video file */ @@ -161,6 +157,7 @@ public TaskIpfs withVideoFileUrl(String videoFileUrl) { return this; } + /** * URL for the file with the IPFS protocol */ @@ -179,6 +176,7 @@ public TaskIpfs withVideoFileGatewayUrl(String videoFileGatewayUrl) { return this; } + /** * URL to access file via HTTP through an IPFS gateway */ @@ -197,6 +195,7 @@ public TaskIpfs withNftMetadataCid(String nftMetadataCid) { return this; } + /** * IPFS CID of the default metadata exported for the video */ @@ -215,6 +214,7 @@ public TaskIpfs withNftMetadataUrl(String nftMetadataUrl) { return this; } + /** * URL for the metadata file with the IPFS protocol */ @@ -227,7 +227,6 @@ public TaskIpfs withNftMetadataUrl(Optional nftMetadataUrl) { /** * URL to access metadata file via HTTP through an IPFS * gateway - * */ public TaskIpfs withNftMetadataGatewayUrl(String nftMetadataGatewayUrl) { Utils.checkNotNull(nftMetadataGatewayUrl, "nftMetadataGatewayUrl"); @@ -235,17 +234,17 @@ public TaskIpfs withNftMetadataGatewayUrl(String nftMetadataGatewayUrl) { return this; } + /** * URL to access metadata file via HTTP through an IPFS * gateway - * */ public TaskIpfs withNftMetadataGatewayUrl(Optional nftMetadataGatewayUrl) { Utils.checkNotNull(nftMetadataGatewayUrl, "nftMetadataGatewayUrl"); this.nftMetadataGatewayUrl = nftMetadataGatewayUrl; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -256,23 +255,19 @@ public boolean equals(java.lang.Object o) { } TaskIpfs other = (TaskIpfs) o; return - Objects.deepEquals(this.videoFileCid, other.videoFileCid) && - Objects.deepEquals(this.videoFileUrl, other.videoFileUrl) && - Objects.deepEquals(this.videoFileGatewayUrl, other.videoFileGatewayUrl) && - Objects.deepEquals(this.nftMetadataCid, other.nftMetadataCid) && - Objects.deepEquals(this.nftMetadataUrl, other.nftMetadataUrl) && - Objects.deepEquals(this.nftMetadataGatewayUrl, other.nftMetadataGatewayUrl); + Utils.enhancedDeepEquals(this.videoFileCid, other.videoFileCid) && + Utils.enhancedDeepEquals(this.videoFileUrl, other.videoFileUrl) && + Utils.enhancedDeepEquals(this.videoFileGatewayUrl, other.videoFileGatewayUrl) && + Utils.enhancedDeepEquals(this.nftMetadataCid, other.nftMetadataCid) && + Utils.enhancedDeepEquals(this.nftMetadataUrl, other.nftMetadataUrl) && + Utils.enhancedDeepEquals(this.nftMetadataGatewayUrl, other.nftMetadataGatewayUrl); } @Override public int hashCode() { - return Objects.hash( - videoFileCid, - videoFileUrl, - videoFileGatewayUrl, - nftMetadataCid, - nftMetadataUrl, - nftMetadataGatewayUrl); + return Utils.enhancedHash( + videoFileCid, videoFileUrl, videoFileGatewayUrl, + nftMetadataCid, nftMetadataUrl, nftMetadataGatewayUrl); } @Override @@ -285,25 +280,27 @@ public String toString() { "nftMetadataUrl", nftMetadataUrl, "nftMetadataGatewayUrl", nftMetadataGatewayUrl); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String videoFileCid; - + private Optional videoFileUrl = Optional.empty(); - + private Optional videoFileGatewayUrl = Optional.empty(); - + private Optional nftMetadataCid = Optional.empty(); - + private Optional nftMetadataUrl = Optional.empty(); - - private Optional nftMetadataGatewayUrl = Optional.empty(); - + + private Optional nftMetadataGatewayUrl = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * IPFS CID of the exported video file */ @@ -313,6 +310,7 @@ public Builder videoFileCid(String videoFileCid) { return this; } + /** * URL for the file with the IPFS protocol */ @@ -331,6 +329,7 @@ public Builder videoFileUrl(Optional videoFileUrl) { return this; } + /** * URL to access file via HTTP through an IPFS gateway */ @@ -349,6 +348,7 @@ public Builder videoFileGatewayUrl(Optional videoFileGatewayUrl) { return this; } + /** * IPFS CID of the default metadata exported for the video */ @@ -367,6 +367,7 @@ public Builder nftMetadataCid(Optional nftMetadataCid) { return this; } + /** * URL for the metadata file with the IPFS protocol */ @@ -385,10 +386,10 @@ public Builder nftMetadataUrl(Optional nftMetadataUrl) { return this; } + /** * URL to access metadata file via HTTP through an IPFS * gateway - * */ public Builder nftMetadataGatewayUrl(String nftMetadataGatewayUrl) { Utils.checkNotNull(nftMetadataGatewayUrl, "nftMetadataGatewayUrl"); @@ -399,23 +400,19 @@ public Builder nftMetadataGatewayUrl(String nftMetadataGatewayUrl) { /** * URL to access metadata file via HTTP through an IPFS * gateway - * */ public Builder nftMetadataGatewayUrl(Optional nftMetadataGatewayUrl) { Utils.checkNotNull(nftMetadataGatewayUrl, "nftMetadataGatewayUrl"); this.nftMetadataGatewayUrl = nftMetadataGatewayUrl; return this; } - + public TaskIpfs build() { + return new TaskIpfs( - videoFileCid, - videoFileUrl, - videoFileGatewayUrl, - nftMetadataCid, - nftMetadataUrl, - nftMetadataGatewayUrl); + videoFileCid, videoFileUrl, videoFileGatewayUrl, + nftMetadataCid, nftMetadataUrl, nftMetadataGatewayUrl); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TaskMp4.java b/src/main/java/studio/livepeer/livepeer/models/components/TaskMp4.java index 1bd1e91e..251758ff 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TaskMp4.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TaskMp4.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,16 +10,15 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * TaskMp4 - MP4 output format + * TaskMp4 + * + *

MP4 output format */ - public class TaskMp4 { - /** * Path for the MP4 output */ @@ -48,10 +45,11 @@ public Optional path() { return path; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Path for the MP4 output */ @@ -61,6 +59,7 @@ public TaskMp4 withPath(String path) { return this; } + /** * Path for the MP4 output */ @@ -69,7 +68,7 @@ public TaskMp4 withPath(Optional path) { this.path = path; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -80,12 +79,12 @@ public boolean equals(java.lang.Object o) { } TaskMp4 other = (TaskMp4) o; return - Objects.deepEquals(this.path, other.path); + Utils.enhancedDeepEquals(this.path, other.path); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( path); } @@ -94,15 +93,17 @@ public String toString() { return Utils.toString(TaskMp4.class, "path", path); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional path = Optional.empty(); - + + private Optional path = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Path for the MP4 output */ @@ -120,11 +121,12 @@ public Builder path(Optional path) { this.path = path; return this; } - + public TaskMp4 build() { + return new TaskMp4( path); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TaskOutputIpfs.java b/src/main/java/studio/livepeer/livepeer/models/components/TaskOutputIpfs.java index 9a42f56b..4c87fa59 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TaskOutputIpfs.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TaskOutputIpfs.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; public class TaskOutputIpfs { - /** * IPFS CID of the exported data */ @@ -37,10 +33,11 @@ public String cid() { return cid; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * IPFS CID of the exported data */ @@ -49,7 +46,7 @@ public TaskOutputIpfs withCid(String cid) { this.cid = cid; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } TaskOutputIpfs other = (TaskOutputIpfs) o; return - Objects.deepEquals(this.cid, other.cid); + Utils.enhancedDeepEquals(this.cid, other.cid); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( cid); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(TaskOutputIpfs.class, "cid", cid); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String cid; - + + private String cid; + private Builder() { // force use of static builder() method } + /** * IPFS CID of the exported data */ @@ -91,11 +90,12 @@ public Builder cid(String cid) { this.cid = cid; return this; } - + public TaskOutputIpfs build() { + return new TaskOutputIpfs( cid); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TaskOutputs.java b/src/main/java/studio/livepeer/livepeer/models/components/TaskOutputs.java index 01fa3345..81c9a70b 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TaskOutputs.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TaskOutputs.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,16 +11,15 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * TaskOutputs - Output formats + * TaskOutputs + * + *

Output formats */ - public class TaskOutputs { - /** * HLS output format */ @@ -69,10 +66,11 @@ public Optional mp4() { return (Optional) mp4; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HLS output format */ @@ -82,6 +80,7 @@ public TaskOutputs withHls(TaskHls hls) { return this; } + /** * HLS output format */ @@ -100,6 +99,7 @@ public TaskOutputs withMp4(TaskMp4 mp4) { return this; } + /** * MP4 output format */ @@ -108,7 +108,7 @@ public TaskOutputs withMp4(Optional mp4) { this.mp4 = mp4; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -119,15 +119,14 @@ public boolean equals(java.lang.Object o) { } TaskOutputs other = (TaskOutputs) o; return - Objects.deepEquals(this.hls, other.hls) && - Objects.deepEquals(this.mp4, other.mp4); + Utils.enhancedDeepEquals(this.hls, other.hls) && + Utils.enhancedDeepEquals(this.mp4, other.mp4); } @Override public int hashCode() { - return Objects.hash( - hls, - mp4); + return Utils.enhancedHash( + hls, mp4); } @Override @@ -136,17 +135,19 @@ public String toString() { "hls", hls, "mp4", mp4); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional hls = Optional.empty(); - - private Optional mp4 = Optional.empty(); - + + private Optional mp4 = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HLS output format */ @@ -165,6 +166,7 @@ public Builder hls(Optional hls) { return this; } + /** * MP4 output format */ @@ -182,12 +184,12 @@ public Builder mp4(Optional mp4) { this.mp4 = mp4; return this; } - + public TaskOutputs build() { + return new TaskOutputs( - hls, - mp4); + hls, mp4); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TaskPhase.java b/src/main/java/studio/livepeer/livepeer/models/components/TaskPhase.java index 4bcc4bdb..5187ef49 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TaskPhase.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TaskPhase.java @@ -1,14 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * TaskPhase - Phase of the task + * TaskPhase + * + *

Phase of the task */ public enum TaskPhase { PENDING("pending"), @@ -21,11 +24,21 @@ public enum TaskPhase { @JsonValue private final String value; - private TaskPhase(String value) { + TaskPhase(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (TaskPhase o: TaskPhase.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TaskStatus.java b/src/main/java/studio/livepeer/livepeer/models/components/TaskStatus.java index 279dda3e..9b9a454a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TaskStatus.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TaskStatus.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,16 +11,15 @@ import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * TaskStatus - Status of the task + * TaskStatus + * + *

Status of the task */ - public class TaskStatus { - /** * Phase of the task */ @@ -78,7 +75,8 @@ public TaskStatus( public TaskStatus( TaskPhase phase, double updatedAt) { - this(phase, updatedAt, Optional.empty(), Optional.empty(), Optional.empty()); + this(phase, updatedAt, Optional.empty(), + Optional.empty(), Optional.empty()); } /** @@ -121,10 +119,11 @@ public Optional retries() { return retries; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Phase of the task */ @@ -152,6 +151,7 @@ public TaskStatus withProgress(double progress) { return this; } + /** * Current progress of the task in a 0-1 ratio */ @@ -170,6 +170,7 @@ public TaskStatus withErrorMessage(String errorMessage) { return this; } + /** * Error message if the task failed */ @@ -188,6 +189,7 @@ public TaskStatus withRetries(double retries) { return this; } + /** * Number of retries done on the task */ @@ -196,7 +198,7 @@ public TaskStatus withRetries(Optional retries) { this.retries = retries; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -207,21 +209,18 @@ public boolean equals(java.lang.Object o) { } TaskStatus other = (TaskStatus) o; return - Objects.deepEquals(this.phase, other.phase) && - Objects.deepEquals(this.updatedAt, other.updatedAt) && - Objects.deepEquals(this.progress, other.progress) && - Objects.deepEquals(this.errorMessage, other.errorMessage) && - Objects.deepEquals(this.retries, other.retries); + Utils.enhancedDeepEquals(this.phase, other.phase) && + Utils.enhancedDeepEquals(this.updatedAt, other.updatedAt) && + Utils.enhancedDeepEquals(this.progress, other.progress) && + Utils.enhancedDeepEquals(this.errorMessage, other.errorMessage) && + Utils.enhancedDeepEquals(this.retries, other.retries); } @Override public int hashCode() { - return Objects.hash( - phase, - updatedAt, - progress, - errorMessage, - retries); + return Utils.enhancedHash( + phase, updatedAt, progress, + errorMessage, retries); } @Override @@ -233,23 +232,25 @@ public String toString() { "errorMessage", errorMessage, "retries", retries); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private TaskPhase phase; - + private Double updatedAt; - + private Optional progress = Optional.empty(); - + private Optional errorMessage = Optional.empty(); - - private Optional retries = Optional.empty(); - + + private Optional retries = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Phase of the task */ @@ -259,6 +260,7 @@ public Builder phase(TaskPhase phase) { return this; } + /** * Timestamp (in milliseconds) at which task was updated */ @@ -268,6 +270,7 @@ public Builder updatedAt(double updatedAt) { return this; } + /** * Current progress of the task in a 0-1 ratio */ @@ -286,6 +289,7 @@ public Builder progress(Optional progress) { return this; } + /** * Error message if the task failed */ @@ -304,6 +308,7 @@ public Builder errorMessage(Optional errorMessage) { return this; } + /** * Number of retries done on the task */ @@ -321,15 +326,13 @@ public Builder retries(Optional retries) { this.retries = retries; return this; } - + public TaskStatus build() { + return new TaskStatus( - phase, - updatedAt, - progress, - errorMessage, - retries); + phase, updatedAt, progress, + errorMessage, retries); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TaskStorage.java b/src/main/java/studio/livepeer/livepeer/models/components/TaskStorage.java index 9992a339..2e6aa3fa 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TaskStorage.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TaskStorage.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,20 +10,18 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * TaskStorage - Storage for the output files + * TaskStorage + * + *

Storage for the output files */ - public class TaskStorage { - /** * URL of the output storage, accepts object-store format * "s3+https" - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("url") @@ -45,21 +41,20 @@ public TaskStorage() { /** * URL of the output storage, accepts object-store format * "s3+https" - * */ @JsonIgnore public Optional url() { return url; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * URL of the output storage, accepts object-store format * "s3+https" - * */ public TaskStorage withUrl(String url) { Utils.checkNotNull(url, "url"); @@ -67,17 +62,17 @@ public TaskStorage withUrl(String url) { return this; } + /** * URL of the output storage, accepts object-store format * "s3+https" - * */ public TaskStorage withUrl(Optional url) { Utils.checkNotNull(url, "url"); this.url = url; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -88,12 +83,12 @@ public boolean equals(java.lang.Object o) { } TaskStorage other = (TaskStorage) o; return - Objects.deepEquals(this.url, other.url); + Utils.enhancedDeepEquals(this.url, other.url); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( url); } @@ -102,19 +97,20 @@ public String toString() { return Utils.toString(TaskStorage.class, "url", url); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional url = Optional.empty(); - + + private Optional url = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * URL of the output storage, accepts object-store format * "s3+https" - * */ public Builder url(String url) { Utils.checkNotNull(url, "url"); @@ -125,18 +121,18 @@ public Builder url(String url) { /** * URL of the output storage, accepts object-store format * "s3+https" - * */ public Builder url(Optional url) { Utils.checkNotNull(url, "url"); this.url = url; return this; } - + public TaskStorage build() { + return new TaskStorage( url); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TaskType.java b/src/main/java/studio/livepeer/livepeer/models/components/TaskType.java index c00af619..4ec08a35 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TaskType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TaskType.java @@ -1,14 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * TaskType - Type of the task + * TaskType + * + *

Type of the task */ public enum TaskType { UPLOAD("upload"), @@ -20,11 +23,21 @@ public enum TaskType { @JsonValue private final String value; - private TaskType(String value) { + TaskType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (TaskType o: TaskType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TaskUpload.java b/src/main/java/studio/livepeer/livepeer/models/components/TaskUpload.java new file mode 100644 index 00000000..e3f2461d --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/components/TaskUpload.java @@ -0,0 +1,166 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.components; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import studio.livepeer.livepeer.utils.Utils; + +/** + * TaskUpload + * + *

Output of the upload task + */ +public class TaskUpload { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("assetSpec") + private Optional assetSpec; + + + @JsonIgnore + private Map additionalProperties; + + @JsonCreator + public TaskUpload( + @JsonProperty("assetSpec") Optional assetSpec) { + Utils.checkNotNull(assetSpec, "assetSpec"); + this.assetSpec = assetSpec; + this.additionalProperties = new HashMap<>(); + } + + public TaskUpload() { + this(Optional.empty()); + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional assetSpec() { + return (Optional) assetSpec; + } + + @JsonAnyGetter + public Map additionalProperties() { + return additionalProperties; + } + + public static Builder builder() { + return new Builder(); + } + + + public TaskUpload withAssetSpec(Asset assetSpec) { + Utils.checkNotNull(assetSpec, "assetSpec"); + this.assetSpec = Optional.ofNullable(assetSpec); + return this; + } + + + public TaskUpload withAssetSpec(Optional assetSpec) { + Utils.checkNotNull(assetSpec, "assetSpec"); + this.assetSpec = assetSpec; + return this; + } + + @JsonAnySetter + public TaskUpload withAdditionalProperty(String key, Object value) { + // note that value can be null because of the way JsonAnySetter works + Utils.checkNotNull(key, "key"); + additionalProperties.put(key, value); + return this; + } + public TaskUpload withAdditionalProperties(Map additionalProperties) { + Utils.checkNotNull(additionalProperties, "additionalProperties"); + this.additionalProperties = additionalProperties; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TaskUpload other = (TaskUpload) o; + return + Utils.enhancedDeepEquals(this.assetSpec, other.assetSpec) && + Utils.enhancedDeepEquals(this.additionalProperties, other.additionalProperties); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + assetSpec, additionalProperties); + } + + @Override + public String toString() { + return Utils.toString(TaskUpload.class, + "assetSpec", assetSpec, + "additionalProperties", additionalProperties); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private Optional assetSpec = Optional.empty(); + + private Map additionalProperties = new HashMap<>(); + + private Builder() { + // force use of static builder() method + } + + + public Builder assetSpec(Asset assetSpec) { + Utils.checkNotNull(assetSpec, "assetSpec"); + this.assetSpec = Optional.ofNullable(assetSpec); + return this; + } + + public Builder assetSpec(Optional assetSpec) { + Utils.checkNotNull(assetSpec, "assetSpec"); + this.assetSpec = assetSpec; + return this; + } + + public Builder additionalProperty(String key, Object value) { + Utils.checkNotNull(key, "key"); + // we could be strict about null values (force the user + // to pass `JsonNullable.of(null)`) but likely to be a bit + // annoying for additional properties building so we'll + // relax preconditions. + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + Utils.checkNotNull(additionalProperties, "additionalProperties"); + this.additionalProperties = additionalProperties; + return this; + } + + public TaskUpload build() { + + return new TaskUpload( + assetSpec) + .withAdditionalProperties(additionalProperties); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Tasks.java b/src/main/java/studio/livepeer/livepeer/models/components/Tasks.java index d055e2f0..9536ecaa 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Tasks.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Tasks.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,17 +10,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class Tasks { - /** * ID of any currently running task that is exporting this * asset to IPFS. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("pending") @@ -31,7 +26,6 @@ public class Tasks { /** * ID of the last task to run successfully, that created * the currently saved data. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("last") @@ -64,7 +58,6 @@ public Tasks() { /** * ID of any currently running task that is exporting this * asset to IPFS. - * */ @JsonIgnore public Optional pending() { @@ -74,7 +67,6 @@ public Optional pending() { /** * ID of the last task to run successfully, that created * the currently saved data. - * */ @JsonIgnore public Optional last() { @@ -89,14 +81,14 @@ public Optional failed() { return failed; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of any currently running task that is exporting this * asset to IPFS. - * */ public Tasks withPending(String pending) { Utils.checkNotNull(pending, "pending"); @@ -104,10 +96,10 @@ public Tasks withPending(String pending) { return this; } + /** * ID of any currently running task that is exporting this * asset to IPFS. - * */ public Tasks withPending(Optional pending) { Utils.checkNotNull(pending, "pending"); @@ -118,7 +110,6 @@ public Tasks withPending(Optional pending) { /** * ID of the last task to run successfully, that created * the currently saved data. - * */ public Tasks withLast(String last) { Utils.checkNotNull(last, "last"); @@ -126,10 +117,10 @@ public Tasks withLast(String last) { return this; } + /** * ID of the last task to run successfully, that created * the currently saved data. - * */ public Tasks withLast(Optional last) { Utils.checkNotNull(last, "last"); @@ -146,6 +137,7 @@ public Tasks withFailed(String failed) { return this; } + /** * ID of the last task to fail execution. */ @@ -154,7 +146,7 @@ public Tasks withFailed(Optional failed) { this.failed = failed; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -165,17 +157,15 @@ public boolean equals(java.lang.Object o) { } Tasks other = (Tasks) o; return - Objects.deepEquals(this.pending, other.pending) && - Objects.deepEquals(this.last, other.last) && - Objects.deepEquals(this.failed, other.failed); + Utils.enhancedDeepEquals(this.pending, other.pending) && + Utils.enhancedDeepEquals(this.last, other.last) && + Utils.enhancedDeepEquals(this.failed, other.failed); } @Override public int hashCode() { - return Objects.hash( - pending, - last, - failed); + return Utils.enhancedHash( + pending, last, failed); } @Override @@ -185,23 +175,24 @@ public String toString() { "last", last, "failed", failed); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional pending = Optional.empty(); - + private Optional last = Optional.empty(); - - private Optional failed = Optional.empty(); - + + private Optional failed = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * ID of any currently running task that is exporting this * asset to IPFS. - * */ public Builder pending(String pending) { Utils.checkNotNull(pending, "pending"); @@ -212,7 +203,6 @@ public Builder pending(String pending) { /** * ID of any currently running task that is exporting this * asset to IPFS. - * */ public Builder pending(Optional pending) { Utils.checkNotNull(pending, "pending"); @@ -220,10 +210,10 @@ public Builder pending(Optional pending) { return this; } + /** * ID of the last task to run successfully, that created * the currently saved data. - * */ public Builder last(String last) { Utils.checkNotNull(last, "last"); @@ -234,7 +224,6 @@ public Builder last(String last) { /** * ID of the last task to run successfully, that created * the currently saved data. - * */ public Builder last(Optional last) { Utils.checkNotNull(last, "last"); @@ -242,6 +231,7 @@ public Builder last(Optional last) { return this; } + /** * ID of the last task to fail execution. */ @@ -259,13 +249,12 @@ public Builder failed(Optional failed) { this.failed = failed; return this; } - + public Tasks build() { + return new Tasks( - pending, - last, - failed); + pending, last, failed); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Three.java b/src/main/java/studio/livepeer/livepeer/models/components/Three.java index edbb17bd..d4bc62fc 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Three.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Three.java @@ -1,24 +1,21 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Double; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; import studio.livepeer.livepeer.utils.Utils.TypeReferenceWithShape; import studio.livepeer.livepeer.utils.Utils; - @JsonDeserialize(using = Three._Deserializer.class) public class Three { @@ -70,12 +67,12 @@ public boolean equals(java.lang.Object o) { return false; } Three other = (Three) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -83,8 +80,8 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(Three.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -95,3 +92,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Tracks.java b/src/main/java/studio/livepeer/livepeer/models/components/Tracks.java index fc31952a..7c0c0aa9 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Tracks.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Tracks.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,13 +11,11 @@ import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; public class Tracks { - /** * type of track */ @@ -91,7 +87,6 @@ public class Tracks { /** * Sample rate of the track in samples per second - only for * audio tracks - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("sampleRate") @@ -147,7 +142,10 @@ public Tracks( public Tracks( AssetVideoSpecType type, String codec) { - this(type, codec, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(type, codec, Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty()); } /** @@ -233,7 +231,6 @@ public Optional channels() { /** * Sample rate of the track in samples per second - only for * audio tracks - * */ @JsonIgnore public Optional sampleRate() { @@ -248,10 +245,11 @@ public Optional bitDepth() { return bitDepth; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * type of track */ @@ -279,6 +277,7 @@ public Tracks withStartTime(double startTime) { return this; } + /** * Start time of the track in seconds */ @@ -297,6 +296,7 @@ public Tracks withDuration(double duration) { return this; } + /** * Duration of the track in seconds */ @@ -315,6 +315,7 @@ public Tracks withBitrate(double bitrate) { return this; } + /** * Bitrate of the track in bits per second */ @@ -333,6 +334,7 @@ public Tracks withWidth(double width) { return this; } + /** * Width of the track - only for video tracks */ @@ -351,6 +353,7 @@ public Tracks withHeight(double height) { return this; } + /** * Height of the track - only for video tracks */ @@ -369,6 +372,7 @@ public Tracks withPixelFormat(String pixelFormat) { return this; } + /** * Pixel format of the track - only for video tracks */ @@ -387,6 +391,7 @@ public Tracks withFps(double fps) { return this; } + /** * Frame rate of the track - only for video tracks */ @@ -405,6 +410,7 @@ public Tracks withChannels(double channels) { return this; } + /** * Amount of audio channels in the track */ @@ -417,7 +423,6 @@ public Tracks withChannels(Optional channels) { /** * Sample rate of the track in samples per second - only for * audio tracks - * */ public Tracks withSampleRate(double sampleRate) { Utils.checkNotNull(sampleRate, "sampleRate"); @@ -425,10 +430,10 @@ public Tracks withSampleRate(double sampleRate) { return this; } + /** * Sample rate of the track in samples per second - only for * audio tracks - * */ public Tracks withSampleRate(Optional sampleRate) { Utils.checkNotNull(sampleRate, "sampleRate"); @@ -445,6 +450,7 @@ public Tracks withBitDepth(double bitDepth) { return this; } + /** * Bit depth of the track - only for audio tracks */ @@ -453,7 +459,7 @@ public Tracks withBitDepth(Optional bitDepth) { this.bitDepth = bitDepth; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -464,35 +470,27 @@ public boolean equals(java.lang.Object o) { } Tracks other = (Tracks) o; return - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.codec, other.codec) && - Objects.deepEquals(this.startTime, other.startTime) && - Objects.deepEquals(this.duration, other.duration) && - Objects.deepEquals(this.bitrate, other.bitrate) && - Objects.deepEquals(this.width, other.width) && - Objects.deepEquals(this.height, other.height) && - Objects.deepEquals(this.pixelFormat, other.pixelFormat) && - Objects.deepEquals(this.fps, other.fps) && - Objects.deepEquals(this.channels, other.channels) && - Objects.deepEquals(this.sampleRate, other.sampleRate) && - Objects.deepEquals(this.bitDepth, other.bitDepth); + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.codec, other.codec) && + Utils.enhancedDeepEquals(this.startTime, other.startTime) && + Utils.enhancedDeepEquals(this.duration, other.duration) && + Utils.enhancedDeepEquals(this.bitrate, other.bitrate) && + Utils.enhancedDeepEquals(this.width, other.width) && + Utils.enhancedDeepEquals(this.height, other.height) && + Utils.enhancedDeepEquals(this.pixelFormat, other.pixelFormat) && + Utils.enhancedDeepEquals(this.fps, other.fps) && + Utils.enhancedDeepEquals(this.channels, other.channels) && + Utils.enhancedDeepEquals(this.sampleRate, other.sampleRate) && + Utils.enhancedDeepEquals(this.bitDepth, other.bitDepth); } @Override public int hashCode() { - return Objects.hash( - type, - codec, - startTime, - duration, - bitrate, - width, - height, - pixelFormat, - fps, - channels, - sampleRate, - bitDepth); + return Utils.enhancedHash( + type, codec, startTime, + duration, bitrate, width, + height, pixelFormat, fps, + channels, sampleRate, bitDepth); } @Override @@ -511,37 +509,39 @@ public String toString() { "sampleRate", sampleRate, "bitDepth", bitDepth); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private AssetVideoSpecType type; - + private String codec; - + private Optional startTime = Optional.empty(); - + private Optional duration = Optional.empty(); - + private Optional bitrate = Optional.empty(); - + private Optional width = Optional.empty(); - + private Optional height = Optional.empty(); - + private Optional pixelFormat = Optional.empty(); - + private Optional fps = Optional.empty(); - + private Optional channels = Optional.empty(); - + private Optional sampleRate = Optional.empty(); - - private Optional bitDepth = Optional.empty(); - + + private Optional bitDepth = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * type of track */ @@ -551,6 +551,7 @@ public Builder type(AssetVideoSpecType type) { return this; } + /** * Codec of the track */ @@ -560,6 +561,7 @@ public Builder codec(String codec) { return this; } + /** * Start time of the track in seconds */ @@ -578,6 +580,7 @@ public Builder startTime(Optional startTime) { return this; } + /** * Duration of the track in seconds */ @@ -596,6 +599,7 @@ public Builder duration(Optional duration) { return this; } + /** * Bitrate of the track in bits per second */ @@ -614,6 +618,7 @@ public Builder bitrate(Optional bitrate) { return this; } + /** * Width of the track - only for video tracks */ @@ -632,6 +637,7 @@ public Builder width(Optional width) { return this; } + /** * Height of the track - only for video tracks */ @@ -650,6 +656,7 @@ public Builder height(Optional height) { return this; } + /** * Pixel format of the track - only for video tracks */ @@ -668,6 +675,7 @@ public Builder pixelFormat(Optional pixelFormat) { return this; } + /** * Frame rate of the track - only for video tracks */ @@ -686,6 +694,7 @@ public Builder fps(Optional fps) { return this; } + /** * Amount of audio channels in the track */ @@ -704,10 +713,10 @@ public Builder channels(Optional channels) { return this; } + /** * Sample rate of the track in samples per second - only for * audio tracks - * */ public Builder sampleRate(double sampleRate) { Utils.checkNotNull(sampleRate, "sampleRate"); @@ -718,7 +727,6 @@ public Builder sampleRate(double sampleRate) { /** * Sample rate of the track in samples per second - only for * audio tracks - * */ public Builder sampleRate(Optional sampleRate) { Utils.checkNotNull(sampleRate, "sampleRate"); @@ -726,6 +734,7 @@ public Builder sampleRate(Optional sampleRate) { return this; } + /** * Bit depth of the track - only for audio tracks */ @@ -743,22 +752,15 @@ public Builder bitDepth(Optional bitDepth) { this.bitDepth = bitDepth; return this; } - + public Tracks build() { + return new Tracks( - type, - codec, - startTime, - duration, - bitrate, - width, - height, - pixelFormat, - fps, - channels, - sampleRate, - bitDepth); + type, codec, startTime, + duration, bitrate, width, + height, pixelFormat, fps, + channels, sampleRate, bitDepth); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TranscodeFile.java b/src/main/java/studio/livepeer/livepeer/models/components/TranscodeFile.java index 8ff29f96..5248667d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TranscodeFile.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TranscodeFile.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -16,16 +14,15 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * TranscodeFile - Parameters for the transcode-file task + * TranscodeFile + * + *

Parameters for the transcode-file task */ - public class TranscodeFile { - /** * Input video file to transcode */ @@ -47,6 +44,7 @@ public class TranscodeFile { @JsonProperty("outputs") private Optional outputs; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("profiles") private Optional> profiles; @@ -54,12 +52,12 @@ public class TranscodeFile { /** * How many seconds the duration of each output segment should * be - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("targetSegmentSizeSecs") private Optional targetSegmentSizeSecs; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("creatorId") private Optional creatorId; @@ -97,7 +95,9 @@ public TranscodeFile( } public TranscodeFile() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -136,7 +136,6 @@ public Optional> profiles() { /** * How many seconds the duration of each output segment should * be - * */ @JsonIgnore public Optional targetSegmentSizeSecs() { @@ -157,10 +156,11 @@ public Optional c2pa() { return c2pa; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Input video file to transcode */ @@ -170,6 +170,7 @@ public TranscodeFile withInput(TaskInput input) { return this; } + /** * Input video file to transcode */ @@ -188,6 +189,7 @@ public TranscodeFile withStorage(TaskStorage storage) { return this; } + /** * Storage for the output files */ @@ -206,6 +208,7 @@ public TranscodeFile withOutputs(TaskOutputs outputs) { return this; } + /** * Output formats */ @@ -221,6 +224,7 @@ public TranscodeFile withProfiles(List profiles) { return this; } + public TranscodeFile withProfiles(Optional> profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = profiles; @@ -230,7 +234,6 @@ public TranscodeFile withProfiles(Optional> pro /** * How many seconds the duration of each output segment should * be - * */ public TranscodeFile withTargetSegmentSizeSecs(double targetSegmentSizeSecs) { Utils.checkNotNull(targetSegmentSizeSecs, "targetSegmentSizeSecs"); @@ -238,10 +241,10 @@ public TranscodeFile withTargetSegmentSizeSecs(double targetSegmentSizeSecs) { return this; } + /** * How many seconds the duration of each output segment should * be - * */ public TranscodeFile withTargetSegmentSizeSecs(Optional targetSegmentSizeSecs) { Utils.checkNotNull(targetSegmentSizeSecs, "targetSegmentSizeSecs"); @@ -255,6 +258,7 @@ public TranscodeFile withCreatorId(InputCreatorId creatorId) { return this; } + public TranscodeFile withCreatorId(Optional creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = creatorId; @@ -270,6 +274,7 @@ public TranscodeFile withC2pa(boolean c2pa) { return this; } + /** * Decides if the output video should include C2PA signature */ @@ -278,7 +283,7 @@ public TranscodeFile withC2pa(Optional c2pa) { this.c2pa = c2pa; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -289,24 +294,20 @@ public boolean equals(java.lang.Object o) { } TranscodeFile other = (TranscodeFile) o; return - Objects.deepEquals(this.input, other.input) && - Objects.deepEquals(this.storage, other.storage) && - Objects.deepEquals(this.outputs, other.outputs) && - Objects.deepEquals(this.profiles, other.profiles) && - Objects.deepEquals(this.targetSegmentSizeSecs, other.targetSegmentSizeSecs) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.c2pa, other.c2pa); + Utils.enhancedDeepEquals(this.input, other.input) && + Utils.enhancedDeepEquals(this.storage, other.storage) && + Utils.enhancedDeepEquals(this.outputs, other.outputs) && + Utils.enhancedDeepEquals(this.profiles, other.profiles) && + Utils.enhancedDeepEquals(this.targetSegmentSizeSecs, other.targetSegmentSizeSecs) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.c2pa, other.c2pa); } @Override public int hashCode() { - return Objects.hash( - input, - storage, - outputs, - profiles, - targetSegmentSizeSecs, - creatorId, + return Utils.enhancedHash( + input, storage, outputs, + profiles, targetSegmentSizeSecs, creatorId, c2pa); } @@ -321,27 +322,29 @@ public String toString() { "creatorId", creatorId, "c2pa", c2pa); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional input = Optional.empty(); - + private Optional storage = Optional.empty(); - + private Optional outputs = Optional.empty(); - + private Optional> profiles = Optional.empty(); - + private Optional targetSegmentSizeSecs = Optional.empty(); - + private Optional creatorId = Optional.empty(); - - private Optional c2pa = Optional.empty(); - + + private Optional c2pa = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Input video file to transcode */ @@ -360,6 +363,7 @@ public Builder input(Optional input) { return this; } + /** * Storage for the output files */ @@ -378,6 +382,7 @@ public Builder storage(Optional storage) { return this; } + /** * Output formats */ @@ -396,6 +401,7 @@ public Builder outputs(Optional outputs) { return this; } + public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = Optional.ofNullable(profiles); @@ -408,10 +414,10 @@ public Builder profiles(Optional> profiles) { return this; } + /** * How many seconds the duration of each output segment should * be - * */ public Builder targetSegmentSizeSecs(double targetSegmentSizeSecs) { Utils.checkNotNull(targetSegmentSizeSecs, "targetSegmentSizeSecs"); @@ -422,7 +428,6 @@ public Builder targetSegmentSizeSecs(double targetSegmentSizeSecs) { /** * How many seconds the duration of each output segment should * be - * */ public Builder targetSegmentSizeSecs(Optional targetSegmentSizeSecs) { Utils.checkNotNull(targetSegmentSizeSecs, "targetSegmentSizeSecs"); @@ -430,6 +435,7 @@ public Builder targetSegmentSizeSecs(Optional targetSegmentSizeSecs) { return this; } + public Builder creatorId(InputCreatorId creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = Optional.ofNullable(creatorId); @@ -442,6 +448,7 @@ public Builder creatorId(Optional creatorId) { return this; } + /** * Decides if the output video should include C2PA signature */ @@ -459,17 +466,14 @@ public Builder c2pa(Optional c2pa) { this.c2pa = c2pa; return this; } - + public TranscodeFile build() { + return new TranscodeFile( - input, - storage, - outputs, - profiles, - targetSegmentSizeSecs, - creatorId, + input, storage, outputs, + profiles, targetSegmentSizeSecs, creatorId, c2pa); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayload.java b/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayload.java index 4d11e80a..8ff276a5 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayload.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayload.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -16,7 +14,6 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -26,6 +23,7 @@ public class TranscodePayload { @JsonProperty("input") private Input input; + @JsonProperty("storage") private TranscodePayloadStorage storage; @@ -35,6 +33,7 @@ public class TranscodePayload { @JsonProperty("outputs") private Outputs outputs; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("profiles") private Optional> profiles; @@ -46,6 +45,7 @@ public class TranscodePayload { @JsonProperty("targetSegmentSizeSecs") private Optional targetSegmentSizeSecs; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("creatorId") private Optional creatorId; @@ -86,7 +86,9 @@ public TranscodePayload( Input input, TranscodePayloadStorage storage, Outputs outputs) { - this(input, storage, outputs, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(input, storage, outputs, + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } @JsonIgnore @@ -135,10 +137,11 @@ public Optional c2pa() { return c2pa; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public TranscodePayload withInput(Input input) { Utils.checkNotNull(input, "input"); this.input = input; @@ -166,6 +169,7 @@ public TranscodePayload withProfiles(List profiles) { return this; } + public TranscodePayload withProfiles(Optional> profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = profiles; @@ -181,6 +185,7 @@ public TranscodePayload withTargetSegmentSizeSecs(double targetSegmentSizeSecs) return this; } + /** * How many seconds the duration of each output segment should be */ @@ -196,6 +201,7 @@ public TranscodePayload withCreatorId(InputCreatorId creatorId) { return this; } + public TranscodePayload withCreatorId(Optional creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = creatorId; @@ -211,6 +217,7 @@ public TranscodePayload withC2pa(boolean c2pa) { return this; } + /** * Decides if the output video should include C2PA signature */ @@ -219,7 +226,7 @@ public TranscodePayload withC2pa(Optional c2pa) { this.c2pa = c2pa; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -230,24 +237,20 @@ public boolean equals(java.lang.Object o) { } TranscodePayload other = (TranscodePayload) o; return - Objects.deepEquals(this.input, other.input) && - Objects.deepEquals(this.storage, other.storage) && - Objects.deepEquals(this.outputs, other.outputs) && - Objects.deepEquals(this.profiles, other.profiles) && - Objects.deepEquals(this.targetSegmentSizeSecs, other.targetSegmentSizeSecs) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.c2pa, other.c2pa); + Utils.enhancedDeepEquals(this.input, other.input) && + Utils.enhancedDeepEquals(this.storage, other.storage) && + Utils.enhancedDeepEquals(this.outputs, other.outputs) && + Utils.enhancedDeepEquals(this.profiles, other.profiles) && + Utils.enhancedDeepEquals(this.targetSegmentSizeSecs, other.targetSegmentSizeSecs) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.c2pa, other.c2pa); } @Override public int hashCode() { - return Objects.hash( - input, - storage, - outputs, - profiles, - targetSegmentSizeSecs, - creatorId, + return Utils.enhancedHash( + input, storage, outputs, + profiles, targetSegmentSizeSecs, creatorId, c2pa); } @@ -262,39 +265,43 @@ public String toString() { "creatorId", creatorId, "c2pa", c2pa); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Input input; - + private TranscodePayloadStorage storage; - + private Outputs outputs; - + private Optional> profiles = Optional.empty(); - + private Optional targetSegmentSizeSecs = Optional.empty(); - + private Optional creatorId = Optional.empty(); - - private Optional c2pa = Optional.empty(); - + + private Optional c2pa = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder input(Input input) { Utils.checkNotNull(input, "input"); this.input = input; return this; } + public Builder storage(TranscodePayloadStorage storage) { Utils.checkNotNull(storage, "storage"); this.storage = storage; return this; } + /** * Output formats */ @@ -304,6 +311,7 @@ public Builder outputs(Outputs outputs) { return this; } + public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = Optional.ofNullable(profiles); @@ -316,6 +324,7 @@ public Builder profiles(Optional> profiles) { return this; } + /** * How many seconds the duration of each output segment should be */ @@ -334,6 +343,7 @@ public Builder targetSegmentSizeSecs(Optional targetSegmentSizeSecs) { return this; } + public Builder creatorId(InputCreatorId creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = Optional.ofNullable(creatorId); @@ -346,6 +356,7 @@ public Builder creatorId(Optional creatorId) { return this; } + /** * Decides if the output video should include C2PA signature */ @@ -363,17 +374,14 @@ public Builder c2pa(Optional c2pa) { this.c2pa = c2pa; return this; } - + public TranscodePayload build() { + return new TranscodePayload( - input, - storage, - outputs, - profiles, - targetSegmentSizeSecs, - creatorId, + input, storage, outputs, + profiles, targetSegmentSizeSecs, creatorId, c2pa); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorage.java b/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorage.java index b94a15b3..ba965297 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorage.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorage.java @@ -1,24 +1,20 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; import studio.livepeer.livepeer.utils.Utils.TypeReferenceWithShape; import studio.livepeer.livepeer.utils.Utils; - @JsonDeserialize(using = TranscodePayloadStorage._Deserializer.class) public class TranscodePayloadStorage { @@ -70,12 +66,12 @@ public boolean equals(java.lang.Object o) { return false; } TranscodePayloadStorage other = (TranscodePayloadStorage) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -83,8 +79,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -95,3 +91,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorageCredentials.java b/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorageCredentials.java index 05f12fea..1f820794 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorageCredentials.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorageCredentials.java @@ -1,26 +1,22 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; /** - * TranscodePayloadStorageCredentials - Delegation proof for Livepeer to be able to upload to - * web3.storage + * TranscodePayloadStorageCredentials * + *

Delegation proof for Livepeer to be able to upload to + * web3.storage */ - public class TranscodePayloadStorageCredentials { - /** * Base64 encoded UCAN delegation proof */ @@ -42,10 +38,11 @@ public String proof() { return proof; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Base64 encoded UCAN delegation proof */ @@ -54,7 +51,7 @@ public TranscodePayloadStorageCredentials withProof(String proof) { this.proof = proof; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -65,12 +62,12 @@ public boolean equals(java.lang.Object o) { } TranscodePayloadStorageCredentials other = (TranscodePayloadStorageCredentials) o; return - Objects.deepEquals(this.proof, other.proof); + Utils.enhancedDeepEquals(this.proof, other.proof); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( proof); } @@ -79,15 +76,17 @@ public String toString() { return Utils.toString(TranscodePayloadStorageCredentials.class, "proof", proof); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String proof; - + + private String proof; + private Builder() { // force use of static builder() method } + /** * Base64 encoded UCAN delegation proof */ @@ -96,11 +95,12 @@ public Builder proof(String proof) { this.proof = proof; return this; } - + public TranscodePayloadStorageCredentials build() { + return new TranscodePayloadStorageCredentials( proof); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorageType.java b/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorageType.java index 5ae3fe5b..3738a983 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorageType.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TranscodePayloadStorageType.java @@ -1,14 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * TranscodePayloadStorageType - Type of service used for output files + * TranscodePayloadStorageType + * + *

Type of service used for output files */ public enum TranscodePayloadStorageType { WEB3_STORAGE("web3.storage"); @@ -16,11 +19,21 @@ public enum TranscodePayloadStorageType { @JsonValue private final String value; - private TranscodePayloadStorageType(String value) { + TranscodePayloadStorageType(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (TranscodePayloadStorageType o: TranscodePayloadStorageType.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfile.java b/src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfile.java index 100aae85..457007fc 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfile.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfile.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,55 +12,64 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * TranscodeProfile - Transcode API profile + * TranscodeProfile + * + *

Transcode API profile */ - public class TranscodeProfile { @JsonInclude(Include.NON_ABSENT) @JsonProperty("width") private Optional width; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("name") private Optional name; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("height") private Optional height; + @JsonProperty("bitrate") private long bitrate; /** - * Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it. - * + * Restricts the size of the output video using the constant quality feature. Increasing this value + * will result in a lower quality video. Note that this parameter might not work if the transcoder + * lacks support for it. */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("quality") private Optional quality; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("fps") private Optional fps; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("fpsDen") private Optional fpsDen; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("gop") private Optional gop; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("profile") private Optional profile; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("encoder") private Optional encoder; @@ -103,7 +110,10 @@ public TranscodeProfile( public TranscodeProfile( long bitrate) { - this(Optional.empty(), Optional.empty(), Optional.empty(), bitrate, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + bitrate, Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } @JsonIgnore @@ -127,8 +137,9 @@ public long bitrate() { } /** - * Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it. - * + * Restricts the size of the output video using the constant quality feature. Increasing this value + * will result in a lower quality video. Note that this parameter might not work if the transcoder + * lacks support for it. */ @JsonIgnore public Optional quality() { @@ -162,16 +173,18 @@ public Optional encoder() { return (Optional) encoder; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public TranscodeProfile withWidth(long width) { Utils.checkNotNull(width, "width"); this.width = Optional.ofNullable(width); return this; } + public TranscodeProfile withWidth(Optional width) { Utils.checkNotNull(width, "width"); this.width = width; @@ -184,6 +197,7 @@ public TranscodeProfile withName(String name) { return this; } + public TranscodeProfile withName(Optional name) { Utils.checkNotNull(name, "name"); this.name = name; @@ -196,6 +210,7 @@ public TranscodeProfile withHeight(long height) { return this; } + public TranscodeProfile withHeight(Optional height) { Utils.checkNotNull(height, "height"); this.height = height; @@ -209,8 +224,9 @@ public TranscodeProfile withBitrate(long bitrate) { } /** - * Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it. - * + * Restricts the size of the output video using the constant quality feature. Increasing this value + * will result in a lower quality video. Note that this parameter might not work if the transcoder + * lacks support for it. */ public TranscodeProfile withQuality(long quality) { Utils.checkNotNull(quality, "quality"); @@ -218,9 +234,11 @@ public TranscodeProfile withQuality(long quality) { return this; } + /** - * Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it. - * + * Restricts the size of the output video using the constant quality feature. Increasing this value + * will result in a lower quality video. Note that this parameter might not work if the transcoder + * lacks support for it. */ public TranscodeProfile withQuality(Optional quality) { Utils.checkNotNull(quality, "quality"); @@ -234,6 +252,7 @@ public TranscodeProfile withFps(long fps) { return this; } + public TranscodeProfile withFps(Optional fps) { Utils.checkNotNull(fps, "fps"); this.fps = fps; @@ -246,6 +265,7 @@ public TranscodeProfile withFpsDen(long fpsDen) { return this; } + public TranscodeProfile withFpsDen(Optional fpsDen) { Utils.checkNotNull(fpsDen, "fpsDen"); this.fpsDen = fpsDen; @@ -258,6 +278,7 @@ public TranscodeProfile withGop(String gop) { return this; } + public TranscodeProfile withGop(Optional gop) { Utils.checkNotNull(gop, "gop"); this.gop = gop; @@ -270,6 +291,7 @@ public TranscodeProfile withProfile(TranscodeProfileProfile profile) { return this; } + public TranscodeProfile withProfile(Optional profile) { Utils.checkNotNull(profile, "profile"); this.profile = profile; @@ -282,12 +304,13 @@ public TranscodeProfile withEncoder(TranscodeProfileEncoder encoder) { return this; } + public TranscodeProfile withEncoder(Optional encoder) { Utils.checkNotNull(encoder, "encoder"); this.encoder = encoder; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -298,30 +321,24 @@ public boolean equals(java.lang.Object o) { } TranscodeProfile other = (TranscodeProfile) o; return - Objects.deepEquals(this.width, other.width) && - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.height, other.height) && - Objects.deepEquals(this.bitrate, other.bitrate) && - Objects.deepEquals(this.quality, other.quality) && - Objects.deepEquals(this.fps, other.fps) && - Objects.deepEquals(this.fpsDen, other.fpsDen) && - Objects.deepEquals(this.gop, other.gop) && - Objects.deepEquals(this.profile, other.profile) && - Objects.deepEquals(this.encoder, other.encoder); + Utils.enhancedDeepEquals(this.width, other.width) && + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.height, other.height) && + Utils.enhancedDeepEquals(this.bitrate, other.bitrate) && + Utils.enhancedDeepEquals(this.quality, other.quality) && + Utils.enhancedDeepEquals(this.fps, other.fps) && + Utils.enhancedDeepEquals(this.fpsDen, other.fpsDen) && + Utils.enhancedDeepEquals(this.gop, other.gop) && + Utils.enhancedDeepEquals(this.profile, other.profile) && + Utils.enhancedDeepEquals(this.encoder, other.encoder); } @Override public int hashCode() { - return Objects.hash( - width, - name, - height, - bitrate, - quality, - fps, - fpsDen, - gop, - profile, + return Utils.enhancedHash( + width, name, height, + bitrate, quality, fps, + fpsDen, gop, profile, encoder); } @@ -339,33 +356,35 @@ public String toString() { "profile", profile, "encoder", encoder); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional width = Optional.empty(); - + private Optional name = Optional.empty(); - + private Optional height = Optional.empty(); - + private Long bitrate; - + private Optional quality = Optional.empty(); - + private Optional fps = Optional.empty(); - + private Optional fpsDen = Optional.empty(); - + private Optional gop = Optional.empty(); - + private Optional profile = Optional.empty(); - - private Optional encoder = Optional.empty(); - + + private Optional encoder = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder width(long width) { Utils.checkNotNull(width, "width"); this.width = Optional.ofNullable(width); @@ -378,6 +397,7 @@ public Builder width(Optional width) { return this; } + public Builder name(String name) { Utils.checkNotNull(name, "name"); this.name = Optional.ofNullable(name); @@ -390,6 +410,7 @@ public Builder name(Optional name) { return this; } + public Builder height(long height) { Utils.checkNotNull(height, "height"); this.height = Optional.ofNullable(height); @@ -402,15 +423,18 @@ public Builder height(Optional height) { return this; } + public Builder bitrate(long bitrate) { Utils.checkNotNull(bitrate, "bitrate"); this.bitrate = bitrate; return this; } + /** - * Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it. - * + * Restricts the size of the output video using the constant quality feature. Increasing this value + * will result in a lower quality video. Note that this parameter might not work if the transcoder + * lacks support for it. */ public Builder quality(long quality) { Utils.checkNotNull(quality, "quality"); @@ -419,8 +443,9 @@ public Builder quality(long quality) { } /** - * Restricts the size of the output video using the constant quality feature. Increasing this value will result in a lower quality video. Note that this parameter might not work if the transcoder lacks support for it. - * + * Restricts the size of the output video using the constant quality feature. Increasing this value + * will result in a lower quality video. Note that this parameter might not work if the transcoder + * lacks support for it. */ public Builder quality(Optional quality) { Utils.checkNotNull(quality, "quality"); @@ -428,6 +453,7 @@ public Builder quality(Optional quality) { return this; } + public Builder fps(long fps) { Utils.checkNotNull(fps, "fps"); this.fps = Optional.ofNullable(fps); @@ -440,6 +466,7 @@ public Builder fps(Optional fps) { return this; } + public Builder fpsDen(long fpsDen) { Utils.checkNotNull(fpsDen, "fpsDen"); this.fpsDen = Optional.ofNullable(fpsDen); @@ -452,6 +479,7 @@ public Builder fpsDen(Optional fpsDen) { return this; } + public Builder gop(String gop) { Utils.checkNotNull(gop, "gop"); this.gop = Optional.ofNullable(gop); @@ -464,6 +492,7 @@ public Builder gop(Optional gop) { return this; } + public Builder profile(TranscodeProfileProfile profile) { Utils.checkNotNull(profile, "profile"); this.profile = Optional.ofNullable(profile); @@ -476,6 +505,7 @@ public Builder profile(Optional profile) { return this; } + public Builder encoder(TranscodeProfileEncoder encoder) { Utils.checkNotNull(encoder, "encoder"); this.encoder = Optional.ofNullable(encoder); @@ -487,20 +517,15 @@ public Builder encoder(Optional encoder) { this.encoder = encoder; return this; } - + public TranscodeProfile build() { + return new TranscodeProfile( - width, - name, - height, - bitrate, - quality, - fps, - fpsDen, - gop, - profile, + width, name, height, + bitrate, quality, fps, + fpsDen, gop, profile, encoder); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfileEncoder.java b/src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfileEncoder.java index 2188f797..18bc2bba 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfileEncoder.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfileEncoder.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum TranscodeProfileEncoder { H264("H.264"), @@ -16,11 +17,21 @@ public enum TranscodeProfileEncoder { @JsonValue private final String value; - private TranscodeProfileEncoder(String value) { + TranscodeProfileEncoder(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (TranscodeProfileEncoder o: TranscodeProfileEncoder.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfileProfile.java b/src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfileProfile.java index ac2ee4bd..b6f79270 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfileProfile.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/TranscodeProfileProfile.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum TranscodeProfileProfile { H264_BASELINE("H264Baseline"), @@ -16,11 +17,21 @@ public enum TranscodeProfileProfile { @JsonValue private final String value; - private TranscodeProfileProfile(String value) { + TranscodeProfileProfile(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (TranscodeProfileProfile o: TranscodeProfileProfile.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Two.java b/src/main/java/studio/livepeer/livepeer/models/components/Two.java index a8e0417b..4803248d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Two.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Two.java @@ -1,16 +1,13 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; @@ -48,10 +45,11 @@ public String sessionId() { return sessionId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Two withType(AssetSourceType type) { Utils.checkNotNull(type, "type"); this.type = type; @@ -66,7 +64,7 @@ public Two withSessionId(String sessionId) { this.sessionId = sessionId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -77,15 +75,14 @@ public boolean equals(java.lang.Object o) { } Two other = (Two) o; return - Objects.deepEquals(this.type, other.type) && - Objects.deepEquals(this.sessionId, other.sessionId); + Utils.enhancedDeepEquals(this.type, other.type) && + Utils.enhancedDeepEquals(this.sessionId, other.sessionId); } @Override public int hashCode() { - return Objects.hash( - type, - sessionId); + return Utils.enhancedHash( + type, sessionId); } @Override @@ -94,23 +91,26 @@ public String toString() { "type", type, "sessionId", sessionId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private AssetSourceType type; - - private String sessionId; - + + private String sessionId; + private Builder() { // force use of static builder() method } + public Builder type(AssetSourceType type) { Utils.checkNotNull(type, "type"); this.type = type; return this; } + /** * ID of the session from which this asset was created */ @@ -119,12 +119,12 @@ public Builder sessionId(String sessionId) { this.sessionId = sessionId; return this; } - + public Two build() { + return new Two( - type, - sessionId); + type, sessionId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Type.java b/src/main/java/studio/livepeer/livepeer/models/components/Type.java index caa57ce0..884146b7 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Type.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Type.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum Type { PUBLIC("public"), @@ -15,11 +16,21 @@ public enum Type { @JsonValue private final String value; - private Type(String value) { + Type(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (Type o: Type.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Upload.java b/src/main/java/studio/livepeer/livepeer/models/components/Upload.java index 50dadbd7..87c68e2c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Upload.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Upload.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -16,16 +14,15 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * Upload - Parameters for the upload task + * Upload + * + *

Parameters for the upload task */ - public class Upload { - /** * URL of the asset to "upload" */ @@ -33,6 +30,7 @@ public class Upload { @JsonProperty("url") private Optional url; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("encryption") private Optional encryption; @@ -44,6 +42,7 @@ public class Upload { @JsonProperty("c2pa") private Optional c2pa; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("profiles") private Optional> profiles; @@ -75,7 +74,8 @@ public Upload( } public Upload() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); } /** @@ -114,10 +114,11 @@ public Optional targetSegmentSizeSecs() { return targetSegmentSizeSecs; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * URL of the asset to "upload" */ @@ -127,6 +128,7 @@ public Upload withUrl(String url) { return this; } + /** * URL of the asset to "upload" */ @@ -142,6 +144,7 @@ public Upload withEncryption(EncryptionOutput encryption) { return this; } + public Upload withEncryption(Optional encryption) { Utils.checkNotNull(encryption, "encryption"); this.encryption = encryption; @@ -157,6 +160,7 @@ public Upload withC2pa(boolean c2pa) { return this; } + /** * Decides if the output video should include C2PA signature */ @@ -172,6 +176,7 @@ public Upload withProfiles(List profiles) { return this; } + public Upload withProfiles(Optional> profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = profiles; @@ -187,6 +192,7 @@ public Upload withTargetSegmentSizeSecs(double targetSegmentSizeSecs) { return this; } + /** * How many seconds the duration of each output segment should be */ @@ -195,7 +201,7 @@ public Upload withTargetSegmentSizeSecs(Optional targetSegmentSizeSecs) this.targetSegmentSizeSecs = targetSegmentSizeSecs; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -206,21 +212,18 @@ public boolean equals(java.lang.Object o) { } Upload other = (Upload) o; return - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.encryption, other.encryption) && - Objects.deepEquals(this.c2pa, other.c2pa) && - Objects.deepEquals(this.profiles, other.profiles) && - Objects.deepEquals(this.targetSegmentSizeSecs, other.targetSegmentSizeSecs); + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.encryption, other.encryption) && + Utils.enhancedDeepEquals(this.c2pa, other.c2pa) && + Utils.enhancedDeepEquals(this.profiles, other.profiles) && + Utils.enhancedDeepEquals(this.targetSegmentSizeSecs, other.targetSegmentSizeSecs); } @Override public int hashCode() { - return Objects.hash( - url, - encryption, - c2pa, - profiles, - targetSegmentSizeSecs); + return Utils.enhancedHash( + url, encryption, c2pa, + profiles, targetSegmentSizeSecs); } @Override @@ -232,23 +235,25 @@ public String toString() { "profiles", profiles, "targetSegmentSizeSecs", targetSegmentSizeSecs); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional url = Optional.empty(); - + private Optional encryption = Optional.empty(); - + private Optional c2pa = Optional.empty(); - + private Optional> profiles = Optional.empty(); - - private Optional targetSegmentSizeSecs = Optional.empty(); - + + private Optional targetSegmentSizeSecs = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * URL of the asset to "upload" */ @@ -267,6 +272,7 @@ public Builder url(Optional url) { return this; } + public Builder encryption(EncryptionOutput encryption) { Utils.checkNotNull(encryption, "encryption"); this.encryption = Optional.ofNullable(encryption); @@ -279,6 +285,7 @@ public Builder encryption(Optional encryption) { return this; } + /** * Decides if the output video should include C2PA signature */ @@ -297,6 +304,7 @@ public Builder c2pa(Optional c2pa) { return this; } + public Builder profiles(List profiles) { Utils.checkNotNull(profiles, "profiles"); this.profiles = Optional.ofNullable(profiles); @@ -309,6 +317,7 @@ public Builder profiles(Optional> profiles) { return this; } + /** * How many seconds the duration of each output segment should be */ @@ -326,15 +335,13 @@ public Builder targetSegmentSizeSecs(Optional targetSegmentSizeSecs) { this.targetSegmentSizeSecs = targetSegmentSizeSecs; return this; } - + public Upload build() { + return new Upload( - url, - encryption, - c2pa, - profiles, - targetSegmentSizeSecs); + url, encryption, c2pa, + profiles, targetSegmentSizeSecs); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/UsageMetric.java b/src/main/java/studio/livepeer/livepeer/models/components/UsageMetric.java index 55376bcf..64f6ed73 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/UsageMetric.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/UsageMetric.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,17 +11,15 @@ import java.lang.Double; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * UsageMetric - An individual metric about usage of a user. + * UsageMetric * + *

An individual metric about usage of a user. */ - public class UsageMetric { - /** * The user ID associated with the metric */ @@ -79,7 +75,8 @@ public UsageMetric( } public UsageMetric() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); } /** @@ -122,10 +119,11 @@ public Optional storageUsageMins() { return storageUsageMins; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The user ID associated with the metric */ @@ -135,6 +133,7 @@ public UsageMetric withUserID(String userID) { return this; } + /** * The user ID associated with the metric */ @@ -153,6 +152,7 @@ public UsageMetric withCreatorID(String creatorID) { return this; } + /** * The creator ID associated with the metric */ @@ -171,6 +171,7 @@ public UsageMetric withDeliveryUsageMins(double deliveryUsageMins) { return this; } + /** * Total minutes of delivery usage. */ @@ -189,6 +190,7 @@ public UsageMetric withTotalUsageMins(double totalUsageMins) { return this; } + /** * Total transcoded minutes. */ @@ -207,6 +209,7 @@ public UsageMetric withStorageUsageMins(double storageUsageMins) { return this; } + /** * Total minutes of storage usage. */ @@ -215,7 +218,7 @@ public UsageMetric withStorageUsageMins(Optional storageUsageMins) { this.storageUsageMins = storageUsageMins; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -226,21 +229,18 @@ public boolean equals(java.lang.Object o) { } UsageMetric other = (UsageMetric) o; return - Objects.deepEquals(this.userID, other.userID) && - Objects.deepEquals(this.creatorID, other.creatorID) && - Objects.deepEquals(this.deliveryUsageMins, other.deliveryUsageMins) && - Objects.deepEquals(this.totalUsageMins, other.totalUsageMins) && - Objects.deepEquals(this.storageUsageMins, other.storageUsageMins); + Utils.enhancedDeepEquals(this.userID, other.userID) && + Utils.enhancedDeepEquals(this.creatorID, other.creatorID) && + Utils.enhancedDeepEquals(this.deliveryUsageMins, other.deliveryUsageMins) && + Utils.enhancedDeepEquals(this.totalUsageMins, other.totalUsageMins) && + Utils.enhancedDeepEquals(this.storageUsageMins, other.storageUsageMins); } @Override public int hashCode() { - return Objects.hash( - userID, - creatorID, - deliveryUsageMins, - totalUsageMins, - storageUsageMins); + return Utils.enhancedHash( + userID, creatorID, deliveryUsageMins, + totalUsageMins, storageUsageMins); } @Override @@ -252,23 +252,25 @@ public String toString() { "totalUsageMins", totalUsageMins, "storageUsageMins", storageUsageMins); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional userID = Optional.empty(); - + private Optional creatorID = Optional.empty(); - + private Optional deliveryUsageMins = Optional.empty(); - + private Optional totalUsageMins = Optional.empty(); - - private Optional storageUsageMins = Optional.empty(); - + + private Optional storageUsageMins = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * The user ID associated with the metric */ @@ -287,6 +289,7 @@ public Builder userID(Optional userID) { return this; } + /** * The creator ID associated with the metric */ @@ -305,6 +308,7 @@ public Builder creatorID(Optional creatorID) { return this; } + /** * Total minutes of delivery usage. */ @@ -323,6 +327,7 @@ public Builder deliveryUsageMins(Optional deliveryUsageMins) { return this; } + /** * Total transcoded minutes. */ @@ -341,6 +346,7 @@ public Builder totalUsageMins(Optional totalUsageMins) { return this; } + /** * Total minutes of storage usage. */ @@ -358,15 +364,13 @@ public Builder storageUsageMins(Optional storageUsageMins) { this.storageUsageMins = storageUsageMins; return this; } - + public UsageMetric build() { + return new UsageMetric( - userID, - creatorID, - deliveryUsageMins, - totalUsageMins, - storageUsageMins); + userID, creatorID, deliveryUsageMins, + totalUsageMins, storageUsageMins); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/UserTags.java b/src/main/java/studio/livepeer/livepeer/models/components/UserTags.java index b43039d0..1085ba74 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/UserTags.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/UserTags.java @@ -1,25 +1,22 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Double; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; import studio.livepeer.livepeer.utils.Utils.TypeReferenceWithShape; import studio.livepeer.livepeer.utils.Utils; - @JsonDeserialize(using = UserTags._Deserializer.class) public class UserTags { @@ -77,12 +74,12 @@ public boolean equals(java.lang.Object o) { return false; } UserTags other = (UserTags) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -90,9 +87,9 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(UserTags.class, false, - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -103,3 +100,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/UserTags3.java b/src/main/java/studio/livepeer/livepeer/models/components/UserTags3.java index 3f9d3414..1d73576e 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/UserTags3.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/UserTags3.java @@ -1,24 +1,21 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Double; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; import studio.livepeer.livepeer.utils.Utils.TypeReferenceWithShape; import studio.livepeer.livepeer.utils.Utils; - @JsonDeserialize(using = UserTags3._Deserializer.class) public class UserTags3 { @@ -70,12 +67,12 @@ public boolean equals(java.lang.Object o) { return false; } UserTags3 other = (UserTags3) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -83,8 +80,8 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(UserTags3.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -95,3 +92,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Version.java b/src/main/java/studio/livepeer/livepeer/models/components/Version.java index c6239ef1..45001d2c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Version.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Version.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum Version { ONE("1"); @@ -13,11 +14,21 @@ public enum Version { @JsonValue private final String value; - private Version(String value) { + Version(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (Version o: Version.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/components/VideoSpec.java b/src/main/java/studio/livepeer/livepeer/models/components/VideoSpec.java index bbd49bd7..3b86dc3c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/VideoSpec.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/VideoSpec.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -15,16 +13,15 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * VideoSpec - Video metadata + * VideoSpec + * + *

Video metadata */ - public class VideoSpec { - /** * Format of the asset */ @@ -49,7 +46,6 @@ public class VideoSpec { /** * List of tracks associated with the asset when the format * contemplates them (e.g. mp4) - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("tracks") @@ -72,7 +68,8 @@ public VideoSpec( } public VideoSpec() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -102,7 +99,6 @@ public Optional bitrate() { /** * List of tracks associated with the asset when the format * contemplates them (e.g. mp4) - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -110,10 +106,11 @@ public Optional> tracks() { return (Optional>) tracks; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Format of the asset */ @@ -123,6 +120,7 @@ public VideoSpec withFormat(String format) { return this; } + /** * Format of the asset */ @@ -141,6 +139,7 @@ public VideoSpec withDuration(double duration) { return this; } + /** * Duration of the asset in seconds (float) */ @@ -159,6 +158,7 @@ public VideoSpec withBitrate(double bitrate) { return this; } + /** * Bitrate of the video in bits per second */ @@ -171,7 +171,6 @@ public VideoSpec withBitrate(Optional bitrate) { /** * List of tracks associated with the asset when the format * contemplates them (e.g. mp4) - * */ public VideoSpec withTracks(List tracks) { Utils.checkNotNull(tracks, "tracks"); @@ -179,17 +178,17 @@ public VideoSpec withTracks(List tracks) { return this; } + /** * List of tracks associated with the asset when the format * contemplates them (e.g. mp4) - * */ public VideoSpec withTracks(Optional> tracks) { Utils.checkNotNull(tracks, "tracks"); this.tracks = tracks; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -200,18 +199,16 @@ public boolean equals(java.lang.Object o) { } VideoSpec other = (VideoSpec) o; return - Objects.deepEquals(this.format, other.format) && - Objects.deepEquals(this.duration, other.duration) && - Objects.deepEquals(this.bitrate, other.bitrate) && - Objects.deepEquals(this.tracks, other.tracks); + Utils.enhancedDeepEquals(this.format, other.format) && + Utils.enhancedDeepEquals(this.duration, other.duration) && + Utils.enhancedDeepEquals(this.bitrate, other.bitrate) && + Utils.enhancedDeepEquals(this.tracks, other.tracks); } @Override public int hashCode() { - return Objects.hash( - format, - duration, - bitrate, + return Utils.enhancedHash( + format, duration, bitrate, tracks); } @@ -223,21 +220,23 @@ public String toString() { "bitrate", bitrate, "tracks", tracks); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional format = Optional.empty(); - + private Optional duration = Optional.empty(); - + private Optional bitrate = Optional.empty(); - - private Optional> tracks = Optional.empty(); - + + private Optional> tracks = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Format of the asset */ @@ -256,6 +255,7 @@ public Builder format(Optional format) { return this; } + /** * Duration of the asset in seconds (float) */ @@ -274,6 +274,7 @@ public Builder duration(Optional duration) { return this; } + /** * Bitrate of the video in bits per second */ @@ -292,10 +293,10 @@ public Builder bitrate(Optional bitrate) { return this; } + /** * List of tracks associated with the asset when the format * contemplates them (e.g. mp4) - * */ public Builder tracks(List tracks) { Utils.checkNotNull(tracks, "tracks"); @@ -306,21 +307,19 @@ public Builder tracks(List tracks) { /** * List of tracks associated with the asset when the format * contemplates them (e.g. mp4) - * */ public Builder tracks(Optional> tracks) { Utils.checkNotNull(tracks, "tracks"); this.tracks = tracks; return this; } - + public VideoSpec build() { + return new VideoSpec( - format, - duration, - bitrate, + format, duration, bitrate, tracks); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/ViewershipMetric.java b/src/main/java/studio/livepeer/livepeer/models/components/ViewershipMetric.java index 944600ea..735b9b16 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/ViewershipMetric.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/ViewershipMetric.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,18 +12,16 @@ import java.lang.Long; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * ViewershipMetric - An individual metric about viewership of a stream/asset. Necessarily, at least - * 1 of playbackId and dStorageUrl will be present, depending on the query. + * ViewershipMetric * + *

An individual metric about viewership of a stream/asset. Necessarily, at least + * 1 of playbackId and dStorageUrl will be present, depending on the query. */ - public class ViewershipMetric { - /** * The playback ID associated with the metric. */ @@ -58,7 +54,6 @@ public class ViewershipMetric { * Timestamp (in milliseconds) when the metric was recorded. If the * query contains a time step, this timestamp will point to the * beginning of the time step period. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("timestamp") @@ -123,7 +118,6 @@ public class ViewershipMetric { /** * The subdivision (e.g., state or province) where the viewer is * located. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("subdivision") @@ -179,7 +173,6 @@ public class ViewershipMetric { /** * The percentage of sessions that existed before the asset started * playing. - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("exitsBeforeStart") @@ -258,7 +251,14 @@ public ViewershipMetric( public ViewershipMetric( long viewCount, double playtimeMins) { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), viewCount, playtimeMins, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), viewCount, playtimeMins, + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -297,7 +297,6 @@ public Optional dStorageUrl() { * Timestamp (in milliseconds) when the metric was recorded. If the * query contains a time step, this timestamp will point to the * beginning of the time step period. - * */ @JsonIgnore public Optional timestamp() { @@ -371,7 +370,6 @@ public Optional country() { /** * The subdivision (e.g., state or province) where the viewer is * located. - * */ @JsonIgnore public Optional subdivision() { @@ -437,17 +435,17 @@ public Optional errorRate() { /** * The percentage of sessions that existed before the asset started * playing. - * */ @JsonIgnore public Optional exitsBeforeStart() { return exitsBeforeStart; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The playback ID associated with the metric. */ @@ -457,6 +455,7 @@ public ViewershipMetric withPlaybackId(String playbackId) { return this; } + /** * The playback ID associated with the metric. */ @@ -475,6 +474,7 @@ public ViewershipMetric withCreatorId(String creatorId) { return this; } + /** * The ID of the creator associated with the metric. */ @@ -493,6 +493,7 @@ public ViewershipMetric withViewerId(String viewerId) { return this; } + /** * The ID of the viewer associated with the metric. */ @@ -511,6 +512,7 @@ public ViewershipMetric withDStorageUrl(String dStorageUrl) { return this; } + /** * The URL of the distributed storage used for the asset */ @@ -524,7 +526,6 @@ public ViewershipMetric withDStorageUrl(Optional dStorageUrl) { * Timestamp (in milliseconds) when the metric was recorded. If the * query contains a time step, this timestamp will point to the * beginning of the time step period. - * */ public ViewershipMetric withTimestamp(double timestamp) { Utils.checkNotNull(timestamp, "timestamp"); @@ -532,11 +533,11 @@ public ViewershipMetric withTimestamp(double timestamp) { return this; } + /** * Timestamp (in milliseconds) when the metric was recorded. If the * query contains a time step, this timestamp will point to the * beginning of the time step period. - * */ public ViewershipMetric withTimestamp(Optional timestamp) { Utils.checkNotNull(timestamp, "timestamp"); @@ -553,6 +554,7 @@ public ViewershipMetric withDevice(String device) { return this; } + /** * The device used by the viewer. */ @@ -571,6 +573,7 @@ public ViewershipMetric withDeviceType(String deviceType) { return this; } + /** * The type of the device used by the viewer. */ @@ -589,6 +592,7 @@ public ViewershipMetric withCpu(String cpu) { return this; } + /** * The CPU used by the viewer's device. */ @@ -607,6 +611,7 @@ public ViewershipMetric withOs(String os) { return this; } + /** * The operating system used by the viewer. */ @@ -625,6 +630,7 @@ public ViewershipMetric withBrowser(String browser) { return this; } + /** * The browser used by the viewer. */ @@ -643,6 +649,7 @@ public ViewershipMetric withBrowserEngine(String browserEngine) { return this; } + /** * The browser engine used by the viewer's browser. */ @@ -661,6 +668,7 @@ public ViewershipMetric withContinent(String continent) { return this; } + /** * The continent where the viewer is located. */ @@ -679,6 +687,7 @@ public ViewershipMetric withCountry(String country) { return this; } + /** * The country where the viewer is located. */ @@ -691,7 +700,6 @@ public ViewershipMetric withCountry(Optional country) { /** * The subdivision (e.g., state or province) where the viewer is * located. - * */ public ViewershipMetric withSubdivision(String subdivision) { Utils.checkNotNull(subdivision, "subdivision"); @@ -699,10 +707,10 @@ public ViewershipMetric withSubdivision(String subdivision) { return this; } + /** * The subdivision (e.g., state or province) where the viewer is * located. - * */ public ViewershipMetric withSubdivision(Optional subdivision) { Utils.checkNotNull(subdivision, "subdivision"); @@ -719,6 +727,7 @@ public ViewershipMetric withTimezone(String timezone) { return this; } + /** * The timezone where the viewer is located. */ @@ -737,6 +746,7 @@ public ViewershipMetric withGeohash(String geohash) { return this; } + /** * Geographic encoding of the viewers location. Accurate to 3 digits. */ @@ -773,6 +783,7 @@ public ViewershipMetric withTtffMs(double ttffMs) { return this; } + /** * The time-to-first-frame (TTFF) in milliseconds. */ @@ -791,6 +802,7 @@ public ViewershipMetric withRebufferRatio(double rebufferRatio) { return this; } + /** * The rebuffering ratio for the asset. */ @@ -809,6 +821,7 @@ public ViewershipMetric withErrorRate(double errorRate) { return this; } + /** * The error rate for the stream/asset. */ @@ -821,7 +834,6 @@ public ViewershipMetric withErrorRate(Optional errorRate) { /** * The percentage of sessions that existed before the asset started * playing. - * */ public ViewershipMetric withExitsBeforeStart(double exitsBeforeStart) { Utils.checkNotNull(exitsBeforeStart, "exitsBeforeStart"); @@ -829,17 +841,17 @@ public ViewershipMetric withExitsBeforeStart(double exitsBeforeStart) { return this; } + /** * The percentage of sessions that existed before the asset started * playing. - * */ public ViewershipMetric withExitsBeforeStart(Optional exitsBeforeStart) { Utils.checkNotNull(exitsBeforeStart, "exitsBeforeStart"); this.exitsBeforeStart = exitsBeforeStart; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -850,54 +862,40 @@ public boolean equals(java.lang.Object o) { } ViewershipMetric other = (ViewershipMetric) o; return - Objects.deepEquals(this.playbackId, other.playbackId) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.viewerId, other.viewerId) && - Objects.deepEquals(this.dStorageUrl, other.dStorageUrl) && - Objects.deepEquals(this.timestamp, other.timestamp) && - Objects.deepEquals(this.device, other.device) && - Objects.deepEquals(this.deviceType, other.deviceType) && - Objects.deepEquals(this.cpu, other.cpu) && - Objects.deepEquals(this.os, other.os) && - Objects.deepEquals(this.browser, other.browser) && - Objects.deepEquals(this.browserEngine, other.browserEngine) && - Objects.deepEquals(this.continent, other.continent) && - Objects.deepEquals(this.country, other.country) && - Objects.deepEquals(this.subdivision, other.subdivision) && - Objects.deepEquals(this.timezone, other.timezone) && - Objects.deepEquals(this.geohash, other.geohash) && - Objects.deepEquals(this.viewCount, other.viewCount) && - Objects.deepEquals(this.playtimeMins, other.playtimeMins) && - Objects.deepEquals(this.ttffMs, other.ttffMs) && - Objects.deepEquals(this.rebufferRatio, other.rebufferRatio) && - Objects.deepEquals(this.errorRate, other.errorRate) && - Objects.deepEquals(this.exitsBeforeStart, other.exitsBeforeStart); + Utils.enhancedDeepEquals(this.playbackId, other.playbackId) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.viewerId, other.viewerId) && + Utils.enhancedDeepEquals(this.dStorageUrl, other.dStorageUrl) && + Utils.enhancedDeepEquals(this.timestamp, other.timestamp) && + Utils.enhancedDeepEquals(this.device, other.device) && + Utils.enhancedDeepEquals(this.deviceType, other.deviceType) && + Utils.enhancedDeepEquals(this.cpu, other.cpu) && + Utils.enhancedDeepEquals(this.os, other.os) && + Utils.enhancedDeepEquals(this.browser, other.browser) && + Utils.enhancedDeepEquals(this.browserEngine, other.browserEngine) && + Utils.enhancedDeepEquals(this.continent, other.continent) && + Utils.enhancedDeepEquals(this.country, other.country) && + Utils.enhancedDeepEquals(this.subdivision, other.subdivision) && + Utils.enhancedDeepEquals(this.timezone, other.timezone) && + Utils.enhancedDeepEquals(this.geohash, other.geohash) && + Utils.enhancedDeepEquals(this.viewCount, other.viewCount) && + Utils.enhancedDeepEquals(this.playtimeMins, other.playtimeMins) && + Utils.enhancedDeepEquals(this.ttffMs, other.ttffMs) && + Utils.enhancedDeepEquals(this.rebufferRatio, other.rebufferRatio) && + Utils.enhancedDeepEquals(this.errorRate, other.errorRate) && + Utils.enhancedDeepEquals(this.exitsBeforeStart, other.exitsBeforeStart); } @Override public int hashCode() { - return Objects.hash( - playbackId, - creatorId, - viewerId, - dStorageUrl, - timestamp, - device, - deviceType, - cpu, - os, - browser, - browserEngine, - continent, - country, - subdivision, - timezone, - geohash, - viewCount, - playtimeMins, - ttffMs, - rebufferRatio, - errorRate, + return Utils.enhancedHash( + playbackId, creatorId, viewerId, + dStorageUrl, timestamp, device, + deviceType, cpu, os, + browser, browserEngine, continent, + country, subdivision, timezone, + geohash, viewCount, playtimeMins, + ttffMs, rebufferRatio, errorRate, exitsBeforeStart); } @@ -927,57 +925,59 @@ public String toString() { "errorRate", errorRate, "exitsBeforeStart", exitsBeforeStart); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional playbackId = Optional.empty(); - + private Optional creatorId = Optional.empty(); - + private Optional viewerId = Optional.empty(); - + private Optional dStorageUrl = Optional.empty(); - + private Optional timestamp = Optional.empty(); - + private Optional device = Optional.empty(); - + private Optional deviceType = Optional.empty(); - + private Optional cpu = Optional.empty(); - + private Optional os = Optional.empty(); - + private Optional browser = Optional.empty(); - + private Optional browserEngine = Optional.empty(); - + private Optional continent = Optional.empty(); - + private Optional country = Optional.empty(); - + private Optional subdivision = Optional.empty(); - + private Optional timezone = Optional.empty(); - + private Optional geohash = Optional.empty(); - + private Long viewCount; - + private Double playtimeMins; - + private Optional ttffMs = Optional.empty(); - + private Optional rebufferRatio = Optional.empty(); - + private Optional errorRate = Optional.empty(); - - private Optional exitsBeforeStart = Optional.empty(); - + + private Optional exitsBeforeStart = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * The playback ID associated with the metric. */ @@ -996,6 +996,7 @@ public Builder playbackId(Optional playbackId) { return this; } + /** * The ID of the creator associated with the metric. */ @@ -1014,6 +1015,7 @@ public Builder creatorId(Optional creatorId) { return this; } + /** * The ID of the viewer associated with the metric. */ @@ -1032,6 +1034,7 @@ public Builder viewerId(Optional viewerId) { return this; } + /** * The URL of the distributed storage used for the asset */ @@ -1050,11 +1053,11 @@ public Builder dStorageUrl(Optional dStorageUrl) { return this; } + /** * Timestamp (in milliseconds) when the metric was recorded. If the * query contains a time step, this timestamp will point to the * beginning of the time step period. - * */ public Builder timestamp(double timestamp) { Utils.checkNotNull(timestamp, "timestamp"); @@ -1066,7 +1069,6 @@ public Builder timestamp(double timestamp) { * Timestamp (in milliseconds) when the metric was recorded. If the * query contains a time step, this timestamp will point to the * beginning of the time step period. - * */ public Builder timestamp(Optional timestamp) { Utils.checkNotNull(timestamp, "timestamp"); @@ -1074,6 +1076,7 @@ public Builder timestamp(Optional timestamp) { return this; } + /** * The device used by the viewer. */ @@ -1092,6 +1095,7 @@ public Builder device(Optional device) { return this; } + /** * The type of the device used by the viewer. */ @@ -1110,6 +1114,7 @@ public Builder deviceType(Optional deviceType) { return this; } + /** * The CPU used by the viewer's device. */ @@ -1128,6 +1133,7 @@ public Builder cpu(Optional cpu) { return this; } + /** * The operating system used by the viewer. */ @@ -1146,6 +1152,7 @@ public Builder os(Optional os) { return this; } + /** * The browser used by the viewer. */ @@ -1164,6 +1171,7 @@ public Builder browser(Optional browser) { return this; } + /** * The browser engine used by the viewer's browser. */ @@ -1182,6 +1190,7 @@ public Builder browserEngine(Optional browserEngine) { return this; } + /** * The continent where the viewer is located. */ @@ -1200,6 +1209,7 @@ public Builder continent(Optional continent) { return this; } + /** * The country where the viewer is located. */ @@ -1218,10 +1228,10 @@ public Builder country(Optional country) { return this; } + /** * The subdivision (e.g., state or province) where the viewer is * located. - * */ public Builder subdivision(String subdivision) { Utils.checkNotNull(subdivision, "subdivision"); @@ -1232,7 +1242,6 @@ public Builder subdivision(String subdivision) { /** * The subdivision (e.g., state or province) where the viewer is * located. - * */ public Builder subdivision(Optional subdivision) { Utils.checkNotNull(subdivision, "subdivision"); @@ -1240,6 +1249,7 @@ public Builder subdivision(Optional subdivision) { return this; } + /** * The timezone where the viewer is located. */ @@ -1258,6 +1268,7 @@ public Builder timezone(Optional timezone) { return this; } + /** * Geographic encoding of the viewers location. Accurate to 3 digits. */ @@ -1276,6 +1287,7 @@ public Builder geohash(Optional geohash) { return this; } + /** * The number of views for the stream/asset. */ @@ -1285,6 +1297,7 @@ public Builder viewCount(long viewCount) { return this; } + /** * The total playtime in minutes for the stream/asset. */ @@ -1294,6 +1307,7 @@ public Builder playtimeMins(double playtimeMins) { return this; } + /** * The time-to-first-frame (TTFF) in milliseconds. */ @@ -1312,6 +1326,7 @@ public Builder ttffMs(Optional ttffMs) { return this; } + /** * The rebuffering ratio for the asset. */ @@ -1330,6 +1345,7 @@ public Builder rebufferRatio(Optional rebufferRatio) { return this; } + /** * The error rate for the stream/asset. */ @@ -1348,10 +1364,10 @@ public Builder errorRate(Optional errorRate) { return this; } + /** * The percentage of sessions that existed before the asset started * playing. - * */ public Builder exitsBeforeStart(double exitsBeforeStart) { Utils.checkNotNull(exitsBeforeStart, "exitsBeforeStart"); @@ -1362,39 +1378,25 @@ public Builder exitsBeforeStart(double exitsBeforeStart) { /** * The percentage of sessions that existed before the asset started * playing. - * */ public Builder exitsBeforeStart(Optional exitsBeforeStart) { Utils.checkNotNull(exitsBeforeStart, "exitsBeforeStart"); this.exitsBeforeStart = exitsBeforeStart; return this; } - + public ViewershipMetric build() { + return new ViewershipMetric( - playbackId, - creatorId, - viewerId, - dStorageUrl, - timestamp, - device, - deviceType, - cpu, - os, - browser, - browserEngine, - continent, - country, - subdivision, - timezone, - geohash, - viewCount, - playtimeMins, - ttffMs, - rebufferRatio, - errorRate, + playbackId, creatorId, viewerId, + dStorageUrl, timestamp, device, + deviceType, cpu, os, + browser, browserEngine, continent, + country, subdivision, timezone, + geohash, viewCount, playtimeMins, + ttffMs, rebufferRatio, errorRate, exitsBeforeStart); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/Webhook.java b/src/main/java/studio/livepeer/livepeer/models/components/Webhook.java index 5aecbf99..b82d0a5f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/Webhook.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/Webhook.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -16,7 +14,6 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -27,10 +24,12 @@ public class Webhook { @JsonProperty("id") private Optional id; + @JsonProperty("name") private String name; /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -39,6 +38,7 @@ public class Webhook { private Optional kind; /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) @@ -60,10 +60,12 @@ public class Webhook { @JsonProperty("createdAt") private Optional createdAt; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("events") private Optional> events; + @JsonProperty("url") private String url; @@ -118,7 +120,10 @@ public Webhook( public Webhook( String name, String url) { - this(Optional.empty(), name, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), url, Optional.empty(), Optional.empty()); + this(Optional.empty(), name, Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), url, Optional.empty(), + Optional.empty()); } @JsonIgnore @@ -132,6 +137,7 @@ public String name() { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -141,6 +147,7 @@ public Optional kind() { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -193,16 +200,18 @@ public Optional status() { return (Optional) status; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Webhook withId(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); return this; } + public Webhook withId(Optional id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -216,6 +225,7 @@ public Webhook withName(String name) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -225,7 +235,9 @@ public Webhook withKind(String kind) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -236,6 +248,7 @@ public Webhook withKind(Optional kind) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -245,7 +258,9 @@ public Webhook withUserId(String userId) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -264,6 +279,7 @@ public Webhook withProjectId(String projectId) { return this; } + /** * The ID of the project */ @@ -282,6 +298,7 @@ public Webhook withCreatedAt(double createdAt) { return this; } + /** * Timestamp (in milliseconds) at which stream object was created */ @@ -297,6 +314,7 @@ public Webhook withEvents(List events) { return this; } + public Webhook withEvents(Optional> events) { Utils.checkNotNull(events, "events"); this.events = events; @@ -318,6 +336,7 @@ public Webhook withStreamId(String streamId) { return this; } + /** * streamId of the stream on which the webhook is applied */ @@ -336,6 +355,7 @@ public Webhook withStatus(Status status) { return this; } + /** * status of webhook */ @@ -344,7 +364,7 @@ public Webhook withStatus(Optional status) { this.status = status; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -355,30 +375,24 @@ public boolean equals(java.lang.Object o) { } Webhook other = (Webhook) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.kind, other.kind) && - Objects.deepEquals(this.userId, other.userId) && - Objects.deepEquals(this.projectId, other.projectId) && - Objects.deepEquals(this.createdAt, other.createdAt) && - Objects.deepEquals(this.events, other.events) && - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.streamId, other.streamId) && - Objects.deepEquals(this.status, other.status); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.kind, other.kind) && + Utils.enhancedDeepEquals(this.userId, other.userId) && + Utils.enhancedDeepEquals(this.projectId, other.projectId) && + Utils.enhancedDeepEquals(this.createdAt, other.createdAt) && + Utils.enhancedDeepEquals(this.events, other.events) && + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.streamId, other.streamId) && + Utils.enhancedDeepEquals(this.status, other.status); } @Override public int hashCode() { - return Objects.hash( - id, - name, - kind, - userId, - projectId, - createdAt, - events, - url, - streamId, + return Utils.enhancedHash( + id, name, kind, + userId, projectId, createdAt, + events, url, streamId, status); } @@ -396,35 +410,37 @@ public String toString() { "streamId", streamId, "status", status); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional id = Optional.empty(); - + private String name; - + @Deprecated private Optional kind = Optional.empty(); - + @Deprecated private Optional userId = Optional.empty(); - + private Optional projectId = Optional.empty(); - + private Optional createdAt = Optional.empty(); - + private Optional> events = Optional.empty(); - + private String url; - + private Optional streamId = Optional.empty(); - - private Optional status = Optional.empty(); - + + private Optional status = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); @@ -437,13 +453,16 @@ public Builder id(Optional id) { return this; } + public Builder name(String name) { Utils.checkNotNull(name, "name"); this.name = name; return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -454,6 +473,7 @@ public Builder kind(String kind) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -463,7 +483,9 @@ public Builder kind(Optional kind) { return this; } + /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -474,6 +496,7 @@ public Builder userId(String userId) { } /** + * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @Deprecated @@ -483,6 +506,7 @@ public Builder userId(Optional userId) { return this; } + /** * The ID of the project */ @@ -501,6 +525,7 @@ public Builder projectId(Optional projectId) { return this; } + /** * Timestamp (in milliseconds) at which stream object was created */ @@ -519,6 +544,7 @@ public Builder createdAt(Optional createdAt) { return this; } + public Builder events(List events) { Utils.checkNotNull(events, "events"); this.events = Optional.ofNullable(events); @@ -531,12 +557,14 @@ public Builder events(Optional> events) { return this; } + public Builder url(String url) { Utils.checkNotNull(url, "url"); this.url = url; return this; } + /** * streamId of the stream on which the webhook is applied */ @@ -555,6 +583,7 @@ public Builder streamId(Optional streamId) { return this; } + /** * status of webhook */ @@ -572,20 +601,15 @@ public Builder status(Optional status) { this.status = status; return this; } - + public Webhook build() { + return new Webhook( - id, - name, - kind, - userId, - projectId, - createdAt, - events, - url, - streamId, + id, name, kind, + userId, projectId, createdAt, + events, url, streamId, status); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/WebhookInput.java b/src/main/java/studio/livepeer/livepeer/models/components/WebhookInput.java index 06321d2c..ccdf739e 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/WebhookInput.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/WebhookInput.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,7 +12,6 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -31,10 +28,12 @@ public class WebhookInput { @JsonProperty("projectId") private Optional projectId; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("events") private Optional> events; + @JsonProperty("url") private String url; @@ -77,7 +76,8 @@ public WebhookInput( public WebhookInput( String name, String url) { - this(name, Optional.empty(), Optional.empty(), url, Optional.empty(), Optional.empty()); + this(name, Optional.empty(), Optional.empty(), + url, Optional.empty(), Optional.empty()); } @JsonIgnore @@ -120,10 +120,11 @@ public Optional streamId() { return streamId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public WebhookInput withName(String name) { Utils.checkNotNull(name, "name"); this.name = name; @@ -139,6 +140,7 @@ public WebhookInput withProjectId(String projectId) { return this; } + /** * The ID of the project */ @@ -154,6 +156,7 @@ public WebhookInput withEvents(List events) { return this; } + public WebhookInput withEvents(Optional> events) { Utils.checkNotNull(events, "events"); this.events = events; @@ -175,6 +178,7 @@ public WebhookInput withSharedSecret(String sharedSecret) { return this; } + /** * shared secret used to sign the webhook payload */ @@ -193,6 +197,7 @@ public WebhookInput withStreamId(String streamId) { return this; } + /** * streamId of the stream on which the webhook is applied */ @@ -201,7 +206,7 @@ public WebhookInput withStreamId(Optional streamId) { this.streamId = streamId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -212,23 +217,19 @@ public boolean equals(java.lang.Object o) { } WebhookInput other = (WebhookInput) o; return - Objects.deepEquals(this.name, other.name) && - Objects.deepEquals(this.projectId, other.projectId) && - Objects.deepEquals(this.events, other.events) && - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.sharedSecret, other.sharedSecret) && - Objects.deepEquals(this.streamId, other.streamId); + Utils.enhancedDeepEquals(this.name, other.name) && + Utils.enhancedDeepEquals(this.projectId, other.projectId) && + Utils.enhancedDeepEquals(this.events, other.events) && + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.sharedSecret, other.sharedSecret) && + Utils.enhancedDeepEquals(this.streamId, other.streamId); } @Override public int hashCode() { - return Objects.hash( - name, - projectId, - events, - url, - sharedSecret, - streamId); + return Utils.enhancedHash( + name, projectId, events, + url, sharedSecret, streamId); } @Override @@ -241,31 +242,34 @@ public String toString() { "sharedSecret", sharedSecret, "streamId", streamId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String name; - + private Optional projectId = Optional.empty(); - + private Optional> events = Optional.empty(); - + private String url; - + private Optional sharedSecret = Optional.empty(); - - private Optional streamId = Optional.empty(); - + + private Optional streamId = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder name(String name) { Utils.checkNotNull(name, "name"); this.name = name; return this; } + /** * The ID of the project */ @@ -284,6 +288,7 @@ public Builder projectId(Optional projectId) { return this; } + public Builder events(List events) { Utils.checkNotNull(events, "events"); this.events = Optional.ofNullable(events); @@ -296,12 +301,14 @@ public Builder events(Optional> events) { return this; } + public Builder url(String url) { Utils.checkNotNull(url, "url"); this.url = url; return this; } + /** * shared secret used to sign the webhook payload */ @@ -320,6 +327,7 @@ public Builder sharedSecret(Optional sharedSecret) { return this; } + /** * streamId of the stream on which the webhook is applied */ @@ -337,16 +345,13 @@ public Builder streamId(Optional streamId) { this.streamId = streamId; return this; } - + public WebhookInput build() { + return new WebhookInput( - name, - projectId, - events, - url, - sharedSecret, - streamId); + name, projectId, events, + url, sharedSecret, streamId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/components/WebhookLog.java b/src/main/java/studio/livepeer/livepeer/models/components/WebhookLog.java index f477f505..a0f41095 100644 --- a/src/main/java/studio/livepeer/livepeer/models/components/WebhookLog.java +++ b/src/main/java/studio/livepeer/livepeer/models/components/WebhookLog.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.components; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -15,7 +13,6 @@ import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -41,7 +38,6 @@ public class WebhookLog { /** * Timestamp (in milliseconds) at which webhook request object was * created - * */ @JsonInclude(Include.NON_ABSENT) @JsonProperty("createdAt") @@ -61,10 +57,12 @@ public class WebhookLog { @JsonProperty("success") private Optional success; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("request") private Optional request; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("response") private Optional response; @@ -100,7 +98,9 @@ public WebhookLog( public WebhookLog( String id, String webhookId) { - this(id, webhookId, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(id, webhookId, Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); } @JsonIgnore @@ -127,7 +127,6 @@ public Optional event() { /** * Timestamp (in milliseconds) at which webhook request object was * created - * */ @JsonIgnore public Optional createdAt() { @@ -162,10 +161,11 @@ public Optional response() { return (Optional) response; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public WebhookLog withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -190,6 +190,7 @@ public WebhookLog withEvent(String event) { return this; } + /** * The event type that triggered the webhook request */ @@ -202,7 +203,6 @@ public WebhookLog withEvent(Optional event) { /** * Timestamp (in milliseconds) at which webhook request object was * created - * */ public WebhookLog withCreatedAt(double createdAt) { Utils.checkNotNull(createdAt, "createdAt"); @@ -210,10 +210,10 @@ public WebhookLog withCreatedAt(double createdAt) { return this; } + /** * Timestamp (in milliseconds) at which webhook request object was * created - * */ public WebhookLog withCreatedAt(Optional createdAt) { Utils.checkNotNull(createdAt, "createdAt"); @@ -230,6 +230,7 @@ public WebhookLog withDuration(double duration) { return this; } + /** * The time taken (in seconds) to make the webhook request */ @@ -248,6 +249,7 @@ public WebhookLog withSuccess(boolean success) { return this; } + /** * Whether the webhook request was successful */ @@ -263,6 +265,7 @@ public WebhookLog withRequest(Request request) { return this; } + public WebhookLog withRequest(Optional request) { Utils.checkNotNull(request, "request"); this.request = request; @@ -275,12 +278,13 @@ public WebhookLog withResponse(Response response) { return this; } + public WebhookLog withResponse(Optional response) { Utils.checkNotNull(response, "response"); this.response = response; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -291,27 +295,22 @@ public boolean equals(java.lang.Object o) { } WebhookLog other = (WebhookLog) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.webhookId, other.webhookId) && - Objects.deepEquals(this.event, other.event) && - Objects.deepEquals(this.createdAt, other.createdAt) && - Objects.deepEquals(this.duration, other.duration) && - Objects.deepEquals(this.success, other.success) && - Objects.deepEquals(this.request, other.request) && - Objects.deepEquals(this.response, other.response); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.webhookId, other.webhookId) && + Utils.enhancedDeepEquals(this.event, other.event) && + Utils.enhancedDeepEquals(this.createdAt, other.createdAt) && + Utils.enhancedDeepEquals(this.duration, other.duration) && + Utils.enhancedDeepEquals(this.success, other.success) && + Utils.enhancedDeepEquals(this.request, other.request) && + Utils.enhancedDeepEquals(this.response, other.response); } @Override public int hashCode() { - return Objects.hash( - id, - webhookId, - event, - createdAt, - duration, - success, - request, - response); + return Utils.enhancedHash( + id, webhookId, event, + createdAt, duration, success, + request, response); } @Override @@ -326,35 +325,38 @@ public String toString() { "request", request, "response", response); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - + private String webhookId; - + private Optional event = Optional.empty(); - + private Optional createdAt = Optional.empty(); - + private Optional duration = Optional.empty(); - + private Optional success = Optional.empty(); - + private Optional request = Optional.empty(); - - private Optional response = Optional.empty(); - + + private Optional response = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } + /** * ID of the webhook this request was made for */ @@ -364,6 +366,7 @@ public Builder webhookId(String webhookId) { return this; } + /** * The event type that triggered the webhook request */ @@ -382,10 +385,10 @@ public Builder event(Optional event) { return this; } + /** * Timestamp (in milliseconds) at which webhook request object was * created - * */ public Builder createdAt(double createdAt) { Utils.checkNotNull(createdAt, "createdAt"); @@ -396,7 +399,6 @@ public Builder createdAt(double createdAt) { /** * Timestamp (in milliseconds) at which webhook request object was * created - * */ public Builder createdAt(Optional createdAt) { Utils.checkNotNull(createdAt, "createdAt"); @@ -404,6 +406,7 @@ public Builder createdAt(Optional createdAt) { return this; } + /** * The time taken (in seconds) to make the webhook request */ @@ -422,6 +425,7 @@ public Builder duration(Optional duration) { return this; } + /** * Whether the webhook request was successful */ @@ -440,6 +444,7 @@ public Builder success(Optional success) { return this; } + public Builder request(Request request) { Utils.checkNotNull(request, "request"); this.request = Optional.ofNullable(request); @@ -452,6 +457,7 @@ public Builder request(Optional request) { return this; } + public Builder response(Response response) { Utils.checkNotNull(response, "response"); this.response = Optional.ofNullable(response); @@ -463,18 +469,14 @@ public Builder response(Optional response) { this.response = response; return this; } - + public WebhookLog build() { + return new WebhookLog( - id, - webhookId, - event, - createdAt, - duration, - success, - request, - response); + id, webhookId, event, + createdAt, duration, success, + request, response); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/errors/AsyncSDKException.java b/src/main/java/studio/livepeer/livepeer/models/errors/AsyncSDKException.java new file mode 100644 index 00000000..bddac41e --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/errors/AsyncSDKException.java @@ -0,0 +1,32 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.errors; + +import jakarta.annotation.Nullable; +import java.net.http.HttpResponse; +import studio.livepeer.livepeer.utils.Blob; + +/** + * Thrown by an async service call when an error response occurs. Contains details about the response. + * This is an unchecked exception suitable for use in CompletableFuture chains. + */ +@SuppressWarnings("serial") +public class AsyncSDKException extends LivepeerException { + + public AsyncSDKException( + String message, + int code, + @Nullable byte[] body, + HttpResponse rawResponse, + @Nullable Throwable cause) { + super(message, code, body, rawResponse, cause); + } + + @SuppressWarnings("unchecked") + @Override + public HttpResponse rawResponse() { + return (HttpResponse) super.rawResponse(); + } + +} \ No newline at end of file diff --git a/src/main/java/studio/livepeer/livepeer/models/errors/AuthException.java b/src/main/java/studio/livepeer/livepeer/models/errors/AuthException.java index 1d8e36b9..ce7f638a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/errors/AuthException.java +++ b/src/main/java/studio/livepeer/livepeer/models/errors/AuthException.java @@ -1,33 +1,35 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.errors; +import java.io.InputStream; +import java.net.http.HttpResponse; import java.util.Optional; /** * An exception associated with Authentication or Authorization. */ @SuppressWarnings("serial") -public class AuthException extends RuntimeException { - - private final Optional statusCode; +public class AuthException extends LivepeerException { - private AuthException(Optional statusCode, String message) { - super(message); - this.statusCode = statusCode; + public AuthException(String message, int code, byte[] body, HttpResponse rawResponse) { + super(message, code, body, rawResponse, null); } - public AuthException(int statusCode, String message) { - this(Optional.of(statusCode), message); - } - - public AuthException(String message) { - this(Optional.empty(), message); + /** + * Returns the HTTP status code of the response. + * + * @deprecated Use {@link #code()} instead. + */ + @Deprecated + public Optional statusCode() { + return Optional.of(super.code()); } - public Optional statusCode() { - return statusCode; + @SuppressWarnings("unchecked") + @Override + public HttpResponse rawResponse() { + return (HttpResponse) super.rawResponse(); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/errors/Error.java b/src/main/java/studio/livepeer/livepeer/models/errors/Error.java index 2e60a81c..d44cf97a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/errors/Error.java +++ b/src/main/java/studio/livepeer/livepeer/models/errors/Error.java @@ -1,107 +1,214 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.errors; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import jakarta.annotation.Nullable; +import java.io.InputStream; +import java.lang.Deprecated; +import java.lang.Exception; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; +import java.lang.Throwable; +import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.utils.Blob; import studio.livepeer.livepeer.utils.Utils; -public class Error extends RuntimeException { +@SuppressWarnings("serial") +public class Error extends LivepeerException { + + @Nullable + private final Data data; - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("errors") - private Optional> errors; + @Nullable + private final Throwable deserializationException; - @JsonCreator public Error( - @JsonProperty("errors") Optional> errors) { - Utils.checkNotNull(errors, "errors"); - this.errors = errors; - } - - public Error() { - this(Optional.empty()); + int code, + byte[] body, + HttpResponse rawResponse, + @Nullable Data data, + @Nullable Throwable deserializationException) { + super("API error occurred", code, body, rawResponse, null); + this.data = data; + this.deserializationException = deserializationException; } - @SuppressWarnings("unchecked") - public Optional> errors(){ - return (Optional>) errors; - } - - public final static Builder builder() { - return new Builder(); + /** + * Parse a response into an instance of Error. If deserialization of the response body fails, + * the resulting Error instance will have a null data() value and a non-null deserializationException(). + */ + public static Error from(HttpResponse response) { + try { + byte[] bytes = Utils.extractByteArrayFromBody(response); + Data data = Utils.mapper().readValue(bytes, Data.class); + return new Error(response.statusCode(), bytes, response, data, null); + } catch (Exception e) { + return new Error(response.statusCode(), null, response, null, e); + } } - public Error withErrors(List errors) { - Utils.checkNotNull(errors, "errors"); - this.errors = Optional.ofNullable(errors); - return this; - } - - public Error withErrors(Optional> errors) { - Utils.checkNotNull(errors, "errors"); - this.errors = errors; - return this; + /** + * Parse a response into an instance of Error asynchronously. If deserialization of the response body fails, + * the resulting Error instance will have a null data() value and a non-null deserializationException(). + */ + public static CompletableFuture fromAsync(HttpResponse response) { + return response.body() + .toByteArray() + .handle((bytes, err) -> { + // if a body read error occurs, we want to transform the exception + if (err != null) { + throw new AsyncSDKException( + "Error reading response body: " + err.getMessage(), + response.statusCode(), + null, + response, + err); + } + + try { + return new Error( + response.statusCode(), + bytes, + response, + Utils.mapper().readValue( + bytes, + new TypeReference() { + }), + null); + } catch (Exception e) { + return new Error( + response.statusCode(), + bytes, + response, + null, + e); + } + }); } - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Error other = (Error) o; - return - Objects.deepEquals(this.errors, other.errors); + @Deprecated + public Optional> errors() { + return data().flatMap(Data::errors); } - @Override - public int hashCode() { - return java.util.Objects.hash( - errors); + public Optional data() { + return Optional.ofNullable(data); } - @Override - public String toString() { - return Utils.toString(Error.class, - "errors", errors); + /** + * Returns the exception if an error occurs while deserializing the response body. + */ + public Optional deserializationException() { + return Optional.ofNullable(deserializationException); } - public final static class Builder { + public static class Data { - private Optional> errors = Optional.empty(); + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("errors") + private Optional> errors; - private Builder() { - // force use of static builder() method + @JsonCreator + public Data( + @JsonProperty("errors") Optional> errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = errors; + } + + public Data() { + this(Optional.empty()); + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> errors() { + return (Optional>) errors; } - public Builder errors(List errors) { + public static Builder builder() { + return new Builder(); + } + + + public Data withErrors(List errors) { Utils.checkNotNull(errors, "errors"); this.errors = Optional.ofNullable(errors); return this; } - - public Builder errors(Optional> errors) { + + + public Data withErrors(Optional> errors) { Utils.checkNotNull(errors, "errors"); this.errors = errors; return this; } - public Error build() { - return new Error( + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Data other = (Data) o; + return + Utils.enhancedDeepEquals(this.errors, other.errors); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( errors); } + + @Override + public String toString() { + return Utils.toString(Data.class, + "errors", errors); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private Optional> errors = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + public Builder errors(List errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = Optional.ofNullable(errors); + return this; + } + + public Builder errors(Optional> errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = errors; + return this; + } + + public Data build() { + + return new Data( + errors); + } + + } } + } + diff --git a/src/main/java/studio/livepeer/livepeer/models/errors/LivepeerException.java b/src/main/java/studio/livepeer/livepeer/models/errors/LivepeerException.java new file mode 100644 index 00000000..66deaca9 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/errors/LivepeerException.java @@ -0,0 +1,95 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.errors; + +import studio.livepeer.livepeer.utils.Utils; +import studio.livepeer.livepeer.utils.Headers; + +import jakarta.annotation.Nullable; + +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.Optional; + +@SuppressWarnings("serial") +public abstract class LivepeerException extends RuntimeException { + + private int code; + private byte[] body; + private HttpResponse rawResponse; + + public LivepeerException(String message, int code, @Nullable byte[] body, HttpResponse rawResponse, @Nullable Throwable cause) { + super(message, cause); + Utils.checkNotNull(message, "message"); + Utils.checkNotNull(rawResponse, "rawResponse"); + this.body = body; + this.code = code; + this.rawResponse = rawResponse; + } + + public Optional body() { + return Optional.ofNullable(body); + } + + public Optional bodyAsString() { + return body().map(x -> new String(x, StandardCharsets.UTF_8)); + } + + public int code() { + return code; + } + + /** + * Returns the raw HTTP response associated with this exception. The response body stream + * may not be available (but the body can be accessed via the {@code body()} method). + * + * @return the raw HTTP response + */ + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Returns the headers from the raw HTTP response as a map. + * + * @return response headers + */ + public Headers headers() { + return new Headers(rawResponse.headers().map()); + } + + // present for backwards compatibility + public String message() { + return getMessage(); + } + + public LivepeerException withCode(int code) { + this.code = code; + return this; + } + + public LivepeerException withBody(@Nullable byte[] body) { + Utils.checkNotNull(body, "body"); + this.body = body; + return this; + } + + public LivepeerException withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + @Override + public String toString() { + return Utils.toString(this.getClass(), + "requestMethod", rawResponse.request().method(), + "requestUri", rawResponse.request().uri(), + "code", code, + "responseHeaders", rawResponse.headers().map(), + "message", getMessage(), + "body", bodyAsString().orElse("null")); + } +} + diff --git a/src/main/java/studio/livepeer/livepeer/models/errors/SDKError.java b/src/main/java/studio/livepeer/livepeer/models/errors/SDKError.java deleted file mode 100644 index 59116dcf..00000000 --- a/src/main/java/studio/livepeer/livepeer/models/errors/SDKError.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -package studio.livepeer.livepeer.models.errors; - -import java.net.http.HttpResponse; -import java.io.InputStream; -import studio.livepeer.livepeer.utils.Utils; - -/** - * Thrown by a service call when an error response occurs. Contains details about the response. - */ -@SuppressWarnings("serial") -public class SDKError extends Exception { - - private final HttpResponse rawResponse; - private final int code; - private final String message; - private final byte[] body; - - public SDKError( - HttpResponse rawResponse, - int code, - String message, - byte[] body) { - Utils.checkNotNull(rawResponse, "rawResponse"); - Utils.checkNotNull(message, "message"); - Utils.checkNotNull(body, "body"); - this.rawResponse = rawResponse; - this.code = code; - this.message = message; - this.body = body; - } - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SDKError other = (SDKError) o; - return - java.util.Objects.deepEquals(this.rawResponse, other.rawResponse) && - java.util.Objects.deepEquals(this.code, other.code) && - java.util.Objects.deepEquals(this.message, other.message) && - java.util.Objects.deepEquals(this.body, other.body); - } - - @Override - public int hashCode() { - return java.util.Objects.hash( - rawResponse, - code, - message, - body); - } - - @Override - public String toString() { - return Utils.toString(SDKError.class, - "rawResponse", rawResponse, - "code", code, - "message", message, - "body", body); - } - - public HttpResponse rawResponse() { - return this.rawResponse; - } - - public int code() { - return this.code; - } - - public String message() { - return this.message; - } - - public byte[] body() { - return this.body; - } -} diff --git a/src/main/java/studio/livepeer/livepeer/models/errors/SDKException.java b/src/main/java/studio/livepeer/livepeer/models/errors/SDKException.java new file mode 100644 index 00000000..d3d86cd0 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/errors/SDKException.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.errors; + +import jakarta.annotation.Nullable; +import studio.livepeer.livepeer.utils.Utils; + +import java.io.IOException; +import java.net.http.HttpResponse; +import java.io.InputStream; + +/** + * Thrown by a service call when an error response occurs. Contains details about the response. + */ +@SuppressWarnings("serial") +public class SDKException extends LivepeerException { + + public SDKException( + String message, + int code, + @Nullable byte[] body, + HttpResponse rawResponse, + @Nullable Throwable cause) { + super(message, code, body, rawResponse, cause); + } + + public static SDKException from(String message, HttpResponse rawResponse) { + return from(message, rawResponse, null); + } + + public static SDKException from(String message, HttpResponse rawResponse, @Nullable Throwable cause) { + try { + return new SDKException( + message, rawResponse.statusCode(), Utils.extractByteArrayFromBody(rawResponse), rawResponse, cause); + } catch (IOException e) { + // Gracefully handle IOExceptions that occur while reading the body + // by returning an error without a body. + return new SDKException( + message, rawResponse.statusCode(), null, rawResponse, cause); + } + } + + @SuppressWarnings("unchecked") + @Override + public HttpResponse rawResponse() { + return (HttpResponse) super.rawResponse(); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetRequest.java index 3f2a4882..4777217b 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetRequest.java @@ -1,28 +1,25 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.models.components.TargetAddPayload; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class AddMultistreamTargetRequest { - /** * ID of the parent stream */ @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; + @SpeakeasyMetadata("request:mediaType=application/json") private TargetAddPayload targetAddPayload; @@ -49,10 +46,11 @@ public TargetAddPayload targetAddPayload() { return targetAddPayload; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the parent stream */ @@ -67,7 +65,7 @@ public AddMultistreamTargetRequest withTargetAddPayload(TargetAddPayload targetA this.targetAddPayload = targetAddPayload; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -78,15 +76,14 @@ public boolean equals(java.lang.Object o) { } AddMultistreamTargetRequest other = (AddMultistreamTargetRequest) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.targetAddPayload, other.targetAddPayload); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.targetAddPayload, other.targetAddPayload); } @Override public int hashCode() { - return Objects.hash( - id, - targetAddPayload); + return Utils.enhancedHash( + id, targetAddPayload); } @Override @@ -95,17 +92,19 @@ public String toString() { "id", id, "targetAddPayload", targetAddPayload); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - - private TargetAddPayload targetAddPayload; - + + private TargetAddPayload targetAddPayload; + private Builder() { // force use of static builder() method } + /** * ID of the parent stream */ @@ -115,17 +114,18 @@ public Builder id(String id) { return this; } + public Builder targetAddPayload(TargetAddPayload targetAddPayload) { Utils.checkNotNull(targetAddPayload, "targetAddPayload"); this.targetAddPayload = targetAddPayload; return this; } - + public AddMultistreamTargetRequest build() { + return new AddMultistreamTargetRequest( - id, - targetAddPayload); + id, targetAddPayload); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetRequestBuilder.java index 4976ba22..33bbd5fc 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetRequestBuilder.java @@ -1,39 +1,55 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.TargetAddPayload; +import studio.livepeer.livepeer.operations.AddMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class AddMultistreamTargetRequestBuilder { private String id; private TargetAddPayload targetAddPayload; - private final SDKMethodInterfaces.MethodCallAddMultistreamTarget sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public AddMultistreamTargetRequestBuilder(SDKMethodInterfaces.MethodCallAddMultistreamTarget sdk) { - this.sdk = sdk; + public AddMultistreamTargetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public AddMultistreamTargetRequestBuilder id(java.lang.String id) { + public AddMultistreamTargetRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public AddMultistreamTargetRequestBuilder targetAddPayload(studio.livepeer.livepeer.models.components.TargetAddPayload targetAddPayload) { + public AddMultistreamTargetRequestBuilder targetAddPayload(TargetAddPayload targetAddPayload) { Utils.checkNotNull(targetAddPayload, "targetAddPayload"); this.targetAddPayload = targetAddPayload; return this; } - public AddMultistreamTargetResponse call() throws Exception { - return sdk.addMultistreamTarget( - id, + private AddMultistreamTargetRequest buildRequest() { + + AddMultistreamTargetRequest request = new AddMultistreamTargetRequest(id, targetAddPayload); + + return request; + } + + public AddMultistreamTargetResponse call() { + + RequestOperation operation + = new AddMultistreamTarget.Sync(sdkConfiguration, _headers); + AddMultistreamTargetRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetResponse.java index 908144e1..7a6fdb17 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/AddMultistreamTargetResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class AddMultistreamTargetResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public AddMultistreamTargetResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public AddMultistreamTargetResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public AddMultistreamTargetResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } AddMultistreamTargetResponse other = (AddMultistreamTargetResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public AddMultistreamTargetResponse build() { + return new AddMultistreamTargetResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/BreakdownBy.java b/src/main/java/studio/livepeer/livepeer/models/operations/BreakdownBy.java index d26b8fff..d97ff095 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/BreakdownBy.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/BreakdownBy.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum BreakdownBy { PLAYBACK_ID("playbackId"), @@ -16,11 +17,21 @@ public enum BreakdownBy { @JsonValue private final String value; - private BreakdownBy(String value) { + BreakdownBy(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (BreakdownBy o: BreakdownBy.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipData.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipData.java index e674d7af..02f40362 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipData.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipData.java @@ -1,28 +1,27 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.models.components.Asset; import studio.livepeer.livepeer.utils.Utils; /** - * CreateClipData - Success + * CreateClipData + * + *

Success */ - public class CreateClipData { @JsonProperty("asset") private Asset asset; + @JsonProperty("task") private CreateClipTask task; @@ -46,10 +45,11 @@ public CreateClipTask task() { return task; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public CreateClipData withAsset(Asset asset) { Utils.checkNotNull(asset, "asset"); this.asset = asset; @@ -61,7 +61,7 @@ public CreateClipData withTask(CreateClipTask task) { this.task = task; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -72,15 +72,14 @@ public boolean equals(java.lang.Object o) { } CreateClipData other = (CreateClipData) o; return - Objects.deepEquals(this.asset, other.asset) && - Objects.deepEquals(this.task, other.task); + Utils.enhancedDeepEquals(this.asset, other.asset) && + Utils.enhancedDeepEquals(this.task, other.task); } @Override public int hashCode() { - return Objects.hash( - asset, - task); + return Utils.enhancedHash( + asset, task); } @Override @@ -89,34 +88,37 @@ public String toString() { "asset", asset, "task", task); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Asset asset; - - private CreateClipTask task; - + + private CreateClipTask task; + private Builder() { // force use of static builder() method } + public Builder asset(Asset asset) { Utils.checkNotNull(asset, "asset"); this.asset = asset; return this; } + public Builder task(CreateClipTask task) { Utils.checkNotNull(task, "task"); this.task = task; return this; } - + public CreateClipData build() { + return new CreateClipData( - asset, - task); + asset, task); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipRequestBuilder.java index 0afbe77d..cf788642 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipRequestBuilder.java @@ -1,30 +1,37 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.ClipPayload; +import studio.livepeer.livepeer.operations.CreateClip; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class CreateClipRequestBuilder { private ClipPayload request; - private final SDKMethodInterfaces.MethodCallCreateClip sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public CreateClipRequestBuilder(SDKMethodInterfaces.MethodCallCreateClip sdk) { - this.sdk = sdk; + public CreateClipRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public CreateClipRequestBuilder request(studio.livepeer.livepeer.models.components.ClipPayload request) { + public CreateClipRequestBuilder request(ClipPayload request) { Utils.checkNotNull(request, "request"); this.request = request; return this; } - public CreateClipResponse call() throws Exception { + public CreateClipResponse call() { + + RequestOperation operation + = new CreateClip.Sync(sdkConfiguration, _headers); - return sdk.createClip( - request); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipResponse.java index 8e44d869..b14c15af 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class CreateClipResponse implements Response { - /** * HTTP response content type for this operation */ @@ -70,7 +66,8 @@ public CreateClipResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -115,10 +112,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -155,6 +153,7 @@ public CreateClipResponse withData(CreateClipData data) { return this; } + /** * Success */ @@ -173,6 +172,7 @@ public CreateClipResponse withError(Error error) { return this; } + /** * Error */ @@ -181,7 +181,7 @@ public CreateClipResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -192,21 +192,18 @@ public boolean equals(java.lang.Object o) { } CreateClipResponse other = (CreateClipResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -218,23 +215,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -244,6 +243,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -253,6 +253,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -262,6 +263,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -280,6 +282,7 @@ public Builder data(Optional data) { return this; } + /** * Error */ @@ -297,15 +300,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public CreateClipResponse build() { + return new CreateClipResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipTask.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipTask.java index 0871d719..26bbabaa 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipTask.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateClipTask.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -12,7 +10,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -39,22 +36,24 @@ public Optional id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public CreateClipTask withId(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); return this; } + public CreateClipTask withId(Optional id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -65,12 +64,12 @@ public boolean equals(java.lang.Object o) { } CreateClipTask other = (CreateClipTask) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -79,15 +78,17 @@ public String toString() { return Utils.toString(CreateClipTask.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional id = Optional.empty(); - + + private Optional id = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = Optional.ofNullable(id); @@ -99,11 +100,12 @@ public Builder id(Optional id) { this.id = id; return this; } - + public CreateClipTask build() { + return new CreateClipTask( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateMultistreamTargetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateMultistreamTargetRequestBuilder.java index d3000484..3bef1e9d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateMultistreamTargetRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateMultistreamTargetRequestBuilder.java @@ -1,30 +1,37 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.MultistreamTargetInput; +import studio.livepeer.livepeer.operations.CreateMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class CreateMultistreamTargetRequestBuilder { private MultistreamTargetInput request; - private final SDKMethodInterfaces.MethodCallCreateMultistreamTarget sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public CreateMultistreamTargetRequestBuilder(SDKMethodInterfaces.MethodCallCreateMultistreamTarget sdk) { - this.sdk = sdk; + public CreateMultistreamTargetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public CreateMultistreamTargetRequestBuilder request(studio.livepeer.livepeer.models.components.MultistreamTargetInput request) { + public CreateMultistreamTargetRequestBuilder request(MultistreamTargetInput request) { Utils.checkNotNull(request, "request"); this.request = request; return this; } - public CreateMultistreamTargetResponse call() throws Exception { + public CreateMultistreamTargetResponse call() { + + RequestOperation operation + = new CreateMultistreamTarget.Sync(sdkConfiguration, _headers); - return sdk.create( - request); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateMultistreamTargetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateMultistreamTargetResponse.java index 71a30d56..11d1dde2 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateMultistreamTargetResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateMultistreamTargetResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.MultistreamTarget; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class CreateMultistreamTargetResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public CreateMultistreamTargetResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public CreateMultistreamTargetResponse withMultistreamTarget(MultistreamTarget m return this; } + /** * Success */ @@ -174,6 +173,7 @@ public CreateMultistreamTargetResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public CreateMultistreamTargetResponse withError(Optional error this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } CreateMultistreamTargetResponse other = (CreateMultistreamTargetResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.multistreamTarget, other.multistreamTarget) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.multistreamTarget, other.multistreamTarget) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - multistreamTarget, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + multistreamTarget, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "multistreamTarget", multistreamTarget, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional multistreamTarget = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder multistreamTarget(Optional multistre return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public CreateMultistreamTargetResponse build() { + return new CreateMultistreamTargetResponse( - contentType, - statusCode, - rawResponse, - multistreamTarget, - error); + contentType, statusCode, rawResponse, + multistreamTarget, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomRequestBuilder.java index 64f53668..3603dc0d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomRequestBuilder.java @@ -1,20 +1,28 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; + +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.CreateRoom; +import studio.livepeer.livepeer.utils.Headers; public class CreateRoomRequestBuilder { - private final SDKMethodInterfaces.MethodCallCreateRoom sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public CreateRoomRequestBuilder(SDKMethodInterfaces.MethodCallCreateRoom sdk) { - this.sdk = sdk; + public CreateRoomRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public CreateRoomResponse call() throws Exception { + public CreateRoomResponse call() { + + RequestlessOperation operation + = new CreateRoom.Sync(sdkConfiguration, _headers); - return sdk.createDirect(); + return operation.handleResponse(operation.doRequest()); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomResponse.java index 2580285c..7cccd864 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class CreateRoomResponse implements Response { - /** * HTTP response content type for this operation */ @@ -70,7 +66,8 @@ public CreateRoomResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -115,10 +112,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -155,6 +153,7 @@ public CreateRoomResponse withCreateRoomResponse(studio.livepeer.livepeer.models return this; } + /** * Success */ @@ -173,6 +172,7 @@ public CreateRoomResponse withError(Error error) { return this; } + /** * Error */ @@ -181,7 +181,7 @@ public CreateRoomResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -192,21 +192,18 @@ public boolean equals(java.lang.Object o) { } CreateRoomResponse other = (CreateRoomResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.createRoomResponse, other.createRoomResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.createRoomResponse, other.createRoomResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - createRoomResponse, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + createRoomResponse, error); } @Override @@ -218,23 +215,25 @@ public String toString() { "createRoomResponse", createRoomResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional createRoomResponse = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -244,6 +243,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -253,6 +253,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -262,6 +263,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -280,6 +282,7 @@ public Builder createRoomResponse(Optional error) { this.error = error; return this; } - + public CreateRoomResponse build() { + return new CreateRoomResponse( - contentType, - statusCode, - rawResponse, - createRoomResponse, - error); + contentType, statusCode, rawResponse, + createRoomResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserRequest.java index dd47b597..0e81d83f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.models.components.RoomUserPayload; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -20,6 +17,7 @@ public class CreateRoomUserRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; + @SpeakeasyMetadata("request:mediaType=application/json") private RoomUserPayload roomUserPayload; @@ -43,10 +41,11 @@ public RoomUserPayload roomUserPayload() { return roomUserPayload; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public CreateRoomUserRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -58,7 +57,7 @@ public CreateRoomUserRequest withRoomUserPayload(RoomUserPayload roomUserPayload this.roomUserPayload = roomUserPayload; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -69,15 +68,14 @@ public boolean equals(java.lang.Object o) { } CreateRoomUserRequest other = (CreateRoomUserRequest) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.roomUserPayload, other.roomUserPayload); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.roomUserPayload, other.roomUserPayload); } @Override public int hashCode() { - return Objects.hash( - id, - roomUserPayload); + return Utils.enhancedHash( + id, roomUserPayload); } @Override @@ -86,34 +84,37 @@ public String toString() { "id", id, "roomUserPayload", roomUserPayload); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - - private RoomUserPayload roomUserPayload; - + + private RoomUserPayload roomUserPayload; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } + public Builder roomUserPayload(RoomUserPayload roomUserPayload) { Utils.checkNotNull(roomUserPayload, "roomUserPayload"); this.roomUserPayload = roomUserPayload; return this; } - + public CreateRoomUserRequest build() { + return new CreateRoomUserRequest( - id, - roomUserPayload); + id, roomUserPayload); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserRequestBuilder.java index 51beebb7..34206ed7 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserRequestBuilder.java @@ -1,39 +1,55 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.RoomUserPayload; +import studio.livepeer.livepeer.operations.CreateRoomUser; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class CreateRoomUserRequestBuilder { private String id; private RoomUserPayload roomUserPayload; - private final SDKMethodInterfaces.MethodCallCreateRoomUser sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public CreateRoomUserRequestBuilder(SDKMethodInterfaces.MethodCallCreateRoomUser sdk) { - this.sdk = sdk; + public CreateRoomUserRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public CreateRoomUserRequestBuilder id(java.lang.String id) { + public CreateRoomUserRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public CreateRoomUserRequestBuilder roomUserPayload(studio.livepeer.livepeer.models.components.RoomUserPayload roomUserPayload) { + public CreateRoomUserRequestBuilder roomUserPayload(RoomUserPayload roomUserPayload) { Utils.checkNotNull(roomUserPayload, "roomUserPayload"); this.roomUserPayload = roomUserPayload; return this; } - public CreateRoomUserResponse call() throws Exception { - return sdk.createUser( - id, + private CreateRoomUserRequest buildRequest() { + + CreateRoomUserRequest request = new CreateRoomUserRequest(id, roomUserPayload); + + return request; + } + + public CreateRoomUserResponse call() { + + RequestOperation operation + = new CreateRoomUser.Sync(sdkConfiguration, _headers); + CreateRoomUserRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserResponse.java index 3a1233bf..33b33540 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateRoomUserResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.RoomUserResponse; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class CreateRoomUserResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public CreateRoomUserResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public CreateRoomUserResponse withRoomUserResponse(RoomUserResponse roomUserResp return this; } + /** * Success */ @@ -174,6 +173,7 @@ public CreateRoomUserResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public CreateRoomUserResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } CreateRoomUserResponse other = (CreateRoomUserResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.roomUserResponse, other.roomUserResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.roomUserResponse, other.roomUserResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - roomUserResponse, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + roomUserResponse, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "roomUserResponse", roomUserResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional roomUserResponse = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder roomUserResponse(Optional roomUserRes return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public CreateRoomUserResponse build() { + return new CreateRoomUserResponse( - contentType, - statusCode, - rawResponse, - roomUserResponse, - error); + contentType, statusCode, rawResponse, + roomUserResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateSigningKeyRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateSigningKeyRequestBuilder.java index d4808095..de6a3208 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateSigningKeyRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateSigningKeyRequestBuilder.java @@ -1,20 +1,28 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; + +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.CreateSigningKey; +import studio.livepeer.livepeer.utils.Headers; public class CreateSigningKeyRequestBuilder { - private final SDKMethodInterfaces.MethodCallCreateSigningKey sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public CreateSigningKeyRequestBuilder(SDKMethodInterfaces.MethodCallCreateSigningKey sdk) { - this.sdk = sdk; + public CreateSigningKeyRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public CreateSigningKeyResponse call() throws Exception { + public CreateSigningKeyResponse call() { + + RequestlessOperation operation + = new CreateSigningKey.Sync(sdkConfiguration, _headers); - return sdk.createDirect(); + return operation.handleResponse(operation.doRequest()); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateSigningKeyResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateSigningKeyResponse.java index 0315a785..72246937 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateSigningKeyResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateSigningKeyResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.SigningKey; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class CreateSigningKeyResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public CreateSigningKeyResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public CreateSigningKeyResponse withSigningKey(SigningKey signingKey) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public CreateSigningKeyResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public CreateSigningKeyResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } CreateSigningKeyResponse other = (CreateSigningKeyResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.signingKey, other.signingKey) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.signingKey, other.signingKey) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - signingKey, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + signingKey, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "signingKey", signingKey, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional signingKey = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder signingKey(Optional signingKey) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public CreateSigningKeyResponse build() { + return new CreateSigningKeyResponse( - contentType, - statusCode, - rawResponse, - signingKey, - error); + contentType, statusCode, rawResponse, + signingKey, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateStreamRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateStreamRequestBuilder.java index 52db6a7a..2cd41911 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateStreamRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateStreamRequestBuilder.java @@ -1,30 +1,37 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.NewStreamPayload; +import studio.livepeer.livepeer.operations.CreateStream; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class CreateStreamRequestBuilder { private NewStreamPayload request; - private final SDKMethodInterfaces.MethodCallCreateStream sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public CreateStreamRequestBuilder(SDKMethodInterfaces.MethodCallCreateStream sdk) { - this.sdk = sdk; + public CreateStreamRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public CreateStreamRequestBuilder request(studio.livepeer.livepeer.models.components.NewStreamPayload request) { + public CreateStreamRequestBuilder request(NewStreamPayload request) { Utils.checkNotNull(request, "request"); this.request = request; return this; } - public CreateStreamResponse call() throws Exception { + public CreateStreamResponse call() { + + RequestOperation operation + = new CreateStream.Sync(sdkConfiguration, _headers); - return sdk.create( - request); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateStreamResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateStreamResponse.java index 57b22dc1..54bfd916 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateStreamResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateStreamResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Stream; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class CreateStreamResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public CreateStreamResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public CreateStreamResponse withStream(Stream stream) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public CreateStreamResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public CreateStreamResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } CreateStreamResponse other = (CreateStreamResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.stream, other.stream) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.stream, other.stream) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - stream, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + stream, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "stream", stream, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional stream = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder stream(Optional stream) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public CreateStreamResponse build() { + return new CreateStreamResponse( - contentType, - statusCode, - rawResponse, - stream, - error); + contentType, statusCode, rawResponse, + stream, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateWebhookRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateWebhookRequestBuilder.java index c45911aa..36b9a72a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateWebhookRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateWebhookRequestBuilder.java @@ -1,30 +1,37 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.WebhookInput; +import studio.livepeer.livepeer.operations.CreateWebhook; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class CreateWebhookRequestBuilder { private WebhookInput request; - private final SDKMethodInterfaces.MethodCallCreateWebhook sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public CreateWebhookRequestBuilder(SDKMethodInterfaces.MethodCallCreateWebhook sdk) { - this.sdk = sdk; + public CreateWebhookRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public CreateWebhookRequestBuilder request(studio.livepeer.livepeer.models.components.WebhookInput request) { + public CreateWebhookRequestBuilder request(WebhookInput request) { Utils.checkNotNull(request, "request"); this.request = request; return this; } - public CreateWebhookResponse call() throws Exception { + public CreateWebhookResponse call() { + + RequestOperation operation + = new CreateWebhook.Sync(sdkConfiguration, _headers); - return sdk.create( - request); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/CreateWebhookResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/CreateWebhookResponse.java index 0eb3f7bc..45b401b4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/CreateWebhookResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/CreateWebhookResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Webhook; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class CreateWebhookResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public CreateWebhookResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public CreateWebhookResponse withWebhook(Webhook webhook) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public CreateWebhookResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public CreateWebhookResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } CreateWebhookResponse other = (CreateWebhookResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.webhook, other.webhook) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.webhook, other.webhook) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - webhook, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + webhook, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "webhook", webhook, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional webhook = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder webhook(Optional webhook) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public CreateWebhookResponse build() { + return new CreateWebhookResponse( - contentType, - statusCode, - rawResponse, - webhook, - error); + contentType, statusCode, rawResponse, + webhook, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetRequest.java index 7f8cfd49..10569bf8 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class DeleteAssetRequest { - /** * ID of the asset */ @@ -37,10 +33,11 @@ public String assetId() { return assetId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the asset */ @@ -49,7 +46,7 @@ public DeleteAssetRequest withAssetId(String assetId) { this.assetId = assetId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } DeleteAssetRequest other = (DeleteAssetRequest) o; return - Objects.deepEquals(this.assetId, other.assetId); + Utils.enhancedDeepEquals(this.assetId, other.assetId); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( assetId); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(DeleteAssetRequest.class, "assetId", assetId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String assetId; - + + private String assetId; + private Builder() { // force use of static builder() method } + /** * ID of the asset */ @@ -91,11 +90,12 @@ public Builder assetId(String assetId) { this.assetId = assetId; return this; } - + public DeleteAssetRequest build() { + return new DeleteAssetRequest( assetId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetRequestBuilder.java index 93aa87b6..8ac0a82f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.DeleteAsset; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class DeleteAssetRequestBuilder { private String assetId; - private final SDKMethodInterfaces.MethodCallDeleteAsset sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public DeleteAssetRequestBuilder(SDKMethodInterfaces.MethodCallDeleteAsset sdk) { - this.sdk = sdk; + public DeleteAssetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public DeleteAssetRequestBuilder assetId(java.lang.String assetId) { + public DeleteAssetRequestBuilder assetId(String assetId) { Utils.checkNotNull(assetId, "assetId"); this.assetId = assetId; return this; } - public DeleteAssetResponse call() throws Exception { - return sdk.delete( - assetId); + private DeleteAssetRequest buildRequest() { + + DeleteAssetRequest request = new DeleteAssetRequest(assetId); + + return request; + } + + public DeleteAssetResponse call() { + + RequestOperation operation + = new DeleteAsset.Sync(sdkConfiguration, _headers); + DeleteAssetRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetResponse.java index 5fed3794..59f52ace 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteAssetResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class DeleteAssetResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public DeleteAssetResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public DeleteAssetResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public DeleteAssetResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } DeleteAssetResponse other = (DeleteAssetResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public DeleteAssetResponse build() { + return new DeleteAssetResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetRequest.java index 54139b3f..dca4839e 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class DeleteMultistreamTargetRequest { - /** * ID of the multistream target */ @@ -37,10 +33,11 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the multistream target */ @@ -49,7 +46,7 @@ public DeleteMultistreamTargetRequest withId(String id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } DeleteMultistreamTargetRequest other = (DeleteMultistreamTargetRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(DeleteMultistreamTargetRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + /** * ID of the multistream target */ @@ -91,11 +90,12 @@ public Builder id(String id) { this.id = id; return this; } - + public DeleteMultistreamTargetRequest build() { + return new DeleteMultistreamTargetRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetRequestBuilder.java index 4335757e..c410bc5e 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.DeleteMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class DeleteMultistreamTargetRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallDeleteMultistreamTarget sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public DeleteMultistreamTargetRequestBuilder(SDKMethodInterfaces.MethodCallDeleteMultistreamTarget sdk) { - this.sdk = sdk; + public DeleteMultistreamTargetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public DeleteMultistreamTargetRequestBuilder id(java.lang.String id) { + public DeleteMultistreamTargetRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public DeleteMultistreamTargetResponse call() throws Exception { - return sdk.delete( - id); + private DeleteMultistreamTargetRequest buildRequest() { + + DeleteMultistreamTargetRequest request = new DeleteMultistreamTargetRequest(id); + + return request; + } + + public DeleteMultistreamTargetResponse call() { + + RequestOperation operation + = new DeleteMultistreamTarget.Sync(sdkConfiguration, _headers); + DeleteMultistreamTargetRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetResponse.java index f1e72509..2913477f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteMultistreamTargetResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class DeleteMultistreamTargetResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public DeleteMultistreamTargetResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public DeleteMultistreamTargetResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public DeleteMultistreamTargetResponse withError(Optional error this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } DeleteMultistreamTargetResponse other = (DeleteMultistreamTargetResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public DeleteMultistreamTargetResponse build() { + return new DeleteMultistreamTargetResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomRequest.java index 48d9ee87..6d07c879 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -31,16 +28,17 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public DeleteRoomRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -51,12 +49,12 @@ public boolean equals(java.lang.Object o) { } DeleteRoomRequest other = (DeleteRoomRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -65,25 +63,28 @@ public String toString() { return Utils.toString(DeleteRoomRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + public DeleteRoomRequest build() { + return new DeleteRoomRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomRequestBuilder.java index 881ae319..01842b20 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.DeleteRoom; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class DeleteRoomRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallDeleteRoom sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public DeleteRoomRequestBuilder(SDKMethodInterfaces.MethodCallDeleteRoom sdk) { - this.sdk = sdk; + public DeleteRoomRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public DeleteRoomRequestBuilder id(java.lang.String id) { + public DeleteRoomRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public DeleteRoomResponse call() throws Exception { - return sdk.delete( - id); + private DeleteRoomRequest buildRequest() { + + DeleteRoomRequest request = new DeleteRoomRequest(id); + + return request; + } + + public DeleteRoomResponse call() { + + RequestOperation operation + = new DeleteRoom.Sync(sdkConfiguration, _headers); + DeleteRoomRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomResponse.java index 70bc062d..d09f0b5d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class DeleteRoomResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public DeleteRoomResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public DeleteRoomResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public DeleteRoomResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } DeleteRoomResponse other = (DeleteRoomResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public DeleteRoomResponse build() { + return new DeleteRoomResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserRequest.java index 83d955b9..e9fa02a0 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -19,6 +16,7 @@ public class DeleteRoomUserRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=userId") private String userId; @@ -42,10 +40,11 @@ public String userId() { return userId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public DeleteRoomUserRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -57,7 +56,7 @@ public DeleteRoomUserRequest withUserId(String userId) { this.userId = userId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -68,15 +67,14 @@ public boolean equals(java.lang.Object o) { } DeleteRoomUserRequest other = (DeleteRoomUserRequest) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.userId, other.userId); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.userId, other.userId); } @Override public int hashCode() { - return Objects.hash( - id, - userId); + return Utils.enhancedHash( + id, userId); } @Override @@ -85,34 +83,37 @@ public String toString() { "id", id, "userId", userId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - - private String userId; - + + private String userId; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } + public Builder userId(String userId) { Utils.checkNotNull(userId, "userId"); this.userId = userId; return this; } - + public DeleteRoomUserRequest build() { + return new DeleteRoomUserRequest( - id, - userId); + id, userId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserRequestBuilder.java index bc19de74..0cfed73f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserRequestBuilder.java @@ -1,38 +1,54 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.DeleteRoomUser; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class DeleteRoomUserRequestBuilder { private String id; private String userId; - private final SDKMethodInterfaces.MethodCallDeleteRoomUser sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public DeleteRoomUserRequestBuilder(SDKMethodInterfaces.MethodCallDeleteRoomUser sdk) { - this.sdk = sdk; + public DeleteRoomUserRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public DeleteRoomUserRequestBuilder id(java.lang.String id) { + public DeleteRoomUserRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public DeleteRoomUserRequestBuilder userId(java.lang.String userId) { + public DeleteRoomUserRequestBuilder userId(String userId) { Utils.checkNotNull(userId, "userId"); this.userId = userId; return this; } - public DeleteRoomUserResponse call() throws Exception { - return sdk.deleteUser( - id, + private DeleteRoomUserRequest buildRequest() { + + DeleteRoomUserRequest request = new DeleteRoomUserRequest(id, userId); + + return request; + } + + public DeleteRoomUserResponse call() { + + RequestOperation operation + = new DeleteRoomUser.Sync(sdkConfiguration, _headers); + DeleteRoomUserRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserResponse.java index c02116a0..bd467560 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteRoomUserResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class DeleteRoomUserResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public DeleteRoomUserResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public DeleteRoomUserResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public DeleteRoomUserResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } DeleteRoomUserResponse other = (DeleteRoomUserResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public DeleteRoomUserResponse build() { + return new DeleteRoomUserResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyRequest.java index 9c48b688..97f7caa5 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class DeleteSigningKeyRequest { - /** * ID of the signing key */ @@ -37,10 +33,11 @@ public String keyId() { return keyId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the signing key */ @@ -49,7 +46,7 @@ public DeleteSigningKeyRequest withKeyId(String keyId) { this.keyId = keyId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } DeleteSigningKeyRequest other = (DeleteSigningKeyRequest) o; return - Objects.deepEquals(this.keyId, other.keyId); + Utils.enhancedDeepEquals(this.keyId, other.keyId); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( keyId); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(DeleteSigningKeyRequest.class, "keyId", keyId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String keyId; - + + private String keyId; + private Builder() { // force use of static builder() method } + /** * ID of the signing key */ @@ -91,11 +90,12 @@ public Builder keyId(String keyId) { this.keyId = keyId; return this; } - + public DeleteSigningKeyRequest build() { + return new DeleteSigningKeyRequest( keyId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyRequestBuilder.java index e66a712a..7a1bf7d6 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.DeleteSigningKey; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class DeleteSigningKeyRequestBuilder { private String keyId; - private final SDKMethodInterfaces.MethodCallDeleteSigningKey sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public DeleteSigningKeyRequestBuilder(SDKMethodInterfaces.MethodCallDeleteSigningKey sdk) { - this.sdk = sdk; + public DeleteSigningKeyRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public DeleteSigningKeyRequestBuilder keyId(java.lang.String keyId) { + public DeleteSigningKeyRequestBuilder keyId(String keyId) { Utils.checkNotNull(keyId, "keyId"); this.keyId = keyId; return this; } - public DeleteSigningKeyResponse call() throws Exception { - return sdk.delete( - keyId); + private DeleteSigningKeyRequest buildRequest() { + + DeleteSigningKeyRequest request = new DeleteSigningKeyRequest(keyId); + + return request; + } + + public DeleteSigningKeyResponse call() { + + RequestOperation operation + = new DeleteSigningKey.Sync(sdkConfiguration, _headers); + DeleteSigningKeyRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyResponse.java index 5c5ba5cb..f9c8e8ee 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteSigningKeyResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class DeleteSigningKeyResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public DeleteSigningKeyResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public DeleteSigningKeyResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public DeleteSigningKeyResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } DeleteSigningKeyResponse other = (DeleteSigningKeyResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public DeleteSigningKeyResponse build() { + return new DeleteSigningKeyResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamRequest.java index 467ff9c5..6d5a8578 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class DeleteStreamRequest { - /** * ID of the stream */ @@ -37,10 +33,11 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the stream */ @@ -49,7 +46,7 @@ public DeleteStreamRequest withId(String id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } DeleteStreamRequest other = (DeleteStreamRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(DeleteStreamRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + /** * ID of the stream */ @@ -91,11 +90,12 @@ public Builder id(String id) { this.id = id; return this; } - + public DeleteStreamRequest build() { + return new DeleteStreamRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamRequestBuilder.java index fdeab72d..791c0a5f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.DeleteStream; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class DeleteStreamRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallDeleteStream sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public DeleteStreamRequestBuilder(SDKMethodInterfaces.MethodCallDeleteStream sdk) { - this.sdk = sdk; + public DeleteStreamRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public DeleteStreamRequestBuilder id(java.lang.String id) { + public DeleteStreamRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public DeleteStreamResponse call() throws Exception { - return sdk.delete( - id); + private DeleteStreamRequest buildRequest() { + + DeleteStreamRequest request = new DeleteStreamRequest(id); + + return request; + } + + public DeleteStreamResponse call() { + + RequestOperation operation + = new DeleteStream.Sync(sdkConfiguration, _headers); + DeleteStreamRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamResponse.java index 0ed9fbe1..841e59ba 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteStreamResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class DeleteStreamResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public DeleteStreamResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public DeleteStreamResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public DeleteStreamResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } DeleteStreamResponse other = (DeleteStreamResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public DeleteStreamResponse build() { + return new DeleteStreamResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookRequest.java index 2ed6ca82..2f4be7ee 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -31,16 +28,17 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public DeleteWebhookRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -51,12 +49,12 @@ public boolean equals(java.lang.Object o) { } DeleteWebhookRequest other = (DeleteWebhookRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -65,25 +63,28 @@ public String toString() { return Utils.toString(DeleteWebhookRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + public DeleteWebhookRequest build() { + return new DeleteWebhookRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookRequestBuilder.java index c97044a4..13df6a7e 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.DeleteWebhook; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class DeleteWebhookRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallDeleteWebhook sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public DeleteWebhookRequestBuilder(SDKMethodInterfaces.MethodCallDeleteWebhook sdk) { - this.sdk = sdk; + public DeleteWebhookRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public DeleteWebhookRequestBuilder id(java.lang.String id) { + public DeleteWebhookRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public DeleteWebhookResponse call() throws Exception { - return sdk.delete( - id); + private DeleteWebhookRequest buildRequest() { + + DeleteWebhookRequest request = new DeleteWebhookRequest(id); + + return request; + } + + public DeleteWebhookResponse call() { + + RequestOperation operation + = new DeleteWebhook.Sync(sdkConfiguration, _headers); + DeleteWebhookRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookResponse.java index 2bf2d4c4..03d69dd4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/DeleteWebhookResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Webhook; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class DeleteWebhookResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public DeleteWebhookResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public DeleteWebhookResponse withWebhook(Webhook webhook) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public DeleteWebhookResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public DeleteWebhookResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } DeleteWebhookResponse other = (DeleteWebhookResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.webhook, other.webhook) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.webhook, other.webhook) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - webhook, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + webhook, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "webhook", webhook, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional webhook = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder webhook(Optional webhook) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public DeleteWebhookResponse build() { + return new DeleteWebhookResponse( - contentType, - statusCode, - rawResponse, - webhook, - error); + contentType, statusCode, rawResponse, + webhook, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/From.java b/src/main/java/studio/livepeer/livepeer/models/operations/From.java index ea9acbaf..9216c915 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/From.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/From.java @@ -1,18 +1,16 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Long; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.time.OffsetDateTime; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; @@ -20,9 +18,10 @@ import studio.livepeer.livepeer.utils.Utils; /** - * From - Start timestamp for the query range (inclusive) + * From + * + *

Start timestamp for the query range (inclusive) */ - @JsonDeserialize(using = From._Deserializer.class) public class From { @@ -74,12 +73,12 @@ public boolean equals(java.lang.Object o) { return false; } From other = (From) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -87,8 +86,8 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(From.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -99,3 +98,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetRequest.java index bfaaaba9..4776d32c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetAssetRequest { - /** * ID of the asset */ @@ -37,10 +33,11 @@ public String assetId() { return assetId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the asset */ @@ -49,7 +46,7 @@ public GetAssetRequest withAssetId(String assetId) { this.assetId = assetId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } GetAssetRequest other = (GetAssetRequest) o; return - Objects.deepEquals(this.assetId, other.assetId); + Utils.enhancedDeepEquals(this.assetId, other.assetId); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( assetId); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(GetAssetRequest.class, "assetId", assetId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String assetId; - + + private String assetId; + private Builder() { // force use of static builder() method } + /** * ID of the asset */ @@ -91,11 +90,12 @@ public Builder assetId(String assetId) { this.assetId = assetId; return this; } - + public GetAssetRequest build() { + return new GetAssetRequest( assetId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetRequestBuilder.java index 4f8dceb5..1f595ace 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetAsset; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetAssetRequestBuilder { private String assetId; - private final SDKMethodInterfaces.MethodCallGetAsset sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetAssetRequestBuilder(SDKMethodInterfaces.MethodCallGetAsset sdk) { - this.sdk = sdk; + public GetAssetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetAssetRequestBuilder assetId(java.lang.String assetId) { + public GetAssetRequestBuilder assetId(String assetId) { Utils.checkNotNull(assetId, "assetId"); this.assetId = assetId; return this; } - public GetAssetResponse call() throws Exception { - return sdk.get( - assetId); + private GetAssetRequest buildRequest() { + + GetAssetRequest request = new GetAssetRequest(assetId); + + return request; + } + + public GetAssetResponse call() { + + RequestOperation operation + = new GetAsset.Sync(sdkConfiguration, _headers); + GetAssetRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetResponse.java index 3d5dd9e1..fbf94d1d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.models.components.Asset; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetAssetResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public GetAssetResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public GetAssetResponse withAsset(Asset asset) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public GetAssetResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public GetAssetResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } GetAssetResponse other = (GetAssetResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.asset, other.asset) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.asset, other.asset) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - asset, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + asset, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "asset", asset, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional asset = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder asset(Optional asset) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetAssetResponse build() { + return new GetAssetResponse( - contentType, - statusCode, - rawResponse, - asset, - error); + contentType, statusCode, rawResponse, + asset, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetsRequestBuilder.java index 2eee14c7..175e4f1c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetsRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetsRequestBuilder.java @@ -1,20 +1,28 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; + +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetAssets; +import studio.livepeer.livepeer.utils.Headers; public class GetAssetsRequestBuilder { - private final SDKMethodInterfaces.MethodCallGetAssets sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetAssetsRequestBuilder(SDKMethodInterfaces.MethodCallGetAssets sdk) { - this.sdk = sdk; + public GetAssetsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetAssetsResponse call() throws Exception { + public GetAssetsResponse call() { + + RequestlessOperation operation + = new GetAssets.Sync(sdkConfiguration, _headers); - return sdk.getAllDirect(); + return operation.handleResponse(operation.doRequest()); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetsResponse.java index 9ff146dd..0dec6b1b 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetsResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetAssetsResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.models.components.Asset; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetAssetsResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetAssetsResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetAssetsResponse withData(List data) { return this; } + /** * Success */ @@ -175,6 +174,7 @@ public GetAssetsResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetAssetsResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetAssetsResponse other = (GetAssetsResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetAssetsResponse build() { + return new GetAssetsResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetClipsRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetClipsRequest.java index f7305ef7..5770379b 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetClipsRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetClipsRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetClipsRequest { - /** * ID of the parent stream or playbackId of parent stream */ @@ -37,10 +33,11 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the parent stream or playbackId of parent stream */ @@ -49,7 +46,7 @@ public GetClipsRequest withId(String id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } GetClipsRequest other = (GetClipsRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(GetClipsRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + /** * ID of the parent stream or playbackId of parent stream */ @@ -91,11 +90,12 @@ public Builder id(String id) { this.id = id; return this; } - + public GetClipsRequest build() { + return new GetClipsRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetClipsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetClipsRequestBuilder.java index 9c178204..29f6f980 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetClipsRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetClipsRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetClips; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetClipsRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallGetClips sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetClipsRequestBuilder(SDKMethodInterfaces.MethodCallGetClips sdk) { - this.sdk = sdk; + public GetClipsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetClipsRequestBuilder id(java.lang.String id) { + public GetClipsRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public GetClipsResponse call() throws Exception { - return sdk.getClips( - id); + private GetClipsRequest buildRequest() { + + GetClipsRequest request = new GetClipsRequest(id); + + return request; + } + + public GetClipsResponse call() { + + RequestOperation operation + = new GetClips.Sync(sdkConfiguration, _headers); + GetClipsRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetClipsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetClipsResponse.java index b4191b3f..6dae0fed 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetClipsResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetClipsResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.models.components.Asset; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetClipsResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetClipsResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetClipsResponse withData(List data) { return this; } + /** * Success */ @@ -175,6 +174,7 @@ public GetClipsResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetClipsResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetClipsResponse other = (GetClipsResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetClipsResponse build() { + return new GetClipsResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsQueryParamBreakdownBy.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsQueryParamBreakdownBy.java index a5a904d5..db5e5f33 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsQueryParamBreakdownBy.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsQueryParamBreakdownBy.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum GetCreatorViewershipMetricsQueryParamBreakdownBy { DEVICE_TYPE("deviceType"), @@ -23,11 +24,21 @@ public enum GetCreatorViewershipMetricsQueryParamBreakdownBy { @JsonValue private final String value; - private GetCreatorViewershipMetricsQueryParamBreakdownBy(String value) { + GetCreatorViewershipMetricsQueryParamBreakdownBy(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (GetCreatorViewershipMetricsQueryParamBreakdownBy o: GetCreatorViewershipMetricsQueryParamBreakdownBy.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsRequest.java index 660dc3b3..ece3fe2b 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsRequest.java @@ -1,24 +1,20 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetCreatorViewershipMetricsRequest { - /** * Start timestamp for the query range (inclusive) */ @@ -58,7 +54,6 @@ public class GetCreatorViewershipMetricsRequest { /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=breakdownBy[]") private Optional> breakdownBy; @@ -89,7 +84,9 @@ public GetCreatorViewershipMetricsRequest( } public GetCreatorViewershipMetricsRequest() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -146,7 +143,6 @@ public Optional creatorId() { /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -154,10 +150,11 @@ public Optional> breakdow return (Optional>) breakdownBy; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Start timestamp for the query range (inclusive) */ @@ -167,6 +164,7 @@ public GetCreatorViewershipMetricsRequest withFrom(QueryParamFrom from) { return this; } + /** * Start timestamp for the query range (inclusive) */ @@ -185,6 +183,7 @@ public GetCreatorViewershipMetricsRequest withTo(QueryParamTo to) { return this; } + /** * End timestamp for the query range (exclusive) */ @@ -203,6 +202,7 @@ public GetCreatorViewershipMetricsRequest withTimeStep(QueryParamTimeStep timeSt return this; } + /** * The time step to aggregate viewership metrics by */ @@ -221,6 +221,7 @@ public GetCreatorViewershipMetricsRequest withAssetId(String assetId) { return this; } + /** * The asset ID to filter metrics for */ @@ -239,6 +240,7 @@ public GetCreatorViewershipMetricsRequest withStreamId(String streamId) { return this; } + /** * The stream ID to filter metrics for */ @@ -257,6 +259,7 @@ public GetCreatorViewershipMetricsRequest withCreatorId(String creatorId) { return this; } + /** * The creator ID to filter the query results */ @@ -269,7 +272,6 @@ public GetCreatorViewershipMetricsRequest withCreatorId(Optional creator /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ public GetCreatorViewershipMetricsRequest withBreakdownBy(List breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); @@ -277,17 +279,17 @@ public GetCreatorViewershipMetricsRequest withBreakdownBy(List> breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); this.breakdownBy = breakdownBy; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -298,24 +300,20 @@ public boolean equals(java.lang.Object o) { } GetCreatorViewershipMetricsRequest other = (GetCreatorViewershipMetricsRequest) o; return - Objects.deepEquals(this.from, other.from) && - Objects.deepEquals(this.to, other.to) && - Objects.deepEquals(this.timeStep, other.timeStep) && - Objects.deepEquals(this.assetId, other.assetId) && - Objects.deepEquals(this.streamId, other.streamId) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.breakdownBy, other.breakdownBy); + Utils.enhancedDeepEquals(this.from, other.from) && + Utils.enhancedDeepEquals(this.to, other.to) && + Utils.enhancedDeepEquals(this.timeStep, other.timeStep) && + Utils.enhancedDeepEquals(this.assetId, other.assetId) && + Utils.enhancedDeepEquals(this.streamId, other.streamId) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.breakdownBy, other.breakdownBy); } @Override public int hashCode() { - return Objects.hash( - from, - to, - timeStep, - assetId, - streamId, - creatorId, + return Utils.enhancedHash( + from, to, timeStep, + assetId, streamId, creatorId, breakdownBy); } @@ -330,27 +328,29 @@ public String toString() { "creatorId", creatorId, "breakdownBy", breakdownBy); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional from = Optional.empty(); - + private Optional to = Optional.empty(); - + private Optional timeStep = Optional.empty(); - + private Optional assetId = Optional.empty(); - + private Optional streamId = Optional.empty(); - + private Optional creatorId = Optional.empty(); - - private Optional> breakdownBy = Optional.empty(); - + + private Optional> breakdownBy = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Start timestamp for the query range (inclusive) */ @@ -369,6 +369,7 @@ public Builder from(Optional from) { return this; } + /** * End timestamp for the query range (exclusive) */ @@ -387,6 +388,7 @@ public Builder to(Optional to) { return this; } + /** * The time step to aggregate viewership metrics by */ @@ -405,6 +407,7 @@ public Builder timeStep(Optional timeStep) { return this; } + /** * The asset ID to filter metrics for */ @@ -423,6 +426,7 @@ public Builder assetId(Optional assetId) { return this; } + /** * The stream ID to filter metrics for */ @@ -441,6 +445,7 @@ public Builder streamId(Optional streamId) { return this; } + /** * The creator ID to filter the query results */ @@ -459,10 +464,10 @@ public Builder creatorId(Optional creatorId) { return this; } + /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ public Builder breakdownBy(List breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); @@ -473,24 +478,20 @@ public Builder breakdownBy(List> breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); this.breakdownBy = breakdownBy; return this; } - + public GetCreatorViewershipMetricsRequest build() { + return new GetCreatorViewershipMetricsRequest( - from, - to, - timeStep, - assetId, - streamId, - creatorId, + from, to, timeStep, + assetId, streamId, creatorId, breakdownBy); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsRequestBuilder.java index f5bc5bb5..90e974db 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsRequestBuilder.java @@ -1,29 +1,36 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetCreatorViewershipMetrics; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetCreatorViewershipMetricsRequestBuilder { private GetCreatorViewershipMetricsRequest request; - private final SDKMethodInterfaces.MethodCallGetCreatorViewershipMetrics sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetCreatorViewershipMetricsRequestBuilder(SDKMethodInterfaces.MethodCallGetCreatorViewershipMetrics sdk) { - this.sdk = sdk; + public GetCreatorViewershipMetricsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetCreatorViewershipMetricsRequestBuilder request(studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsRequest request) { + public GetCreatorViewershipMetricsRequestBuilder request(GetCreatorViewershipMetricsRequest request) { Utils.checkNotNull(request, "request"); this.request = request; return this; } - public GetCreatorViewershipMetricsResponse call() throws Exception { + public GetCreatorViewershipMetricsResponse call() { + + RequestOperation operation + = new GetCreatorViewershipMetrics.Sync(sdkConfiguration, _headers); - return sdk.getCreatorViewership( - request); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsResponse.java index 2b68e89a..50f146c2 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetCreatorViewershipMetricsResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.ViewershipMetric; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetCreatorViewershipMetricsResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetCreatorViewershipMetricsResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetCreatorViewershipMetricsResponse withData(List data) return this; } + /** * A list of Metric objects */ @@ -175,6 +174,7 @@ public GetCreatorViewershipMetricsResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetCreatorViewershipMetricsResponse withError(Optional e this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetCreatorViewershipMetricsResponse other = (GetCreatorViewershipMetricsResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * A list of Metric objects */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetCreatorViewershipMetricsResponse build() { + return new GetCreatorViewershipMetricsResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetRequest.java index 56b44bce..7a2f3b8f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetMultistreamTargetRequest { - /** * ID of the multistream target */ @@ -37,10 +33,11 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the multistream target */ @@ -49,7 +46,7 @@ public GetMultistreamTargetRequest withId(String id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } GetMultistreamTargetRequest other = (GetMultistreamTargetRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(GetMultistreamTargetRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + /** * ID of the multistream target */ @@ -91,11 +90,12 @@ public Builder id(String id) { this.id = id; return this; } - + public GetMultistreamTargetRequest build() { + return new GetMultistreamTargetRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetRequestBuilder.java index 90d3b7ac..5c127090 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetMultistreamTargetRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallGetMultistreamTarget sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetMultistreamTargetRequestBuilder(SDKMethodInterfaces.MethodCallGetMultistreamTarget sdk) { - this.sdk = sdk; + public GetMultistreamTargetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetMultistreamTargetRequestBuilder id(java.lang.String id) { + public GetMultistreamTargetRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public GetMultistreamTargetResponse call() throws Exception { - return sdk.get( - id); + private GetMultistreamTargetRequest buildRequest() { + + GetMultistreamTargetRequest request = new GetMultistreamTargetRequest(id); + + return request; + } + + public GetMultistreamTargetResponse call() { + + RequestOperation operation + = new GetMultistreamTarget.Sync(sdkConfiguration, _headers); + GetMultistreamTargetRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetResponse.java index 587058de..cbf23829 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.MultistreamTarget; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetMultistreamTargetResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public GetMultistreamTargetResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public GetMultistreamTargetResponse withMultistreamTarget(MultistreamTarget mult return this; } + /** * Success */ @@ -174,6 +173,7 @@ public GetMultistreamTargetResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public GetMultistreamTargetResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } GetMultistreamTargetResponse other = (GetMultistreamTargetResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.multistreamTarget, other.multistreamTarget) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.multistreamTarget, other.multistreamTarget) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - multistreamTarget, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + multistreamTarget, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "multistreamTarget", multistreamTarget, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional multistreamTarget = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder multistreamTarget(Optional multistre return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetMultistreamTargetResponse build() { + return new GetMultistreamTargetResponse( - contentType, - statusCode, - rawResponse, - multistreamTarget, - error); + contentType, statusCode, rawResponse, + multistreamTarget, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetsRequestBuilder.java index 9171e12d..3213f595 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetsRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetsRequestBuilder.java @@ -1,20 +1,28 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; + +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetMultistreamTargets; +import studio.livepeer.livepeer.utils.Headers; public class GetMultistreamTargetsRequestBuilder { - private final SDKMethodInterfaces.MethodCallGetMultistreamTargets sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetMultistreamTargetsRequestBuilder(SDKMethodInterfaces.MethodCallGetMultistreamTargets sdk) { - this.sdk = sdk; + public GetMultistreamTargetsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetMultistreamTargetsResponse call() throws Exception { + public GetMultistreamTargetsResponse call() { + + RequestlessOperation operation + = new GetMultistreamTargets.Sync(sdkConfiguration, _headers); - return sdk.getAllDirect(); + return operation.handleResponse(operation.doRequest()); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetsResponse.java index 70d231b5..668788a6 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetsResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetMultistreamTargetsResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.MultistreamTarget; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetMultistreamTargetsResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetMultistreamTargetsResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetMultistreamTargetsResponse withData(List data) { return this; } + /** * Success */ @@ -175,6 +174,7 @@ public GetMultistreamTargetsResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetMultistreamTargetsResponse withError(Optional error) this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetMultistreamTargetsResponse other = (GetMultistreamTargetsResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetMultistreamTargetsResponse build() { + return new GetMultistreamTargetsResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoRequest.java index ed7ea866..ce9c5cc9 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetPlaybackInfoRequest { - /** * The playback ID from the asset or livestream, e.g. `eaw4nk06ts2d0mzb`. */ @@ -37,10 +33,11 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The playback ID from the asset or livestream, e.g. `eaw4nk06ts2d0mzb`. */ @@ -49,7 +46,7 @@ public GetPlaybackInfoRequest withId(String id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } GetPlaybackInfoRequest other = (GetPlaybackInfoRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(GetPlaybackInfoRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + /** * The playback ID from the asset or livestream, e.g. `eaw4nk06ts2d0mzb`. */ @@ -91,11 +90,12 @@ public Builder id(String id) { this.id = id; return this; } - + public GetPlaybackInfoRequest build() { + return new GetPlaybackInfoRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoRequestBuilder.java index 0e5e60ef..70d00446 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetPlaybackInfo; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetPlaybackInfoRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallGetPlaybackInfo sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetPlaybackInfoRequestBuilder(SDKMethodInterfaces.MethodCallGetPlaybackInfo sdk) { - this.sdk = sdk; + public GetPlaybackInfoRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetPlaybackInfoRequestBuilder id(java.lang.String id) { + public GetPlaybackInfoRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public GetPlaybackInfoResponse call() throws Exception { - return sdk.get( - id); + private GetPlaybackInfoRequest buildRequest() { + + GetPlaybackInfoRequest request = new GetPlaybackInfoRequest(id); + + return request; + } + + public GetPlaybackInfoResponse call() { + + RequestOperation operation + = new GetPlaybackInfo.Sync(sdkConfiguration, _headers); + GetPlaybackInfoRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoResponse.java index 4b1a9ef7..69472565 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetPlaybackInfoResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.PlaybackInfo; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetPlaybackInfoResponse implements Response { - /** * HTTP response content type for this operation */ @@ -42,27 +39,36 @@ public class GetPlaybackInfoResponse implements Response { */ private Optional playbackInfo; + /** + * Playback not found + */ + private Optional error; + @JsonCreator public GetPlaybackInfoResponse( String contentType, int statusCode, HttpResponse rawResponse, - Optional playbackInfo) { + Optional playbackInfo, + Optional error) { Utils.checkNotNull(contentType, "contentType"); Utils.checkNotNull(statusCode, "statusCode"); Utils.checkNotNull(rawResponse, "rawResponse"); Utils.checkNotNull(playbackInfo, "playbackInfo"); + Utils.checkNotNull(error, "error"); this.contentType = contentType; this.statusCode = statusCode; this.rawResponse = rawResponse; this.playbackInfo = playbackInfo; + this.error = error; } public GetPlaybackInfoResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -98,10 +104,20 @@ public Optional playbackInfo() { return (Optional) playbackInfo; } - public final static Builder builder() { + /** + * Playback not found + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +154,7 @@ public GetPlaybackInfoResponse withPlaybackInfo(PlaybackInfo playbackInfo) { return this; } + /** * Successful response */ @@ -146,7 +163,26 @@ public GetPlaybackInfoResponse withPlaybackInfo(Optional this.playbackInfo = playbackInfo; return this; } - + + /** + * Playback not found + */ + public GetPlaybackInfoResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Playback not found + */ + public GetPlaybackInfoResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,19 +193,18 @@ public boolean equals(java.lang.Object o) { } GetPlaybackInfoResponse other = (GetPlaybackInfoResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.playbackInfo, other.playbackInfo); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.playbackInfo, other.playbackInfo) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - playbackInfo); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + playbackInfo, error); } @Override @@ -178,23 +213,28 @@ public String toString() { "contentType", contentType, "statusCode", statusCode, "rawResponse", rawResponse, - "playbackInfo", playbackInfo); + "playbackInfo", playbackInfo, + "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional playbackInfo = Optional.empty(); - + + private Optional playbackInfo = Optional.empty(); + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Successful response */ @@ -239,14 +282,32 @@ public Builder playbackInfo(Optional playbackInfo) { this.playbackInfo = playbackInfo; return this; } - + + + /** + * Playback not found + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Playback not found + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + public GetPlaybackInfoResponse build() { + return new GetPlaybackInfoResponse( - contentType, - statusCode, - rawResponse, - playbackInfo); + contentType, statusCode, rawResponse, + playbackInfo, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsData.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsData.java index 71c21072..cfa4b02d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsData.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsData.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -14,18 +12,16 @@ import java.lang.Long; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; /** - * GetPublicViewershipMetricsData - A simplified metric object about aggregate viewership of an - * asset. Either playbackId or dStorageUrl will be set. + * GetPublicViewershipMetricsData * + *

A simplified metric object about aggregate viewership of an + * asset. Either playbackId or dStorageUrl will be set. */ - public class GetPublicViewershipMetricsData { - /** * The playback ID associated with the metric. */ @@ -71,7 +67,8 @@ public GetPublicViewershipMetricsData( } public GetPublicViewershipMetricsData() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty()); } /** @@ -106,10 +103,11 @@ public Optional playtimeMins() { return playtimeMins; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The playback ID associated with the metric. */ @@ -119,6 +117,7 @@ public GetPublicViewershipMetricsData withPlaybackId(String playbackId) { return this; } + /** * The playback ID associated with the metric. */ @@ -137,6 +136,7 @@ public GetPublicViewershipMetricsData withDStorageUrl(String dStorageUrl) { return this; } + /** * The URL of the distributed storage used for the asset */ @@ -155,6 +155,7 @@ public GetPublicViewershipMetricsData withViewCount(long viewCount) { return this; } + /** * The number of views for the stream/asset. */ @@ -173,6 +174,7 @@ public GetPublicViewershipMetricsData withPlaytimeMins(double playtimeMins) { return this; } + /** * The total playtime in minutes for the stream/asset. */ @@ -181,7 +183,7 @@ public GetPublicViewershipMetricsData withPlaytimeMins(Optional playtime this.playtimeMins = playtimeMins; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -192,18 +194,16 @@ public boolean equals(java.lang.Object o) { } GetPublicViewershipMetricsData other = (GetPublicViewershipMetricsData) o; return - Objects.deepEquals(this.playbackId, other.playbackId) && - Objects.deepEquals(this.dStorageUrl, other.dStorageUrl) && - Objects.deepEquals(this.viewCount, other.viewCount) && - Objects.deepEquals(this.playtimeMins, other.playtimeMins); + Utils.enhancedDeepEquals(this.playbackId, other.playbackId) && + Utils.enhancedDeepEquals(this.dStorageUrl, other.dStorageUrl) && + Utils.enhancedDeepEquals(this.viewCount, other.viewCount) && + Utils.enhancedDeepEquals(this.playtimeMins, other.playtimeMins); } @Override public int hashCode() { - return Objects.hash( - playbackId, - dStorageUrl, - viewCount, + return Utils.enhancedHash( + playbackId, dStorageUrl, viewCount, playtimeMins); } @@ -215,21 +215,23 @@ public String toString() { "viewCount", viewCount, "playtimeMins", playtimeMins); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional playbackId = Optional.empty(); - + private Optional dStorageUrl = Optional.empty(); - + private Optional viewCount = Optional.empty(); - - private Optional playtimeMins = Optional.empty(); - + + private Optional playtimeMins = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * The playback ID associated with the metric. */ @@ -248,6 +250,7 @@ public Builder playbackId(Optional playbackId) { return this; } + /** * The URL of the distributed storage used for the asset */ @@ -266,6 +269,7 @@ public Builder dStorageUrl(Optional dStorageUrl) { return this; } + /** * The number of views for the stream/asset. */ @@ -284,6 +288,7 @@ public Builder viewCount(Optional viewCount) { return this; } + /** * The total playtime in minutes for the stream/asset. */ @@ -301,14 +306,13 @@ public Builder playtimeMins(Optional playtimeMins) { this.playtimeMins = playtimeMins; return this; } - + public GetPublicViewershipMetricsData build() { + return new GetPublicViewershipMetricsData( - playbackId, - dStorageUrl, - viewCount, + playbackId, dStorageUrl, viewCount, playtimeMins); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsRequest.java index 8d834ad6..acc662b9 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsRequest.java @@ -1,26 +1,21 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetPublicViewershipMetricsRequest { - /** * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=playbackId") private String playbackId; @@ -36,29 +31,28 @@ public GetPublicViewershipMetricsRequest( * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ @JsonIgnore public String playbackId() { return playbackId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ public GetPublicViewershipMetricsRequest withPlaybackId(String playbackId) { Utils.checkNotNull(playbackId, "playbackId"); this.playbackId = playbackId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -69,12 +63,12 @@ public boolean equals(java.lang.Object o) { } GetPublicViewershipMetricsRequest other = (GetPublicViewershipMetricsRequest) o; return - Objects.deepEquals(this.playbackId, other.playbackId); + Utils.enhancedDeepEquals(this.playbackId, other.playbackId); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( playbackId); } @@ -83,31 +77,33 @@ public String toString() { return Utils.toString(GetPublicViewershipMetricsRequest.class, "playbackId", playbackId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String playbackId; - + + private String playbackId; + private Builder() { // force use of static builder() method } + /** * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ public Builder playbackId(String playbackId) { Utils.checkNotNull(playbackId, "playbackId"); this.playbackId = playbackId; return this; } - + public GetPublicViewershipMetricsRequest build() { + return new GetPublicViewershipMetricsRequest( playbackId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsRequestBuilder.java index 6f435f22..2d3969ab 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetPublicViewershipMetrics; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetPublicViewershipMetricsRequestBuilder { private String playbackId; - private final SDKMethodInterfaces.MethodCallGetPublicViewershipMetrics sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetPublicViewershipMetricsRequestBuilder(SDKMethodInterfaces.MethodCallGetPublicViewershipMetrics sdk) { - this.sdk = sdk; + public GetPublicViewershipMetricsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetPublicViewershipMetricsRequestBuilder playbackId(java.lang.String playbackId) { + public GetPublicViewershipMetricsRequestBuilder playbackId(String playbackId) { Utils.checkNotNull(playbackId, "playbackId"); this.playbackId = playbackId; return this; } - public GetPublicViewershipMetricsResponse call() throws Exception { - return sdk.getPublicViewership( - playbackId); + private GetPublicViewershipMetricsRequest buildRequest() { + + GetPublicViewershipMetricsRequest request = new GetPublicViewershipMetricsRequest(playbackId); + + return request; + } + + public GetPublicViewershipMetricsResponse call() { + + RequestOperation operation + = new GetPublicViewershipMetrics.Sync(sdkConfiguration, _headers); + GetPublicViewershipMetricsRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsResponse.java index 2b49c5c5..d6082393 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetPublicViewershipMetricsResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetPublicViewershipMetricsResponse implements Response { - /** * HTTP response content type for this operation */ @@ -70,7 +66,8 @@ public GetPublicViewershipMetricsResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -115,10 +112,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -155,6 +153,7 @@ public GetPublicViewershipMetricsResponse withData(GetPublicViewershipMetricsDat return this; } + /** * A single Metric object with the viewCount and playtimeMins metrics. */ @@ -173,6 +172,7 @@ public GetPublicViewershipMetricsResponse withError(Error error) { return this; } + /** * Error */ @@ -181,7 +181,7 @@ public GetPublicViewershipMetricsResponse withError(Optional er this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -192,21 +192,18 @@ public boolean equals(java.lang.Object o) { } GetPublicViewershipMetricsResponse other = (GetPublicViewershipMetricsResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -218,23 +215,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -244,6 +243,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -253,6 +253,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -262,6 +263,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * A single Metric object with the viewCount and playtimeMins metrics. */ @@ -280,6 +282,7 @@ public Builder data(Optional data) { return this; } + /** * Error */ @@ -297,15 +300,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetPublicViewershipMetricsResponse build() { + return new GetPublicViewershipMetricsResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowRequest.java index bdd282e0..9a8930d4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowRequest.java @@ -1,29 +1,24 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetRealtimeViewershipNowRequest { - /** * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=playbackId") private Optional playbackId; @@ -37,7 +32,6 @@ public class GetRealtimeViewershipNowRequest { /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=breakdownBy[]") private Optional> breakdownBy; @@ -63,7 +57,6 @@ public GetRealtimeViewershipNowRequest() { * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ @JsonIgnore public Optional playbackId() { @@ -81,7 +74,6 @@ public Optional creatorId() { /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -89,15 +81,15 @@ public Optional> breakdownBy() { return (Optional>) breakdownBy; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ public GetRealtimeViewershipNowRequest withPlaybackId(String playbackId) { Utils.checkNotNull(playbackId, "playbackId"); @@ -105,11 +97,11 @@ public GetRealtimeViewershipNowRequest withPlaybackId(String playbackId) { return this; } + /** * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ public GetRealtimeViewershipNowRequest withPlaybackId(Optional playbackId) { Utils.checkNotNull(playbackId, "playbackId"); @@ -126,6 +118,7 @@ public GetRealtimeViewershipNowRequest withCreatorId(String creatorId) { return this; } + /** * The creator ID to filter the query results */ @@ -138,7 +131,6 @@ public GetRealtimeViewershipNowRequest withCreatorId(Optional creatorId) /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ public GetRealtimeViewershipNowRequest withBreakdownBy(List breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); @@ -146,17 +138,17 @@ public GetRealtimeViewershipNowRequest withBreakdownBy(List breakdo return this; } + /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ public GetRealtimeViewershipNowRequest withBreakdownBy(Optional> breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); this.breakdownBy = breakdownBy; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -167,17 +159,15 @@ public boolean equals(java.lang.Object o) { } GetRealtimeViewershipNowRequest other = (GetRealtimeViewershipNowRequest) o; return - Objects.deepEquals(this.playbackId, other.playbackId) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.breakdownBy, other.breakdownBy); + Utils.enhancedDeepEquals(this.playbackId, other.playbackId) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.breakdownBy, other.breakdownBy); } @Override public int hashCode() { - return Objects.hash( - playbackId, - creatorId, - breakdownBy); + return Utils.enhancedHash( + playbackId, creatorId, breakdownBy); } @Override @@ -187,24 +177,25 @@ public String toString() { "creatorId", creatorId, "breakdownBy", breakdownBy); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional playbackId = Optional.empty(); - + private Optional creatorId = Optional.empty(); - - private Optional> breakdownBy = Optional.empty(); - + + private Optional> breakdownBy = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ public Builder playbackId(String playbackId) { Utils.checkNotNull(playbackId, "playbackId"); @@ -216,7 +207,6 @@ public Builder playbackId(String playbackId) { * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ public Builder playbackId(Optional playbackId) { Utils.checkNotNull(playbackId, "playbackId"); @@ -224,6 +214,7 @@ public Builder playbackId(Optional playbackId) { return this; } + /** * The creator ID to filter the query results */ @@ -242,10 +233,10 @@ public Builder creatorId(Optional creatorId) { return this; } + /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ public Builder breakdownBy(List breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); @@ -256,20 +247,18 @@ public Builder breakdownBy(List breakdownBy) { /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ public Builder breakdownBy(Optional> breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); this.breakdownBy = breakdownBy; return this; } - + public GetRealtimeViewershipNowRequest build() { + return new GetRealtimeViewershipNowRequest( - playbackId, - creatorId, - breakdownBy); + playbackId, creatorId, breakdownBy); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowRequestBuilder.java index 589383c0..1abf54fd 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowRequestBuilder.java @@ -1,12 +1,16 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; import java.util.List; import java.util.Optional; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetRealtimeViewershipNow; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetRealtimeViewershipNowRequestBuilder { @@ -14,53 +18,65 @@ public class GetRealtimeViewershipNowRequestBuilder { private Optional playbackId = Optional.empty(); private Optional creatorId = Optional.empty(); private Optional> breakdownBy = Optional.empty(); - private final SDKMethodInterfaces.MethodCallGetRealtimeViewershipNow sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetRealtimeViewershipNowRequestBuilder(SDKMethodInterfaces.MethodCallGetRealtimeViewershipNow sdk) { - this.sdk = sdk; + public GetRealtimeViewershipNowRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetRealtimeViewershipNowRequestBuilder playbackId(java.lang.String playbackId) { + public GetRealtimeViewershipNowRequestBuilder playbackId(String playbackId) { Utils.checkNotNull(playbackId, "playbackId"); this.playbackId = Optional.of(playbackId); return this; } - public GetRealtimeViewershipNowRequestBuilder playbackId(java.util.Optional playbackId) { + public GetRealtimeViewershipNowRequestBuilder playbackId(Optional playbackId) { Utils.checkNotNull(playbackId, "playbackId"); this.playbackId = playbackId; return this; } - public GetRealtimeViewershipNowRequestBuilder creatorId(java.lang.String creatorId) { + public GetRealtimeViewershipNowRequestBuilder creatorId(String creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = Optional.of(creatorId); return this; } - public GetRealtimeViewershipNowRequestBuilder creatorId(java.util.Optional creatorId) { + public GetRealtimeViewershipNowRequestBuilder creatorId(Optional creatorId) { Utils.checkNotNull(creatorId, "creatorId"); this.creatorId = creatorId; return this; } - public GetRealtimeViewershipNowRequestBuilder breakdownBy(java.util.List breakdownBy) { + public GetRealtimeViewershipNowRequestBuilder breakdownBy(List breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); this.breakdownBy = Optional.of(breakdownBy); return this; } - public GetRealtimeViewershipNowRequestBuilder breakdownBy(java.util.Optional> breakdownBy) { + public GetRealtimeViewershipNowRequestBuilder breakdownBy(Optional> breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); this.breakdownBy = breakdownBy; return this; } - public GetRealtimeViewershipNowResponse call() throws Exception { - return sdk.getRealtimeViewership( - playbackId, + private GetRealtimeViewershipNowRequest buildRequest() { + + GetRealtimeViewershipNowRequest request = new GetRealtimeViewershipNowRequest(playbackId, creatorId, breakdownBy); + + return request; + } + + public GetRealtimeViewershipNowResponse call() { + + RequestOperation operation + = new GetRealtimeViewershipNow.Sync(sdkConfiguration, _headers); + GetRealtimeViewershipNowRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowResponse.java index 1f72bb84..89a31d4c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetRealtimeViewershipNowResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.RealtimeViewershipMetric; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetRealtimeViewershipNowResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetRealtimeViewershipNowResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetRealtimeViewershipNowResponse withData(List return this; } + /** * A list of Metric objects */ @@ -175,6 +174,7 @@ public GetRealtimeViewershipNowResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetRealtimeViewershipNowResponse withError(Optional erro this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetRealtimeViewershipNowResponse other = (GetRealtimeViewershipNowResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * A list of Metric objects */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetRealtimeViewershipNowResponse build() { + return new GetRealtimeViewershipNowResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsRequest.java index 0c1c5696..5e43c1ec 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsRequest.java @@ -1,23 +1,19 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetRecordedSessionsRequest { - /** * ID of the parent stream */ @@ -27,7 +23,6 @@ public class GetRecordedSessionsRequest { /** * Flag indicating if the response should only include recorded * sessions - * */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=record") private Optional record; @@ -58,7 +53,6 @@ public String parentId() { /** * Flag indicating if the response should only include recorded * sessions - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -66,10 +60,11 @@ public Optional record() { return (Optional) record; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the parent stream */ @@ -82,7 +77,6 @@ public GetRecordedSessionsRequest withParentId(String parentId) { /** * Flag indicating if the response should only include recorded * sessions - * */ public GetRecordedSessionsRequest withRecord(Record record) { Utils.checkNotNull(record, "record"); @@ -90,17 +84,17 @@ public GetRecordedSessionsRequest withRecord(Record record) { return this; } + /** * Flag indicating if the response should only include recorded * sessions - * */ public GetRecordedSessionsRequest withRecord(Optional record) { Utils.checkNotNull(record, "record"); this.record = record; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -111,15 +105,14 @@ public boolean equals(java.lang.Object o) { } GetRecordedSessionsRequest other = (GetRecordedSessionsRequest) o; return - Objects.deepEquals(this.parentId, other.parentId) && - Objects.deepEquals(this.record, other.record); + Utils.enhancedDeepEquals(this.parentId, other.parentId) && + Utils.enhancedDeepEquals(this.record, other.record); } @Override public int hashCode() { - return Objects.hash( - parentId, - record); + return Utils.enhancedHash( + parentId, record); } @Override @@ -128,17 +121,19 @@ public String toString() { "parentId", parentId, "record", record); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String parentId; - - private Optional record = Optional.empty(); - + + private Optional record = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * ID of the parent stream */ @@ -148,10 +143,10 @@ public Builder parentId(String parentId) { return this; } + /** * Flag indicating if the response should only include recorded * sessions - * */ public Builder record(Record record) { Utils.checkNotNull(record, "record"); @@ -162,19 +157,18 @@ public Builder record(Record record) { /** * Flag indicating if the response should only include recorded * sessions - * */ public Builder record(Optional record) { Utils.checkNotNull(record, "record"); this.record = record; return this; } - + public GetRecordedSessionsRequest build() { + return new GetRecordedSessionsRequest( - parentId, - record); + parentId, record); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsRequestBuilder.java index 2017ed17..a52a2804 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsRequestBuilder.java @@ -1,45 +1,61 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; import java.util.Optional; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetRecordedSessions; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetRecordedSessionsRequestBuilder { private String parentId; private Optional record = Optional.empty(); - private final SDKMethodInterfaces.MethodCallGetRecordedSessions sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetRecordedSessionsRequestBuilder(SDKMethodInterfaces.MethodCallGetRecordedSessions sdk) { - this.sdk = sdk; + public GetRecordedSessionsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetRecordedSessionsRequestBuilder parentId(java.lang.String parentId) { + public GetRecordedSessionsRequestBuilder parentId(String parentId) { Utils.checkNotNull(parentId, "parentId"); this.parentId = parentId; return this; } - public GetRecordedSessionsRequestBuilder record(studio.livepeer.livepeer.models.operations.Record record) { + public GetRecordedSessionsRequestBuilder record(Record record) { Utils.checkNotNull(record, "record"); this.record = Optional.of(record); return this; } - public GetRecordedSessionsRequestBuilder record(java.util.Optional record) { + public GetRecordedSessionsRequestBuilder record(Optional record) { Utils.checkNotNull(record, "record"); this.record = record; return this; } - public GetRecordedSessionsResponse call() throws Exception { - return sdk.getRecorded( - parentId, + private GetRecordedSessionsRequest buildRequest() { + + GetRecordedSessionsRequest request = new GetRecordedSessionsRequest(parentId, record); + + return request; + } + + public GetRecordedSessionsResponse call() { + + RequestOperation operation + = new GetRecordedSessions.Sync(sdkConfiguration, _headers); + GetRecordedSessionsRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsResponse.java index 7cc44672..a2880dfb 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetRecordedSessionsResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Session; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetRecordedSessionsResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetRecordedSessionsResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetRecordedSessionsResponse withData(List data) { return this; } + /** * Success */ @@ -175,6 +174,7 @@ public GetRecordedSessionsResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetRecordedSessionsResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetRecordedSessionsResponse other = (GetRecordedSessionsResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetRecordedSessionsResponse build() { + return new GetRecordedSessionsResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomRequest.java index c7dd27bb..02fc4603 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -31,16 +28,17 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public GetRoomRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -51,12 +49,12 @@ public boolean equals(java.lang.Object o) { } GetRoomRequest other = (GetRoomRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -65,25 +63,28 @@ public String toString() { return Utils.toString(GetRoomRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + public GetRoomRequest build() { + return new GetRoomRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomRequestBuilder.java index e54d2c60..c2fc0391 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetRoom; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetRoomRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallGetRoom sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetRoomRequestBuilder(SDKMethodInterfaces.MethodCallGetRoom sdk) { - this.sdk = sdk; + public GetRoomRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetRoomRequestBuilder id(java.lang.String id) { + public GetRoomRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public GetRoomResponse call() throws Exception { - return sdk.get( - id); + private GetRoomRequest buildRequest() { + + GetRoomRequest request = new GetRoomRequest(id); + + return request; + } + + public GetRoomResponse call() { + + RequestOperation operation + = new GetRoom.Sync(sdkConfiguration, _headers); + GetRoomRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomResponse.java index e5df89b0..abd27042 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Room; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetRoomResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public GetRoomResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public GetRoomResponse withRoom(Room room) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public GetRoomResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public GetRoomResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } GetRoomResponse other = (GetRoomResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.room, other.room) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.room, other.room) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - room, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + room, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "room", room, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional room = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder room(Optional room) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetRoomResponse build() { + return new GetRoomResponse( - contentType, - statusCode, - rawResponse, - room, - error); + contentType, statusCode, rawResponse, + room, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserRequest.java index 8a7e177a..170edfea 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -19,6 +16,7 @@ public class GetRoomUserRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=userId") private String userId; @@ -42,10 +40,11 @@ public String userId() { return userId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public GetRoomUserRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -57,7 +56,7 @@ public GetRoomUserRequest withUserId(String userId) { this.userId = userId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -68,15 +67,14 @@ public boolean equals(java.lang.Object o) { } GetRoomUserRequest other = (GetRoomUserRequest) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.userId, other.userId); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.userId, other.userId); } @Override public int hashCode() { - return Objects.hash( - id, - userId); + return Utils.enhancedHash( + id, userId); } @Override @@ -85,34 +83,37 @@ public String toString() { "id", id, "userId", userId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - - private String userId; - + + private String userId; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } + public Builder userId(String userId) { Utils.checkNotNull(userId, "userId"); this.userId = userId; return this; } - + public GetRoomUserRequest build() { + return new GetRoomUserRequest( - id, - userId); + id, userId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserRequestBuilder.java index 17fbe15e..9c50834f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserRequestBuilder.java @@ -1,38 +1,54 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetRoomUser; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetRoomUserRequestBuilder { private String id; private String userId; - private final SDKMethodInterfaces.MethodCallGetRoomUser sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetRoomUserRequestBuilder(SDKMethodInterfaces.MethodCallGetRoomUser sdk) { - this.sdk = sdk; + public GetRoomUserRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetRoomUserRequestBuilder id(java.lang.String id) { + public GetRoomUserRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public GetRoomUserRequestBuilder userId(java.lang.String userId) { + public GetRoomUserRequestBuilder userId(String userId) { Utils.checkNotNull(userId, "userId"); this.userId = userId; return this; } - public GetRoomUserResponse call() throws Exception { - return sdk.getUser( - id, + private GetRoomUserRequest buildRequest() { + + GetRoomUserRequest request = new GetRoomUserRequest(id, userId); + + return request; + } + + public GetRoomUserResponse call() { + + RequestOperation operation + = new GetRoomUser.Sync(sdkConfiguration, _headers); + GetRoomUserRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserResponse.java index 002fe901..fcc3a342 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetRoomUserResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetRoomUserResponse implements Response { - /** * HTTP response content type for this operation */ @@ -70,7 +66,8 @@ public GetRoomUserResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -115,10 +112,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -155,6 +153,7 @@ public GetRoomUserResponse withGetRoomUserResponse(studio.livepeer.livepeer.mode return this; } + /** * Success */ @@ -173,6 +172,7 @@ public GetRoomUserResponse withError(Error error) { return this; } + /** * Error */ @@ -181,7 +181,7 @@ public GetRoomUserResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -192,21 +192,18 @@ public boolean equals(java.lang.Object o) { } GetRoomUserResponse other = (GetRoomUserResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.getRoomUserResponse, other.getRoomUserResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.getRoomUserResponse, other.getRoomUserResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - getRoomUserResponse, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + getRoomUserResponse, error); } @Override @@ -218,23 +215,25 @@ public String toString() { "getRoomUserResponse", getRoomUserResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional getRoomUserResponse = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -244,6 +243,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -253,6 +253,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -262,6 +263,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -280,6 +282,7 @@ public Builder getRoomUserResponse(Optional error) { this.error = error; return this; } - + public GetRoomUserResponse build() { + return new GetRoomUserResponse( - contentType, - statusCode, - rawResponse, - getRoomUserResponse, - error); + contentType, statusCode, rawResponse, + getRoomUserResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsRequest.java index 14c6cbbc..dfe0db06 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetSessionClipsRequest { - /** * ID of the parent session */ @@ -37,10 +33,11 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the parent session */ @@ -49,7 +46,7 @@ public GetSessionClipsRequest withId(String id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } GetSessionClipsRequest other = (GetSessionClipsRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(GetSessionClipsRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + /** * ID of the parent session */ @@ -91,11 +90,12 @@ public Builder id(String id) { this.id = id; return this; } - + public GetSessionClipsRequest build() { + return new GetSessionClipsRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsRequestBuilder.java index de1abe41..99d12121 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetSessionClips; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetSessionClipsRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallGetSessionClips sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetSessionClipsRequestBuilder(SDKMethodInterfaces.MethodCallGetSessionClips sdk) { - this.sdk = sdk; + public GetSessionClipsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetSessionClipsRequestBuilder id(java.lang.String id) { + public GetSessionClipsRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public GetSessionClipsResponse call() throws Exception { - return sdk.getClips( - id); + private GetSessionClipsRequest buildRequest() { + + GetSessionClipsRequest request = new GetSessionClipsRequest(id); + + return request; + } + + public GetSessionClipsResponse call() { + + RequestOperation operation + = new GetSessionClips.Sync(sdkConfiguration, _headers); + GetSessionClipsRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsResponse.java index 8007b698..603da0d9 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionClipsResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.models.components.Asset; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetSessionClipsResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetSessionClipsResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetSessionClipsResponse withData(List data) { return this; } + /** * Success */ @@ -175,6 +174,7 @@ public GetSessionClipsResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetSessionClipsResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetSessionClipsResponse other = (GetSessionClipsResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetSessionClipsResponse build() { + return new GetSessionClipsResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionRequest.java index d0ea4742..c5b959a9 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetSessionRequest { - /** * ID of the session */ @@ -37,10 +33,11 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the session */ @@ -49,7 +46,7 @@ public GetSessionRequest withId(String id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } GetSessionRequest other = (GetSessionRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(GetSessionRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + /** * ID of the session */ @@ -91,11 +90,12 @@ public Builder id(String id) { this.id = id; return this; } - + public GetSessionRequest build() { + return new GetSessionRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionRequestBuilder.java index 37d03546..6a0b0be4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetSession; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetSessionRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallGetSession sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetSessionRequestBuilder(SDKMethodInterfaces.MethodCallGetSession sdk) { - this.sdk = sdk; + public GetSessionRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetSessionRequestBuilder id(java.lang.String id) { + public GetSessionRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public GetSessionResponse call() throws Exception { - return sdk.get( - id); + private GetSessionRequest buildRequest() { + + GetSessionRequest request = new GetSessionRequest(id); + + return request; + } + + public GetSessionResponse call() { + + RequestOperation operation + = new GetSession.Sync(sdkConfiguration, _headers); + GetSessionRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionResponse.java index 624b79c6..a04b4f43 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Session; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetSessionResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public GetSessionResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public GetSessionResponse withSession(Session session) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public GetSessionResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public GetSessionResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } GetSessionResponse other = (GetSessionResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.session, other.session) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.session, other.session) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - session, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + session, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "session", session, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional session = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder session(Optional session) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetSessionResponse build() { + return new GetSessionResponse( - contentType, - statusCode, - rawResponse, - session, - error); + contentType, statusCode, rawResponse, + session, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionsRequestBuilder.java index 1154a120..8c4273af 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionsRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionsRequestBuilder.java @@ -1,20 +1,28 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; + +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetSessions; +import studio.livepeer.livepeer.utils.Headers; public class GetSessionsRequestBuilder { - private final SDKMethodInterfaces.MethodCallGetSessions sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetSessionsRequestBuilder(SDKMethodInterfaces.MethodCallGetSessions sdk) { - this.sdk = sdk; + public GetSessionsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetSessionsResponse call() throws Exception { + public GetSessionsResponse call() { + + RequestlessOperation operation + = new GetSessions.Sync(sdkConfiguration, _headers); - return sdk.getAllDirect(); + return operation.handleResponse(operation.doRequest()); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionsResponse.java index abd862ee..f63aa9d4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionsResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSessionsResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Session; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetSessionsResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetSessionsResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetSessionsResponse withData(List data) { return this; } + /** * Success */ @@ -175,6 +174,7 @@ public GetSessionsResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetSessionsResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetSessionsResponse other = (GetSessionsResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetSessionsResponse build() { + return new GetSessionsResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyRequest.java index 5a9655c9..b63972df 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetSigningKeyRequest { - /** * ID of the signing key */ @@ -37,10 +33,11 @@ public String keyId() { return keyId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the signing key */ @@ -49,7 +46,7 @@ public GetSigningKeyRequest withKeyId(String keyId) { this.keyId = keyId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } GetSigningKeyRequest other = (GetSigningKeyRequest) o; return - Objects.deepEquals(this.keyId, other.keyId); + Utils.enhancedDeepEquals(this.keyId, other.keyId); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( keyId); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(GetSigningKeyRequest.class, "keyId", keyId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String keyId; - + + private String keyId; + private Builder() { // force use of static builder() method } + /** * ID of the signing key */ @@ -91,11 +90,12 @@ public Builder keyId(String keyId) { this.keyId = keyId; return this; } - + public GetSigningKeyRequest build() { + return new GetSigningKeyRequest( keyId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyRequestBuilder.java index bbb76121..9e11f54c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetSigningKey; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetSigningKeyRequestBuilder { private String keyId; - private final SDKMethodInterfaces.MethodCallGetSigningKey sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetSigningKeyRequestBuilder(SDKMethodInterfaces.MethodCallGetSigningKey sdk) { - this.sdk = sdk; + public GetSigningKeyRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetSigningKeyRequestBuilder keyId(java.lang.String keyId) { + public GetSigningKeyRequestBuilder keyId(String keyId) { Utils.checkNotNull(keyId, "keyId"); this.keyId = keyId; return this; } - public GetSigningKeyResponse call() throws Exception { - return sdk.get( - keyId); + private GetSigningKeyRequest buildRequest() { + + GetSigningKeyRequest request = new GetSigningKeyRequest(keyId); + + return request; + } + + public GetSigningKeyResponse call() { + + RequestOperation operation + = new GetSigningKey.Sync(sdkConfiguration, _headers); + GetSigningKeyRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyResponse.java index dc0b02c5..8bfa4bdd 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeyResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.SigningKey; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetSigningKeyResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public GetSigningKeyResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public GetSigningKeyResponse withSigningKey(SigningKey signingKey) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public GetSigningKeyResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public GetSigningKeyResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } GetSigningKeyResponse other = (GetSigningKeyResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.signingKey, other.signingKey) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.signingKey, other.signingKey) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - signingKey, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + signingKey, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "signingKey", signingKey, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional signingKey = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder signingKey(Optional signingKey) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetSigningKeyResponse build() { + return new GetSigningKeyResponse( - contentType, - statusCode, - rawResponse, - signingKey, - error); + contentType, statusCode, rawResponse, + signingKey, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeysRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeysRequestBuilder.java index 4af9ce96..07bb3c00 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeysRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeysRequestBuilder.java @@ -1,20 +1,28 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; + +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetSigningKeys; +import studio.livepeer.livepeer.utils.Headers; public class GetSigningKeysRequestBuilder { - private final SDKMethodInterfaces.MethodCallGetSigningKeys sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetSigningKeysRequestBuilder(SDKMethodInterfaces.MethodCallGetSigningKeys sdk) { - this.sdk = sdk; + public GetSigningKeysRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetSigningKeysResponse call() throws Exception { + public GetSigningKeysResponse call() { + + RequestlessOperation operation + = new GetSigningKeys.Sync(sdkConfiguration, _headers); - return sdk.getAllDirect(); + return operation.handleResponse(operation.doRequest()); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeysResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeysResponse.java index f47f52a0..f2744bbf 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeysResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetSigningKeysResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.SigningKey; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetSigningKeysResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetSigningKeysResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetSigningKeysResponse withData(List data) { return this; } + /** * Success */ @@ -175,6 +174,7 @@ public GetSigningKeysResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetSigningKeysResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetSigningKeysResponse other = (GetSigningKeysResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetSigningKeysResponse build() { + return new GetSigningKeysResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamRequest.java index 23da661f..72309501 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetStreamRequest { - /** * ID of the stream */ @@ -37,10 +33,11 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the stream */ @@ -49,7 +46,7 @@ public GetStreamRequest withId(String id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } GetStreamRequest other = (GetStreamRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(GetStreamRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + /** * ID of the stream */ @@ -91,11 +90,12 @@ public Builder id(String id) { this.id = id; return this; } - + public GetStreamRequest build() { + return new GetStreamRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamRequestBuilder.java index c49ac5cf..7d4b53eb 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetStream; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetStreamRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallGetStream sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetStreamRequestBuilder(SDKMethodInterfaces.MethodCallGetStream sdk) { - this.sdk = sdk; + public GetStreamRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetStreamRequestBuilder id(java.lang.String id) { + public GetStreamRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public GetStreamResponse call() throws Exception { - return sdk.get( - id); + private GetStreamRequest buildRequest() { + + GetStreamRequest request = new GetStreamRequest(id); + + return request; + } + + public GetStreamResponse call() { + + RequestOperation operation + = new GetStream.Sync(sdkConfiguration, _headers); + GetStreamRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamResponse.java index 8ef420b7..dc209c67 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Stream; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetStreamResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public GetStreamResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public GetStreamResponse withStream(Stream stream) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public GetStreamResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public GetStreamResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } GetStreamResponse other = (GetStreamResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.stream, other.stream) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.stream, other.stream) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - stream, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + stream, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "stream", stream, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional stream = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder stream(Optional stream) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetStreamResponse build() { + return new GetStreamResponse( - contentType, - statusCode, - rawResponse, - stream, - error); + contentType, statusCode, rawResponse, + stream, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsRequest.java index a8c2b5d1..5ab808f9 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -36,22 +33,24 @@ public Optional streamsonly() { return streamsonly; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public GetStreamsRequest withStreamsonly(String streamsonly) { Utils.checkNotNull(streamsonly, "streamsonly"); this.streamsonly = Optional.ofNullable(streamsonly); return this; } + public GetStreamsRequest withStreamsonly(Optional streamsonly) { Utils.checkNotNull(streamsonly, "streamsonly"); this.streamsonly = streamsonly; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -62,12 +61,12 @@ public boolean equals(java.lang.Object o) { } GetStreamsRequest other = (GetStreamsRequest) o; return - Objects.deepEquals(this.streamsonly, other.streamsonly); + Utils.enhancedDeepEquals(this.streamsonly, other.streamsonly); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( streamsonly); } @@ -76,15 +75,17 @@ public String toString() { return Utils.toString(GetStreamsRequest.class, "streamsonly", streamsonly); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private Optional streamsonly = Optional.empty(); - + + private Optional streamsonly = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder streamsonly(String streamsonly) { Utils.checkNotNull(streamsonly, "streamsonly"); this.streamsonly = Optional.ofNullable(streamsonly); @@ -96,11 +97,12 @@ public Builder streamsonly(Optional streamsonly) { this.streamsonly = streamsonly; return this; } - + public GetStreamsRequest build() { + return new GetStreamsRequest( streamsonly); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsRequestBuilder.java index 5b47ac73..c8ed6ab2 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsRequestBuilder.java @@ -1,37 +1,53 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; import java.util.Optional; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetStreams; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetStreamsRequestBuilder { private Optional streamsonly = Optional.empty(); - private final SDKMethodInterfaces.MethodCallGetStreams sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetStreamsRequestBuilder(SDKMethodInterfaces.MethodCallGetStreams sdk) { - this.sdk = sdk; + public GetStreamsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetStreamsRequestBuilder streamsonly(java.lang.String streamsonly) { + public GetStreamsRequestBuilder streamsonly(String streamsonly) { Utils.checkNotNull(streamsonly, "streamsonly"); this.streamsonly = Optional.of(streamsonly); return this; } - public GetStreamsRequestBuilder streamsonly(java.util.Optional streamsonly) { + public GetStreamsRequestBuilder streamsonly(Optional streamsonly) { Utils.checkNotNull(streamsonly, "streamsonly"); this.streamsonly = streamsonly; return this; } - public GetStreamsResponse call() throws Exception { - return sdk.getAll( - streamsonly); + private GetStreamsRequest buildRequest() { + + GetStreamsRequest request = new GetStreamsRequest(streamsonly); + + return request; + } + + public GetStreamsResponse call() { + + RequestOperation operation + = new GetStreams.Sync(sdkConfiguration, _headers); + GetStreamsRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsResponse.java index 36cd5906..b6f6bbf8 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetStreamsResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Stream; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetStreamsResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetStreamsResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetStreamsResponse withData(List data) { return this; } + /** * Success */ @@ -175,6 +174,7 @@ public GetStreamsResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetStreamsResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetStreamsResponse other = (GetStreamsResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetStreamsResponse build() { + return new GetStreamsResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetTaskRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetTaskRequest.java index 68b977c0..0baadc15 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetTaskRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetTaskRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetTaskRequest { - /** * ID of the task */ @@ -37,10 +33,11 @@ public String taskId() { return taskId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the task */ @@ -49,7 +46,7 @@ public GetTaskRequest withTaskId(String taskId) { this.taskId = taskId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } GetTaskRequest other = (GetTaskRequest) o; return - Objects.deepEquals(this.taskId, other.taskId); + Utils.enhancedDeepEquals(this.taskId, other.taskId); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( taskId); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(GetTaskRequest.class, "taskId", taskId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String taskId; - + + private String taskId; + private Builder() { // force use of static builder() method } + /** * ID of the task */ @@ -91,11 +90,12 @@ public Builder taskId(String taskId) { this.taskId = taskId; return this; } - + public GetTaskRequest build() { + return new GetTaskRequest( taskId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetTaskRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetTaskRequestBuilder.java index dc366233..c109ce7c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetTaskRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetTaskRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetTask; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetTaskRequestBuilder { private String taskId; - private final SDKMethodInterfaces.MethodCallGetTask sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetTaskRequestBuilder(SDKMethodInterfaces.MethodCallGetTask sdk) { - this.sdk = sdk; + public GetTaskRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetTaskRequestBuilder taskId(java.lang.String taskId) { + public GetTaskRequestBuilder taskId(String taskId) { Utils.checkNotNull(taskId, "taskId"); this.taskId = taskId; return this; } - public GetTaskResponse call() throws Exception { - return sdk.get( - taskId); + private GetTaskRequest buildRequest() { + + GetTaskRequest request = new GetTaskRequest(taskId); + + return request; + } + + public GetTaskResponse call() { + + RequestOperation operation + = new GetTask.Sync(sdkConfiguration, _headers); + GetTaskRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetTaskResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetTaskResponse.java index 93d05554..c1a42d5d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetTaskResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetTaskResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,7 +11,6 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.models.components.Task; import studio.livepeer.livepeer.utils.Response; @@ -21,7 +18,6 @@ public class GetTaskResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public GetTaskResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional task() { return (Optional) task; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public GetTaskResponse withTask(Task task) { return this; } + /** * Success */ @@ -146,7 +145,7 @@ public GetTaskResponse withTask(Optional task) { this.task = task; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } GetTaskResponse other = (GetTaskResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.task, other.task); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.task, other.task); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, task); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "task", task); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional task = Optional.empty(); - + + private Optional task = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -239,14 +241,13 @@ public Builder task(Optional task) { this.task = task; return this; } - + public GetTaskResponse build() { + return new GetTaskResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, task); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetTasksRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetTasksRequestBuilder.java index da2ef19a..eef36396 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetTasksRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetTasksRequestBuilder.java @@ -1,20 +1,28 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; + +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetTasks; +import studio.livepeer.livepeer.utils.Headers; public class GetTasksRequestBuilder { - private final SDKMethodInterfaces.MethodCallGetTasks sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetTasksRequestBuilder(SDKMethodInterfaces.MethodCallGetTasks sdk) { - this.sdk = sdk; + public GetTasksRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetTasksResponse call() throws Exception { + public GetTasksResponse call() { + + RequestlessOperation operation + = new GetTasks.Sync(sdkConfiguration, _headers); - return sdk.getAllDirect(); + return operation.handleResponse(operation.doRequest()); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetTasksResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetTasksResponse.java index 53c34ced..a71bf802 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetTasksResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetTasksResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Task; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetTasksResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetTasksResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetTasksResponse withData(List data) { return this; } + /** * Success */ @@ -175,6 +174,7 @@ public GetTasksResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetTasksResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetTasksResponse other = (GetTasksResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetTasksResponse build() { + return new GetTasksResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsQueryParamBreakdownBy.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsQueryParamBreakdownBy.java index f4a377f8..b12ebd31 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsQueryParamBreakdownBy.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsQueryParamBreakdownBy.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum GetUsageMetricsQueryParamBreakdownBy { CREATOR_ID("creatorId"); @@ -13,11 +14,21 @@ public enum GetUsageMetricsQueryParamBreakdownBy { @JsonValue private final String value; - private GetUsageMetricsQueryParamBreakdownBy(String value) { + GetUsageMetricsQueryParamBreakdownBy(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (GetUsageMetricsQueryParamBreakdownBy o: GetUsageMetricsQueryParamBreakdownBy.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsQueryParamTimeStep.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsQueryParamTimeStep.java index e85a72ee..ea5f8a8d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsQueryParamTimeStep.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsQueryParamTimeStep.java @@ -1,15 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * GetUsageMetricsQueryParamTimeStep - The time step to aggregate viewership metrics by + * GetUsageMetricsQueryParamTimeStep * + *

The time step to aggregate viewership metrics by */ public enum GetUsageMetricsQueryParamTimeStep { HOUR("hour"), @@ -18,11 +20,21 @@ public enum GetUsageMetricsQueryParamTimeStep { @JsonValue private final String value; - private GetUsageMetricsQueryParamTimeStep(String value) { + GetUsageMetricsQueryParamTimeStep(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (GetUsageMetricsQueryParamTimeStep o: GetUsageMetricsQueryParamTimeStep.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsRequest.java index bbcb6df7..25951813 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsRequest.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Long; @@ -12,38 +10,32 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetUsageMetricsRequest { - /** * Start millis timestamp for the query range (inclusive) - * */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=from") private Optional from; /** * End millis timestamp for the query range (exclusive) - * */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=to") private Optional to; /** * The time step to aggregate viewership metrics by - * */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=timeStep") private Optional timeStep; /** * The creator ID to filter the query results - * */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=creatorId") private Optional creatorId; @@ -51,7 +43,6 @@ public class GetUsageMetricsRequest { /** * The list of fields to break down the query results. Currently the * only supported breakdown is by `creatorId`. - * */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=breakdownBy[]") private Optional> breakdownBy; @@ -76,12 +67,12 @@ public GetUsageMetricsRequest( } public GetUsageMetricsRequest() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); } /** * Start millis timestamp for the query range (inclusive) - * */ @JsonIgnore public Optional from() { @@ -90,7 +81,6 @@ public Optional from() { /** * End millis timestamp for the query range (exclusive) - * */ @JsonIgnore public Optional to() { @@ -99,7 +89,6 @@ public Optional to() { /** * The time step to aggregate viewership metrics by - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -109,7 +98,6 @@ public Optional timeStep() { /** * The creator ID to filter the query results - * */ @JsonIgnore public Optional creatorId() { @@ -119,7 +107,6 @@ public Optional creatorId() { /** * The list of fields to break down the query results. Currently the * only supported breakdown is by `creatorId`. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -127,13 +114,13 @@ public Optional> breakdownBy() { return (Optional>) breakdownBy; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * Start millis timestamp for the query range (inclusive) - * */ public GetUsageMetricsRequest withFrom(long from) { Utils.checkNotNull(from, "from"); @@ -141,9 +128,9 @@ public GetUsageMetricsRequest withFrom(long from) { return this; } + /** * Start millis timestamp for the query range (inclusive) - * */ public GetUsageMetricsRequest withFrom(Optional from) { Utils.checkNotNull(from, "from"); @@ -153,7 +140,6 @@ public GetUsageMetricsRequest withFrom(Optional from) { /** * End millis timestamp for the query range (exclusive) - * */ public GetUsageMetricsRequest withTo(long to) { Utils.checkNotNull(to, "to"); @@ -161,9 +147,9 @@ public GetUsageMetricsRequest withTo(long to) { return this; } + /** * End millis timestamp for the query range (exclusive) - * */ public GetUsageMetricsRequest withTo(Optional to) { Utils.checkNotNull(to, "to"); @@ -173,7 +159,6 @@ public GetUsageMetricsRequest withTo(Optional to) { /** * The time step to aggregate viewership metrics by - * */ public GetUsageMetricsRequest withTimeStep(GetUsageMetricsQueryParamTimeStep timeStep) { Utils.checkNotNull(timeStep, "timeStep"); @@ -181,9 +166,9 @@ public GetUsageMetricsRequest withTimeStep(GetUsageMetricsQueryParamTimeStep tim return this; } + /** * The time step to aggregate viewership metrics by - * */ public GetUsageMetricsRequest withTimeStep(Optional timeStep) { Utils.checkNotNull(timeStep, "timeStep"); @@ -193,7 +178,6 @@ public GetUsageMetricsRequest withTimeStep(Optional creatorId) { Utils.checkNotNull(creatorId, "creatorId"); @@ -214,7 +198,6 @@ public GetUsageMetricsRequest withCreatorId(Optional creatorId) { /** * The list of fields to break down the query results. Currently the * only supported breakdown is by `creatorId`. - * */ public GetUsageMetricsRequest withBreakdownBy(List breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); @@ -222,17 +205,17 @@ public GetUsageMetricsRequest withBreakdownBy(List> breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); this.breakdownBy = breakdownBy; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -243,21 +226,18 @@ public boolean equals(java.lang.Object o) { } GetUsageMetricsRequest other = (GetUsageMetricsRequest) o; return - Objects.deepEquals(this.from, other.from) && - Objects.deepEquals(this.to, other.to) && - Objects.deepEquals(this.timeStep, other.timeStep) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.breakdownBy, other.breakdownBy); + Utils.enhancedDeepEquals(this.from, other.from) && + Utils.enhancedDeepEquals(this.to, other.to) && + Utils.enhancedDeepEquals(this.timeStep, other.timeStep) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.breakdownBy, other.breakdownBy); } @Override public int hashCode() { - return Objects.hash( - from, - to, - timeStep, - creatorId, - breakdownBy); + return Utils.enhancedHash( + from, to, timeStep, + creatorId, breakdownBy); } @Override @@ -269,26 +249,27 @@ public String toString() { "creatorId", creatorId, "breakdownBy", breakdownBy); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional from = Optional.empty(); - + private Optional to = Optional.empty(); - + private Optional timeStep = Optional.empty(); - + private Optional creatorId = Optional.empty(); - - private Optional> breakdownBy = Optional.empty(); - + + private Optional> breakdownBy = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * Start millis timestamp for the query range (inclusive) - * */ public Builder from(long from) { Utils.checkNotNull(from, "from"); @@ -298,7 +279,6 @@ public Builder from(long from) { /** * Start millis timestamp for the query range (inclusive) - * */ public Builder from(Optional from) { Utils.checkNotNull(from, "from"); @@ -306,9 +286,9 @@ public Builder from(Optional from) { return this; } + /** * End millis timestamp for the query range (exclusive) - * */ public Builder to(long to) { Utils.checkNotNull(to, "to"); @@ -318,7 +298,6 @@ public Builder to(long to) { /** * End millis timestamp for the query range (exclusive) - * */ public Builder to(Optional to) { Utils.checkNotNull(to, "to"); @@ -326,9 +305,9 @@ public Builder to(Optional to) { return this; } + /** * The time step to aggregate viewership metrics by - * */ public Builder timeStep(GetUsageMetricsQueryParamTimeStep timeStep) { Utils.checkNotNull(timeStep, "timeStep"); @@ -338,7 +317,6 @@ public Builder timeStep(GetUsageMetricsQueryParamTimeStep timeStep) { /** * The time step to aggregate viewership metrics by - * */ public Builder timeStep(Optional timeStep) { Utils.checkNotNull(timeStep, "timeStep"); @@ -346,9 +324,9 @@ public Builder timeStep(Optional ti return this; } + /** * The creator ID to filter the query results - * */ public Builder creatorId(String creatorId) { Utils.checkNotNull(creatorId, "creatorId"); @@ -358,7 +336,6 @@ public Builder creatorId(String creatorId) { /** * The creator ID to filter the query results - * */ public Builder creatorId(Optional creatorId) { Utils.checkNotNull(creatorId, "creatorId"); @@ -366,10 +343,10 @@ public Builder creatorId(Optional creatorId) { return this; } + /** * The list of fields to break down the query results. Currently the * only supported breakdown is by `creatorId`. - * */ public Builder breakdownBy(List breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); @@ -380,22 +357,19 @@ public Builder breakdownBy(List breakdownB /** * The list of fields to break down the query results. Currently the * only supported breakdown is by `creatorId`. - * */ public Builder breakdownBy(Optional> breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); this.breakdownBy = breakdownBy; return this; } - + public GetUsageMetricsRequest build() { + return new GetUsageMetricsRequest( - from, - to, - timeStep, - creatorId, - breakdownBy); + from, to, timeStep, + creatorId, breakdownBy); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsRequestBuilder.java index 70d758cc..fd83542d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsRequestBuilder.java @@ -1,29 +1,36 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetUsageMetrics; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetUsageMetricsRequestBuilder { private GetUsageMetricsRequest request; - private final SDKMethodInterfaces.MethodCallGetUsageMetrics sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetUsageMetricsRequestBuilder(SDKMethodInterfaces.MethodCallGetUsageMetrics sdk) { - this.sdk = sdk; + public GetUsageMetricsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetUsageMetricsRequestBuilder request(studio.livepeer.livepeer.models.operations.GetUsageMetricsRequest request) { + public GetUsageMetricsRequestBuilder request(GetUsageMetricsRequest request) { Utils.checkNotNull(request, "request"); this.request = request; return this; } - public GetUsageMetricsResponse call() throws Exception { + public GetUsageMetricsResponse call() { + + RequestOperation operation + = new GetUsageMetrics.Sync(sdkConfiguration, _headers); - return sdk.getUsage( - request); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsResponse.java index 4f43e8c7..9728a9f3 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetUsageMetricsResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.UsageMetric; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetUsageMetricsResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public GetUsageMetricsResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public GetUsageMetricsResponse withUsageMetric(UsageMetric usageMetric) { return this; } + /** * A Usage Metric object */ @@ -174,6 +173,7 @@ public GetUsageMetricsResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public GetUsageMetricsResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } GetUsageMetricsResponse other = (GetUsageMetricsResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.usageMetric, other.usageMetric) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.usageMetric, other.usageMetric) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - usageMetric, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + usageMetric, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "usageMetric", usageMetric, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional usageMetric = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * A Usage Metric object */ @@ -281,6 +283,7 @@ public Builder usageMetric(Optional usageMetric) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetUsageMetricsResponse build() { + return new GetUsageMetricsResponse( - contentType, - statusCode, - rawResponse, - usageMetric, - error); + contentType, statusCode, rawResponse, + usageMetric, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsRequest.java index e39bedf3..08709529 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsRequest.java @@ -1,29 +1,24 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.util.List; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class GetViewershipMetricsRequest { - /** * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=playbackId") private Optional playbackId; @@ -67,7 +62,6 @@ public class GetViewershipMetricsRequest { /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ @SpeakeasyMetadata("queryParam:style=form,explode=true,name=breakdownBy[]") private Optional> breakdownBy; @@ -101,14 +95,15 @@ public GetViewershipMetricsRequest( } public GetViewershipMetricsRequest() { - this(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()); + this(Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty(), Optional.empty(), + Optional.empty(), Optional.empty()); } /** * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ @JsonIgnore public Optional playbackId() { @@ -169,7 +164,6 @@ public Optional creatorId() { /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ @SuppressWarnings("unchecked") @JsonIgnore @@ -177,15 +171,15 @@ public Optional> breakdownBy() { return (Optional>) breakdownBy; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ public GetViewershipMetricsRequest withPlaybackId(String playbackId) { Utils.checkNotNull(playbackId, "playbackId"); @@ -193,11 +187,11 @@ public GetViewershipMetricsRequest withPlaybackId(String playbackId) { return this; } + /** * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ public GetViewershipMetricsRequest withPlaybackId(Optional playbackId) { Utils.checkNotNull(playbackId, "playbackId"); @@ -214,6 +208,7 @@ public GetViewershipMetricsRequest withFrom(From from) { return this; } + /** * Start timestamp for the query range (inclusive) */ @@ -232,6 +227,7 @@ public GetViewershipMetricsRequest withTo(To to) { return this; } + /** * End timestamp for the query range (exclusive) */ @@ -250,6 +246,7 @@ public GetViewershipMetricsRequest withTimeStep(TimeStep timeStep) { return this; } + /** * The time step to aggregate viewership metrics by */ @@ -268,6 +265,7 @@ public GetViewershipMetricsRequest withAssetId(String assetId) { return this; } + /** * The asset ID to filter metrics for */ @@ -286,6 +284,7 @@ public GetViewershipMetricsRequest withStreamId(String streamId) { return this; } + /** * The stream ID to filter metrics for */ @@ -304,6 +303,7 @@ public GetViewershipMetricsRequest withCreatorId(String creatorId) { return this; } + /** * The creator ID to filter the query results */ @@ -316,7 +316,6 @@ public GetViewershipMetricsRequest withCreatorId(Optional creatorId) { /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ public GetViewershipMetricsRequest withBreakdownBy(List breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); @@ -324,17 +323,17 @@ public GetViewershipMetricsRequest withBreakdownBy(List b return this; } + /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ public GetViewershipMetricsRequest withBreakdownBy(Optional> breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); this.breakdownBy = breakdownBy; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -345,27 +344,22 @@ public boolean equals(java.lang.Object o) { } GetViewershipMetricsRequest other = (GetViewershipMetricsRequest) o; return - Objects.deepEquals(this.playbackId, other.playbackId) && - Objects.deepEquals(this.from, other.from) && - Objects.deepEquals(this.to, other.to) && - Objects.deepEquals(this.timeStep, other.timeStep) && - Objects.deepEquals(this.assetId, other.assetId) && - Objects.deepEquals(this.streamId, other.streamId) && - Objects.deepEquals(this.creatorId, other.creatorId) && - Objects.deepEquals(this.breakdownBy, other.breakdownBy); + Utils.enhancedDeepEquals(this.playbackId, other.playbackId) && + Utils.enhancedDeepEquals(this.from, other.from) && + Utils.enhancedDeepEquals(this.to, other.to) && + Utils.enhancedDeepEquals(this.timeStep, other.timeStep) && + Utils.enhancedDeepEquals(this.assetId, other.assetId) && + Utils.enhancedDeepEquals(this.streamId, other.streamId) && + Utils.enhancedDeepEquals(this.creatorId, other.creatorId) && + Utils.enhancedDeepEquals(this.breakdownBy, other.breakdownBy); } @Override public int hashCode() { - return Objects.hash( - playbackId, - from, - to, - timeStep, - assetId, - streamId, - creatorId, - breakdownBy); + return Utils.enhancedHash( + playbackId, from, to, + timeStep, assetId, streamId, + creatorId, breakdownBy); } @Override @@ -380,34 +374,35 @@ public String toString() { "creatorId", creatorId, "breakdownBy", breakdownBy); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional playbackId = Optional.empty(); - + private Optional from = Optional.empty(); - + private Optional to = Optional.empty(); - + private Optional timeStep = Optional.empty(); - + private Optional assetId = Optional.empty(); - + private Optional streamId = Optional.empty(); - + private Optional creatorId = Optional.empty(); - - private Optional> breakdownBy = Optional.empty(); - + + private Optional> breakdownBy = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ public Builder playbackId(String playbackId) { Utils.checkNotNull(playbackId, "playbackId"); @@ -419,7 +414,6 @@ public Builder playbackId(String playbackId) { * The playback ID to filter the query results. This can be a canonical * playback ID from Livepeer assets or streams, or dStorage identifiers * for assets - * */ public Builder playbackId(Optional playbackId) { Utils.checkNotNull(playbackId, "playbackId"); @@ -427,6 +421,7 @@ public Builder playbackId(Optional playbackId) { return this; } + /** * Start timestamp for the query range (inclusive) */ @@ -445,6 +440,7 @@ public Builder from(Optional from) { return this; } + /** * End timestamp for the query range (exclusive) */ @@ -463,6 +459,7 @@ public Builder to(Optional to) { return this; } + /** * The time step to aggregate viewership metrics by */ @@ -481,6 +478,7 @@ public Builder timeStep(Optional timeStep) { return this; } + /** * The asset ID to filter metrics for */ @@ -499,6 +497,7 @@ public Builder assetId(Optional assetId) { return this; } + /** * The stream ID to filter metrics for */ @@ -517,6 +516,7 @@ public Builder streamId(Optional streamId) { return this; } + /** * The creator ID to filter the query results */ @@ -535,10 +535,10 @@ public Builder creatorId(Optional creatorId) { return this; } + /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ public Builder breakdownBy(List breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); @@ -549,25 +549,20 @@ public Builder breakdownBy(List breakdownBy) { /** * The list of fields to break down the query results. Specify this * query-string multiple times to break down by multiple fields. - * */ public Builder breakdownBy(Optional> breakdownBy) { Utils.checkNotNull(breakdownBy, "breakdownBy"); this.breakdownBy = breakdownBy; return this; } - + public GetViewershipMetricsRequest build() { + return new GetViewershipMetricsRequest( - playbackId, - from, - to, - timeStep, - assetId, - streamId, - creatorId, - breakdownBy); + playbackId, from, to, + timeStep, assetId, streamId, + creatorId, breakdownBy); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsRequestBuilder.java index c563e8e9..dfac04d4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsRequestBuilder.java @@ -1,29 +1,36 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetViewershipMetrics; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetViewershipMetricsRequestBuilder { private GetViewershipMetricsRequest request; - private final SDKMethodInterfaces.MethodCallGetViewershipMetrics sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetViewershipMetricsRequestBuilder(SDKMethodInterfaces.MethodCallGetViewershipMetrics sdk) { - this.sdk = sdk; + public GetViewershipMetricsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetViewershipMetricsRequestBuilder request(studio.livepeer.livepeer.models.operations.GetViewershipMetricsRequest request) { + public GetViewershipMetricsRequestBuilder request(GetViewershipMetricsRequest request) { Utils.checkNotNull(request, "request"); this.request = request; return this; } - public GetViewershipMetricsResponse call() throws Exception { + public GetViewershipMetricsResponse call() { + + RequestOperation operation + = new GetViewershipMetrics.Sync(sdkConfiguration, _headers); - return sdk.getViewership( - request); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsResponse.java index 095fae09..039aab49 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetViewershipMetricsResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.ViewershipMetric; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetViewershipMetricsResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetViewershipMetricsResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetViewershipMetricsResponse withData(List data) { return this; } + /** * A list of Metric objects */ @@ -175,6 +174,7 @@ public GetViewershipMetricsResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetViewershipMetricsResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetViewershipMetricsResponse other = (GetViewershipMetricsResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * A list of Metric objects */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetViewershipMetricsResponse build() { + return new GetViewershipMetricsResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogRequest.java index 68b48b2c..39c25b5f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -19,6 +16,7 @@ public class GetWebhookLogRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=logId") private String logId; @@ -42,10 +40,11 @@ public String logId() { return logId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public GetWebhookLogRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -57,7 +56,7 @@ public GetWebhookLogRequest withLogId(String logId) { this.logId = logId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -68,15 +67,14 @@ public boolean equals(java.lang.Object o) { } GetWebhookLogRequest other = (GetWebhookLogRequest) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.logId, other.logId); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.logId, other.logId); } @Override public int hashCode() { - return Objects.hash( - id, - logId); + return Utils.enhancedHash( + id, logId); } @Override @@ -85,34 +83,37 @@ public String toString() { "id", id, "logId", logId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - - private String logId; - + + private String logId; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } + public Builder logId(String logId) { Utils.checkNotNull(logId, "logId"); this.logId = logId; return this; } - + public GetWebhookLogRequest build() { + return new GetWebhookLogRequest( - id, - logId); + id, logId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogRequestBuilder.java index e6ab3cf0..39908dc9 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogRequestBuilder.java @@ -1,38 +1,54 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetWebhookLog; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetWebhookLogRequestBuilder { private String id; private String logId; - private final SDKMethodInterfaces.MethodCallGetWebhookLog sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetWebhookLogRequestBuilder(SDKMethodInterfaces.MethodCallGetWebhookLog sdk) { - this.sdk = sdk; + public GetWebhookLogRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetWebhookLogRequestBuilder id(java.lang.String id) { + public GetWebhookLogRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public GetWebhookLogRequestBuilder logId(java.lang.String logId) { + public GetWebhookLogRequestBuilder logId(String logId) { Utils.checkNotNull(logId, "logId"); this.logId = logId; return this; } - public GetWebhookLogResponse call() throws Exception { - return sdk.getLog( - id, + private GetWebhookLogRequest buildRequest() { + + GetWebhookLogRequest request = new GetWebhookLogRequest(id, logId); + + return request; + } + + public GetWebhookLogResponse call() { + + RequestOperation operation + = new GetWebhookLog.Sync(sdkConfiguration, _headers); + GetWebhookLogRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogResponse.java index 8aee8982..a09468de 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.WebhookLog; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetWebhookLogResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public GetWebhookLogResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public GetWebhookLogResponse withWebhookLog(WebhookLog webhookLog) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public GetWebhookLogResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public GetWebhookLogResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } GetWebhookLogResponse other = (GetWebhookLogResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.webhookLog, other.webhookLog) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.webhookLog, other.webhookLog) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - webhookLog, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + webhookLog, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "webhookLog", webhookLog, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional webhookLog = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder webhookLog(Optional webhookLog) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetWebhookLogResponse build() { + return new GetWebhookLogResponse( - contentType, - statusCode, - rawResponse, - webhookLog, - error); + contentType, statusCode, rawResponse, + webhookLog, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsRequest.java index d6d7e10b..17f8e9d7 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -31,16 +28,17 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public GetWebhookLogsRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -51,12 +49,12 @@ public boolean equals(java.lang.Object o) { } GetWebhookLogsRequest other = (GetWebhookLogsRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -65,25 +63,28 @@ public String toString() { return Utils.toString(GetWebhookLogsRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + public GetWebhookLogsRequest build() { + return new GetWebhookLogsRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsRequestBuilder.java index d0d90660..14bba009 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetWebhookLogs; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetWebhookLogsRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallGetWebhookLogs sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetWebhookLogsRequestBuilder(SDKMethodInterfaces.MethodCallGetWebhookLogs sdk) { - this.sdk = sdk; + public GetWebhookLogsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetWebhookLogsRequestBuilder id(java.lang.String id) { + public GetWebhookLogsRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public GetWebhookLogsResponse call() throws Exception { - return sdk.getLogs( - id); + private GetWebhookLogsRequest buildRequest() { + + GetWebhookLogsRequest request = new GetWebhookLogsRequest(id); + + return request; + } + + public GetWebhookLogsResponse call() { + + RequestOperation operation + = new GetWebhookLogs.Sync(sdkConfiguration, _headers); + GetWebhookLogsRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsResponse.java index 1c52dabf..501c0376 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookLogsResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.WebhookLog; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetWebhookLogsResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetWebhookLogsResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetWebhookLogsResponse withData(List data) { return this; } + /** * Success */ @@ -175,6 +174,7 @@ public GetWebhookLogsResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetWebhookLogsResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetWebhookLogsResponse other = (GetWebhookLogsResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetWebhookLogsResponse build() { + return new GetWebhookLogsResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookRequest.java index af354ea4..9b806aac 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -31,16 +28,17 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public GetWebhookRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -51,12 +49,12 @@ public boolean equals(java.lang.Object o) { } GetWebhookRequest other = (GetWebhookRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -65,25 +63,28 @@ public String toString() { return Utils.toString(GetWebhookRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + public GetWebhookRequest build() { + return new GetWebhookRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookRequestBuilder.java index a323d5c2..93544c69 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetWebhook; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class GetWebhookRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallGetWebhook sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetWebhookRequestBuilder(SDKMethodInterfaces.MethodCallGetWebhook sdk) { - this.sdk = sdk; + public GetWebhookRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetWebhookRequestBuilder id(java.lang.String id) { + public GetWebhookRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public GetWebhookResponse call() throws Exception { - return sdk.get( - id); + private GetWebhookRequest buildRequest() { + + GetWebhookRequest request = new GetWebhookRequest(id); + + return request; + } + + public GetWebhookResponse call() { + + RequestOperation operation + = new GetWebhook.Sync(sdkConfiguration, _headers); + GetWebhookRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookResponse.java index a98dfb5f..5d941ca1 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhookResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Webhook; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetWebhookResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public GetWebhookResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public GetWebhookResponse withWebhook(Webhook webhook) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public GetWebhookResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public GetWebhookResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } GetWebhookResponse other = (GetWebhookResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.webhook, other.webhook) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.webhook, other.webhook) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - webhook, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + webhook, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "webhook", webhook, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional webhook = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder webhook(Optional webhook) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetWebhookResponse build() { + return new GetWebhookResponse( - contentType, - statusCode, - rawResponse, - webhook, - error); + contentType, statusCode, rawResponse, + webhook, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhooksRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhooksRequestBuilder.java index 361fb452..d34e988e 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhooksRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhooksRequestBuilder.java @@ -1,20 +1,28 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; + +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetWebhooks; +import studio.livepeer.livepeer.utils.Headers; public class GetWebhooksRequestBuilder { - private final SDKMethodInterfaces.MethodCallGetWebhooks sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public GetWebhooksRequestBuilder(SDKMethodInterfaces.MethodCallGetWebhooks sdk) { - this.sdk = sdk; + public GetWebhooksRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public GetWebhooksResponse call() throws Exception { + public GetWebhooksResponse call() { + + RequestlessOperation operation + = new GetWebhooks.Sync(sdkConfiguration, _headers); - return sdk.getAllDirect(); + return operation.handleResponse(operation.doRequest()); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhooksResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhooksResponse.java index 6de1c67b..0ed5667d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhooksResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/GetWebhooksResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -14,16 +12,14 @@ import java.lang.SuppressWarnings; import java.net.http.HttpResponse; import java.util.List; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Webhook; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class GetWebhooksResponse implements Response { - /** * HTTP response content type for this operation */ @@ -72,7 +68,8 @@ public GetWebhooksResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -117,10 +114,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -157,6 +155,7 @@ public GetWebhooksResponse withData(List data) { return this; } + /** * Success */ @@ -175,6 +174,7 @@ public GetWebhooksResponse withError(Error error) { return this; } + /** * Error */ @@ -183,7 +183,7 @@ public GetWebhooksResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -194,21 +194,18 @@ public boolean equals(java.lang.Object o) { } GetWebhooksResponse other = (GetWebhooksResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -220,23 +217,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional> data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -246,6 +245,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -255,6 +255,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -264,6 +265,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -282,6 +284,7 @@ public Builder data(Optional> data) { return this; } + /** * Error */ @@ -299,15 +302,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public GetWebhooksResponse build() { + return new GetWebhooksResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamBreakdownBy.java b/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamBreakdownBy.java index 48d98e99..020d4727 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamBreakdownBy.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamBreakdownBy.java @@ -1,11 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; public enum QueryParamBreakdownBy { PLAYBACK_ID("playbackId"), @@ -26,11 +27,21 @@ public enum QueryParamBreakdownBy { @JsonValue private final String value; - private QueryParamBreakdownBy(String value) { + QueryParamBreakdownBy(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (QueryParamBreakdownBy o: QueryParamBreakdownBy.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamFrom.java b/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamFrom.java index c5a9be5f..cee3108e 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamFrom.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamFrom.java @@ -1,18 +1,16 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Long; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.time.OffsetDateTime; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; @@ -20,9 +18,10 @@ import studio.livepeer.livepeer.utils.Utils; /** - * QueryParamFrom - Start timestamp for the query range (inclusive) + * QueryParamFrom + * + *

Start timestamp for the query range (inclusive) */ - @JsonDeserialize(using = QueryParamFrom._Deserializer.class) public class QueryParamFrom { @@ -74,12 +73,12 @@ public boolean equals(java.lang.Object o) { return false; } QueryParamFrom other = (QueryParamFrom) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -87,8 +86,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -99,3 +98,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamTimeStep.java b/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamTimeStep.java index b2547408..2b96c7ac 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamTimeStep.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamTimeStep.java @@ -1,14 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * QueryParamTimeStep - The time step to aggregate viewership metrics by + * QueryParamTimeStep + * + *

The time step to aggregate viewership metrics by */ public enum QueryParamTimeStep { HOUR("hour"), @@ -20,11 +23,21 @@ public enum QueryParamTimeStep { @JsonValue private final String value; - private QueryParamTimeStep(String value) { + QueryParamTimeStep(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (QueryParamTimeStep o: QueryParamTimeStep.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamTo.java b/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamTo.java index 5d1bb187..9f9cf73f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamTo.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/QueryParamTo.java @@ -1,18 +1,16 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Long; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.time.OffsetDateTime; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; @@ -20,9 +18,10 @@ import studio.livepeer.livepeer.utils.Utils; /** - * QueryParamTo - End timestamp for the query range (exclusive) + * QueryParamTo + * + *

End timestamp for the query range (exclusive) */ - @JsonDeserialize(using = QueryParamTo._Deserializer.class) public class QueryParamTo { @@ -74,12 +73,12 @@ public boolean equals(java.lang.Object o) { return false; } QueryParamTo other = (QueryParamTo) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -87,8 +86,8 @@ public static final class _Deserializer extends OneOfDeserializer public _Deserializer() { super(QueryParamTo.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -99,3 +98,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/Record.java b/src/main/java/studio/livepeer/livepeer/models/operations/Record.java index e1020e81..0c8b38fb 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/Record.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/Record.java @@ -1,17 +1,16 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Boolean; +import java.lang.Long; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; @@ -19,11 +18,11 @@ import studio.livepeer.livepeer.utils.Utils; /** - * Record - Flag indicating if the response should only include recorded - * sessions + * Record * + *

Flag indicating if the response should only include recorded + * sessions */ - @JsonDeserialize(using = Record._Deserializer.class) public class Record { @@ -75,12 +74,12 @@ public boolean equals(java.lang.Object o) { return false; } Record other = (Record) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -88,8 +87,8 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(Record.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -100,3 +99,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetRequest.java index 12032e65..5afc91a4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class RemoveMultistreamTargetRequest { - /** * ID of the parent stream */ @@ -54,10 +50,11 @@ public String targetId() { return targetId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the parent stream */ @@ -75,7 +72,7 @@ public RemoveMultistreamTargetRequest withTargetId(String targetId) { this.targetId = targetId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -86,15 +83,14 @@ public boolean equals(java.lang.Object o) { } RemoveMultistreamTargetRequest other = (RemoveMultistreamTargetRequest) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.targetId, other.targetId); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.targetId, other.targetId); } @Override public int hashCode() { - return Objects.hash( - id, - targetId); + return Utils.enhancedHash( + id, targetId); } @Override @@ -103,17 +99,19 @@ public String toString() { "id", id, "targetId", targetId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - - private String targetId; - + + private String targetId; + private Builder() { // force use of static builder() method } + /** * ID of the parent stream */ @@ -123,6 +121,7 @@ public Builder id(String id) { return this; } + /** * ID of the multistream target */ @@ -131,12 +130,12 @@ public Builder targetId(String targetId) { this.targetId = targetId; return this; } - + public RemoveMultistreamTargetRequest build() { + return new RemoveMultistreamTargetRequest( - id, - targetId); + id, targetId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetRequestBuilder.java index 739512d1..e6257210 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetRequestBuilder.java @@ -1,38 +1,54 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.RemoveMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class RemoveMultistreamTargetRequestBuilder { private String id; private String targetId; - private final SDKMethodInterfaces.MethodCallRemoveMultistreamTarget sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public RemoveMultistreamTargetRequestBuilder(SDKMethodInterfaces.MethodCallRemoveMultistreamTarget sdk) { - this.sdk = sdk; + public RemoveMultistreamTargetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public RemoveMultistreamTargetRequestBuilder id(java.lang.String id) { + public RemoveMultistreamTargetRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public RemoveMultistreamTargetRequestBuilder targetId(java.lang.String targetId) { + public RemoveMultistreamTargetRequestBuilder targetId(String targetId) { Utils.checkNotNull(targetId, "targetId"); this.targetId = targetId; return this; } - public RemoveMultistreamTargetResponse call() throws Exception { - return sdk.removeMultistreamTarget( - id, + private RemoveMultistreamTargetRequest buildRequest() { + + RemoveMultistreamTargetRequest request = new RemoveMultistreamTargetRequest(id, targetId); + + return request; + } + + public RemoveMultistreamTargetResponse call() { + + RequestOperation operation + = new RemoveMultistreamTarget.Sync(sdkConfiguration, _headers); + RemoveMultistreamTargetRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetResponse.java index 12c7858d..b438fc2d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/RemoveMultistreamTargetResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class RemoveMultistreamTargetResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public RemoveMultistreamTargetResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public RemoveMultistreamTargetResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public RemoveMultistreamTargetResponse withError(Optional error this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } RemoveMultistreamTargetResponse other = (RemoveMultistreamTargetResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public RemoveMultistreamTargetResponse build() { + return new RemoveMultistreamTargetResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadData.java b/src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadData.java index 220e860d..211e1af4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadData.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadData.java @@ -1,40 +1,42 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.models.components.Asset; import studio.livepeer.livepeer.utils.Utils; /** - * RequestUploadData - Success + * RequestUploadData + * + *

Success */ - public class RequestUploadData { - /** - * The direct upload endpoint for which supports PUT requests. **It is recommended to use the Tus endpoint for a better upload experience.** + * The direct upload endpoint for which supports PUT requests. **It is recommended to use the Tus + * endpoint for a better upload experience.** */ @JsonProperty("url") private String url; /** - * The [Tus-compatible](https://tus.io/) endpoint for resumable uploads. **This is the recommended way to upload assets.** See the [Tus-js](https://github.com/tus/tus-js-client) client for more information. + * The [Tus-compatible](https://tus.io/) endpoint for resumable uploads. **This is the recommended way + * to upload assets.** See the [Tus-js](https://github.com/tus/tus-js-client) client for more + * information. */ @JsonProperty("tusEndpoint") private String tusEndpoint; + @JsonProperty("asset") private Asset asset; + @JsonProperty("task") private Task task; @@ -55,7 +57,8 @@ public RequestUploadData( } /** - * The direct upload endpoint for which supports PUT requests. **It is recommended to use the Tus endpoint for a better upload experience.** + * The direct upload endpoint for which supports PUT requests. **It is recommended to use the Tus + * endpoint for a better upload experience.** */ @JsonIgnore public String url() { @@ -63,7 +66,9 @@ public String url() { } /** - * The [Tus-compatible](https://tus.io/) endpoint for resumable uploads. **This is the recommended way to upload assets.** See the [Tus-js](https://github.com/tus/tus-js-client) client for more information. + * The [Tus-compatible](https://tus.io/) endpoint for resumable uploads. **This is the recommended way + * to upload assets.** See the [Tus-js](https://github.com/tus/tus-js-client) client for more + * information. */ @JsonIgnore public String tusEndpoint() { @@ -80,12 +85,14 @@ public Task task() { return task; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** - * The direct upload endpoint for which supports PUT requests. **It is recommended to use the Tus endpoint for a better upload experience.** + * The direct upload endpoint for which supports PUT requests. **It is recommended to use the Tus + * endpoint for a better upload experience.** */ public RequestUploadData withUrl(String url) { Utils.checkNotNull(url, "url"); @@ -94,7 +101,9 @@ public RequestUploadData withUrl(String url) { } /** - * The [Tus-compatible](https://tus.io/) endpoint for resumable uploads. **This is the recommended way to upload assets.** See the [Tus-js](https://github.com/tus/tus-js-client) client for more information. + * The [Tus-compatible](https://tus.io/) endpoint for resumable uploads. **This is the recommended way + * to upload assets.** See the [Tus-js](https://github.com/tus/tus-js-client) client for more + * information. */ public RequestUploadData withTusEndpoint(String tusEndpoint) { Utils.checkNotNull(tusEndpoint, "tusEndpoint"); @@ -113,7 +122,7 @@ public RequestUploadData withTask(Task task) { this.task = task; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -124,18 +133,16 @@ public boolean equals(java.lang.Object o) { } RequestUploadData other = (RequestUploadData) o; return - Objects.deepEquals(this.url, other.url) && - Objects.deepEquals(this.tusEndpoint, other.tusEndpoint) && - Objects.deepEquals(this.asset, other.asset) && - Objects.deepEquals(this.task, other.task); + Utils.enhancedDeepEquals(this.url, other.url) && + Utils.enhancedDeepEquals(this.tusEndpoint, other.tusEndpoint) && + Utils.enhancedDeepEquals(this.asset, other.asset) && + Utils.enhancedDeepEquals(this.task, other.task); } @Override public int hashCode() { - return Objects.hash( - url, - tusEndpoint, - asset, + return Utils.enhancedHash( + url, tusEndpoint, asset, task); } @@ -147,23 +154,26 @@ public String toString() { "asset", asset, "task", task); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String url; - + private String tusEndpoint; - + private Asset asset; - - private Task task; - + + private Task task; + private Builder() { // force use of static builder() method } + /** - * The direct upload endpoint for which supports PUT requests. **It is recommended to use the Tus endpoint for a better upload experience.** + * The direct upload endpoint for which supports PUT requests. **It is recommended to use the Tus + * endpoint for a better upload experience.** */ public Builder url(String url) { Utils.checkNotNull(url, "url"); @@ -171,8 +181,11 @@ public Builder url(String url) { return this; } + /** - * The [Tus-compatible](https://tus.io/) endpoint for resumable uploads. **This is the recommended way to upload assets.** See the [Tus-js](https://github.com/tus/tus-js-client) client for more information. + * The [Tus-compatible](https://tus.io/) endpoint for resumable uploads. **This is the recommended way + * to upload assets.** See the [Tus-js](https://github.com/tus/tus-js-client) client for more + * information. */ public Builder tusEndpoint(String tusEndpoint) { Utils.checkNotNull(tusEndpoint, "tusEndpoint"); @@ -180,25 +193,26 @@ public Builder tusEndpoint(String tusEndpoint) { return this; } + public Builder asset(Asset asset) { Utils.checkNotNull(asset, "asset"); this.asset = asset; return this; } + public Builder task(Task task) { Utils.checkNotNull(task, "task"); this.task = task; return this; } - + public RequestUploadData build() { + return new RequestUploadData( - url, - tusEndpoint, - asset, + url, tusEndpoint, asset, task); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadRequestBuilder.java index c1e527c2..0956657a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadRequestBuilder.java @@ -1,30 +1,37 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.NewAssetPayload; +import studio.livepeer.livepeer.operations.RequestUpload; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class RequestUploadRequestBuilder { private NewAssetPayload request; - private final SDKMethodInterfaces.MethodCallRequestUpload sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public RequestUploadRequestBuilder(SDKMethodInterfaces.MethodCallRequestUpload sdk) { - this.sdk = sdk; + public RequestUploadRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public RequestUploadRequestBuilder request(studio.livepeer.livepeer.models.components.NewAssetPayload request) { + public RequestUploadRequestBuilder request(NewAssetPayload request) { Utils.checkNotNull(request, "request"); this.request = request; return this; } - public RequestUploadResponse call() throws Exception { + public RequestUploadResponse call() { + + RequestOperation operation + = new RequestUpload.Sync(sdkConfiguration, _headers); - return sdk.create( - request); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadResponse.java index 0ec9161a..71a69fa3 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/RequestUploadResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class RequestUploadResponse implements Response { - /** * HTTP response content type for this operation */ @@ -70,7 +66,8 @@ public RequestUploadResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -115,10 +112,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -155,6 +153,7 @@ public RequestUploadResponse withData(RequestUploadData data) { return this; } + /** * Success */ @@ -173,6 +172,7 @@ public RequestUploadResponse withError(Error error) { return this; } + /** * Error */ @@ -181,7 +181,7 @@ public RequestUploadResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -192,21 +192,18 @@ public boolean equals(java.lang.Object o) { } RequestUploadResponse other = (RequestUploadResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.data, other.data) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - data, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); } @Override @@ -218,23 +215,25 @@ public String toString() { "data", data, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional data = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -244,6 +243,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -253,6 +253,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -262,6 +263,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -280,6 +282,7 @@ public Builder data(Optional data) { return this; } + /** * Error */ @@ -297,15 +300,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public RequestUploadResponse build() { + return new RequestUploadResponse( - contentType, - statusCode, - rawResponse, - data, - error); + contentType, statusCode, rawResponse, + data, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookRequest.java index 322c706b..fc6fa404 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -19,6 +16,7 @@ public class ResendWebhookRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=logId") private String logId; @@ -42,10 +40,11 @@ public String logId() { return logId; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public ResendWebhookRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -57,7 +56,7 @@ public ResendWebhookRequest withLogId(String logId) { this.logId = logId; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -68,15 +67,14 @@ public boolean equals(java.lang.Object o) { } ResendWebhookRequest other = (ResendWebhookRequest) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.logId, other.logId); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.logId, other.logId); } @Override public int hashCode() { - return Objects.hash( - id, - logId); + return Utils.enhancedHash( + id, logId); } @Override @@ -85,34 +83,37 @@ public String toString() { "id", id, "logId", logId); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - - private String logId; - + + private String logId; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } + public Builder logId(String logId) { Utils.checkNotNull(logId, "logId"); this.logId = logId; return this; } - + public ResendWebhookRequest build() { + return new ResendWebhookRequest( - id, - logId); + id, logId); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookRequestBuilder.java index d12ba511..296c2b0a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookRequestBuilder.java @@ -1,38 +1,54 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.ResendWebhook; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class ResendWebhookRequestBuilder { private String id; private String logId; - private final SDKMethodInterfaces.MethodCallResendWebhook sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public ResendWebhookRequestBuilder(SDKMethodInterfaces.MethodCallResendWebhook sdk) { - this.sdk = sdk; + public ResendWebhookRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public ResendWebhookRequestBuilder id(java.lang.String id) { + public ResendWebhookRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public ResendWebhookRequestBuilder logId(java.lang.String logId) { + public ResendWebhookRequestBuilder logId(String logId) { Utils.checkNotNull(logId, "logId"); this.logId = logId; return this; } - public ResendWebhookResponse call() throws Exception { - return sdk.resendLog( - id, + private ResendWebhookRequest buildRequest() { + + ResendWebhookRequest request = new ResendWebhookRequest(id, logId); + + return request; + } + + public ResendWebhookResponse call() { + + RequestOperation operation + = new ResendWebhook.Sync(sdkConfiguration, _headers); + ResendWebhookRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookResponse.java index 65962c50..d6f764ac 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/ResendWebhookResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.WebhookLog; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class ResendWebhookResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public ResendWebhookResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public ResendWebhookResponse withWebhookLog(WebhookLog webhookLog) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public ResendWebhookResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public ResendWebhookResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } ResendWebhookResponse other = (ResendWebhookResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.webhookLog, other.webhookLog) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.webhookLog, other.webhookLog) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - webhookLog, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + webhookLog, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "webhookLog", webhookLog, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional webhookLog = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder webhookLog(Optional webhookLog) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public ResendWebhookResponse build() { + return new ResendWebhookResponse( - contentType, - statusCode, - rawResponse, - webhookLog, - error); + contentType, statusCode, rawResponse, + webhookLog, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/SDKMethodInterfaces.java b/src/main/java/studio/livepeer/livepeer/models/operations/SDKMethodInterfaces.java deleted file mode 100644 index 0246e859..00000000 --- a/src/main/java/studio/livepeer/livepeer/models/operations/SDKMethodInterfaces.java +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -package studio.livepeer.livepeer.models.operations; - -import java.lang.String; -import java.util.List; -import java.util.Optional; -import studio.livepeer.livepeer.models.components.AssetPatchPayload; -import studio.livepeer.livepeer.models.components.ClipPayload; -import studio.livepeer.livepeer.models.components.MultistreamTargetInput; -import studio.livepeer.livepeer.models.components.MultistreamTargetPatchPayload; -import studio.livepeer.livepeer.models.components.NewAssetFromUrlPayload; -import studio.livepeer.livepeer.models.components.NewAssetPayload; -import studio.livepeer.livepeer.models.components.NewStreamPayload; -import studio.livepeer.livepeer.models.components.RoomEgressPayload; -import studio.livepeer.livepeer.models.components.RoomUserPayload; -import studio.livepeer.livepeer.models.components.RoomUserUpdatePayload; -import studio.livepeer.livepeer.models.components.StreamPatchPayload; -import studio.livepeer.livepeer.models.components.TargetAddPayload; -import studio.livepeer.livepeer.models.components.TranscodePayload; -import studio.livepeer.livepeer.models.components.WebhookInput; - -public class SDKMethodInterfaces { - - - public interface MethodCallCreateStream { - studio.livepeer.livepeer.models.operations.CreateStreamResponse create( - NewStreamPayload request) throws Exception; - } - - - public interface MethodCallGetStreams { - studio.livepeer.livepeer.models.operations.GetStreamsResponse getAll( - Optional streamsonly) throws Exception; - } - - - public interface MethodCallGetStream { - studio.livepeer.livepeer.models.operations.GetStreamResponse get( - String id) throws Exception; - } - - - public interface MethodCallUpdateStream { - studio.livepeer.livepeer.models.operations.UpdateStreamResponse update( - String id, - StreamPatchPayload streamPatchPayload) throws Exception; - } - - - public interface MethodCallDeleteStream { - studio.livepeer.livepeer.models.operations.DeleteStreamResponse delete( - String id) throws Exception; - } - - - public interface MethodCallTerminateStream { - studio.livepeer.livepeer.models.operations.TerminateStreamResponse terminate( - String id) throws Exception; - } - - - public interface MethodCallStartPullStream { - studio.livepeer.livepeer.models.operations.StartPullStreamResponse startPull( - String id) throws Exception; - } - - - public interface MethodCallCreateClip { - studio.livepeer.livepeer.models.operations.CreateClipResponse createClip( - ClipPayload request) throws Exception; - } - - - public interface MethodCallGetClips { - studio.livepeer.livepeer.models.operations.GetClipsResponse getClips( - String id) throws Exception; - } - - - public interface MethodCallAddMultistreamTarget { - studio.livepeer.livepeer.models.operations.AddMultistreamTargetResponse addMultistreamTarget( - String id, - TargetAddPayload targetAddPayload) throws Exception; - } - - - public interface MethodCallRemoveMultistreamTarget { - studio.livepeer.livepeer.models.operations.RemoveMultistreamTargetResponse removeMultistreamTarget( - String id, - String targetId) throws Exception; - } - - - public interface MethodCallGetMultistreamTargets { - studio.livepeer.livepeer.models.operations.GetMultistreamTargetsResponse getAllDirect() throws Exception; - } - - - public interface MethodCallCreateMultistreamTarget { - studio.livepeer.livepeer.models.operations.CreateMultistreamTargetResponse create( - MultistreamTargetInput request) throws Exception; - } - - - public interface MethodCallGetMultistreamTarget { - studio.livepeer.livepeer.models.operations.GetMultistreamTargetResponse get( - String id) throws Exception; - } - - - public interface MethodCallUpdateMultistreamTarget { - studio.livepeer.livepeer.models.operations.UpdateMultistreamTargetResponse update( - String id, - MultistreamTargetPatchPayload multistreamTargetPatchPayload) throws Exception; - } - - - public interface MethodCallDeleteMultistreamTarget { - studio.livepeer.livepeer.models.operations.DeleteMultistreamTargetResponse delete( - String id) throws Exception; - } - - - public interface MethodCallGetWebhooks { - studio.livepeer.livepeer.models.operations.GetWebhooksResponse getAllDirect() throws Exception; - } - - - public interface MethodCallCreateWebhook { - studio.livepeer.livepeer.models.operations.CreateWebhookResponse create( - WebhookInput request) throws Exception; - } - - - public interface MethodCallGetWebhook { - studio.livepeer.livepeer.models.operations.GetWebhookResponse get( - String id) throws Exception; - } - - - public interface MethodCallUpdateWebhook { - studio.livepeer.livepeer.models.operations.UpdateWebhookResponse update( - String id, - WebhookInput webhook) throws Exception; - } - - - public interface MethodCallDeleteWebhook { - studio.livepeer.livepeer.models.operations.DeleteWebhookResponse delete( - String id) throws Exception; - } - - - public interface MethodCallGetWebhookLogs { - studio.livepeer.livepeer.models.operations.GetWebhookLogsResponse getLogs( - String id) throws Exception; - } - - - public interface MethodCallGetWebhookLog { - studio.livepeer.livepeer.models.operations.GetWebhookLogResponse getLog( - String id, - String logId) throws Exception; - } - - - public interface MethodCallResendWebhook { - studio.livepeer.livepeer.models.operations.ResendWebhookResponse resendLog( - String id, - String logId) throws Exception; - } - - - public interface MethodCallGetAssets { - studio.livepeer.livepeer.models.operations.GetAssetsResponse getAllDirect() throws Exception; - } - - - public interface MethodCallRequestUpload { - studio.livepeer.livepeer.models.operations.RequestUploadResponse create( - NewAssetPayload request) throws Exception; - } - - - public interface MethodCallUploadAsset { - studio.livepeer.livepeer.models.operations.UploadAssetResponse createViaUrl( - NewAssetFromUrlPayload request) throws Exception; - } - - - public interface MethodCallGetAsset { - studio.livepeer.livepeer.models.operations.GetAssetResponse get( - String assetId) throws Exception; - } - - - public interface MethodCallUpdateAsset { - studio.livepeer.livepeer.models.operations.UpdateAssetResponse update( - String assetId, - AssetPatchPayload assetPatchPayload) throws Exception; - } - - - public interface MethodCallDeleteAsset { - studio.livepeer.livepeer.models.operations.DeleteAssetResponse delete( - String assetId) throws Exception; - } - - - public interface MethodCallGetSessionClips { - studio.livepeer.livepeer.models.operations.GetSessionClipsResponse getClips( - String id) throws Exception; - } - - - public interface MethodCallGetSessions { - studio.livepeer.livepeer.models.operations.GetSessionsResponse getAllDirect() throws Exception; - } - - - public interface MethodCallGetSession { - studio.livepeer.livepeer.models.operations.GetSessionResponse get( - String id) throws Exception; - } - - - public interface MethodCallGetRecordedSessions { - studio.livepeer.livepeer.models.operations.GetRecordedSessionsResponse getRecorded( - String parentId, - Optional record) throws Exception; - } - - - public interface MethodCallCreateRoom { - studio.livepeer.livepeer.models.operations.CreateRoomResponse createDirect() throws Exception; - } - - - public interface MethodCallGetRoom { - studio.livepeer.livepeer.models.operations.GetRoomResponse get( - String id) throws Exception; - } - - - public interface MethodCallDeleteRoom { - studio.livepeer.livepeer.models.operations.DeleteRoomResponse delete( - String id) throws Exception; - } - - - public interface MethodCallStartRoomEgress { - studio.livepeer.livepeer.models.operations.StartRoomEgressResponse startEgress( - String id, - RoomEgressPayload roomEgressPayload) throws Exception; - } - - - public interface MethodCallStopRoomEgress { - studio.livepeer.livepeer.models.operations.StopRoomEgressResponse stopEgress( - String id) throws Exception; - } - - - public interface MethodCallCreateRoomUser { - studio.livepeer.livepeer.models.operations.CreateRoomUserResponse createUser( - String id, - RoomUserPayload roomUserPayload) throws Exception; - } - - - public interface MethodCallGetRoomUser { - studio.livepeer.livepeer.models.operations.GetRoomUserResponse getUser( - String id, - String userId) throws Exception; - } - - - public interface MethodCallUpdateRoomUser { - studio.livepeer.livepeer.models.operations.UpdateRoomUserResponse updateUser( - String id, - String userId, - RoomUserUpdatePayload roomUserUpdatePayload) throws Exception; - } - - - public interface MethodCallDeleteRoomUser { - studio.livepeer.livepeer.models.operations.DeleteRoomUserResponse deleteUser( - String id, - String userId) throws Exception; - } - - - public interface MethodCallGetRealtimeViewershipNow { - studio.livepeer.livepeer.models.operations.GetRealtimeViewershipNowResponse getRealtimeViewership( - Optional playbackId, - Optional creatorId, - Optional> breakdownBy) throws Exception; - } - - - public interface MethodCallGetViewershipMetrics { - studio.livepeer.livepeer.models.operations.GetViewershipMetricsResponse getViewership( - GetViewershipMetricsRequest request) throws Exception; - } - - - public interface MethodCallGetCreatorViewershipMetrics { - studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsResponse getCreatorViewership( - GetCreatorViewershipMetricsRequest request) throws Exception; - } - - - public interface MethodCallGetPublicViewershipMetrics { - studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsResponse getPublicViewership( - String playbackId) throws Exception; - } - - - public interface MethodCallGetUsageMetrics { - studio.livepeer.livepeer.models.operations.GetUsageMetricsResponse getUsage( - GetUsageMetricsRequest request) throws Exception; - } - - - public interface MethodCallCreateSigningKey { - studio.livepeer.livepeer.models.operations.CreateSigningKeyResponse createDirect() throws Exception; - } - - - public interface MethodCallGetSigningKeys { - studio.livepeer.livepeer.models.operations.GetSigningKeysResponse getAllDirect() throws Exception; - } - - - public interface MethodCallDeleteSigningKey { - studio.livepeer.livepeer.models.operations.DeleteSigningKeyResponse delete( - String keyId) throws Exception; - } - - - public interface MethodCallGetSigningKey { - studio.livepeer.livepeer.models.operations.GetSigningKeyResponse get( - String keyId) throws Exception; - } - - - public interface MethodCallUpdateSigningKey { - studio.livepeer.livepeer.models.operations.UpdateSigningKeyResponse update( - String keyId, - UpdateSigningKeyRequestBody requestBody) throws Exception; - } - - - public interface MethodCallGetTasks { - studio.livepeer.livepeer.models.operations.GetTasksResponse getAllDirect() throws Exception; - } - - - public interface MethodCallGetTask { - studio.livepeer.livepeer.models.operations.GetTaskResponse get( - String taskId) throws Exception; - } - - - public interface MethodCallTranscodeVideo { - studio.livepeer.livepeer.models.operations.TranscodeVideoResponse create( - TranscodePayload request) throws Exception; - } - - - public interface MethodCallGetPlaybackInfo { - studio.livepeer.livepeer.models.operations.GetPlaybackInfoResponse get( - String id) throws Exception; - } - - -} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamRequest.java index f1b41f75..87d9db23 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class StartPullStreamRequest { - /** * ID of the stream */ @@ -37,10 +33,11 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the stream */ @@ -49,7 +46,7 @@ public StartPullStreamRequest withId(String id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } StartPullStreamRequest other = (StartPullStreamRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(StartPullStreamRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + /** * ID of the stream */ @@ -91,11 +90,12 @@ public Builder id(String id) { this.id = id; return this; } - + public StartPullStreamRequest build() { + return new StartPullStreamRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamRequestBuilder.java index 736a7bd8..ce48692c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.StartPullStream; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class StartPullStreamRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallStartPullStream sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public StartPullStreamRequestBuilder(SDKMethodInterfaces.MethodCallStartPullStream sdk) { - this.sdk = sdk; + public StartPullStreamRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public StartPullStreamRequestBuilder id(java.lang.String id) { + public StartPullStreamRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public StartPullStreamResponse call() throws Exception { - return sdk.startPull( - id); + private StartPullStreamRequest buildRequest() { + + StartPullStreamRequest request = new StartPullStreamRequest(id); + + return request; + } + + public StartPullStreamResponse call() { + + RequestOperation operation + = new StartPullStream.Sync(sdkConfiguration, _headers); + StartPullStreamRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamResponse.java index 37c1f7a8..af3c5a66 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/StartPullStreamResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class StartPullStreamResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public StartPullStreamResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public StartPullStreamResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public StartPullStreamResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } StartPullStreamResponse other = (StartPullStreamResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public StartPullStreamResponse build() { + return new StartPullStreamResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressRequest.java index 70f9f5d3..53d75fe0 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.models.components.RoomEgressPayload; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -20,6 +17,7 @@ public class StartRoomEgressRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; + @SpeakeasyMetadata("request:mediaType=application/json") private RoomEgressPayload roomEgressPayload; @@ -43,10 +41,11 @@ public RoomEgressPayload roomEgressPayload() { return roomEgressPayload; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public StartRoomEgressRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -58,7 +57,7 @@ public StartRoomEgressRequest withRoomEgressPayload(RoomEgressPayload roomEgress this.roomEgressPayload = roomEgressPayload; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -69,15 +68,14 @@ public boolean equals(java.lang.Object o) { } StartRoomEgressRequest other = (StartRoomEgressRequest) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.roomEgressPayload, other.roomEgressPayload); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.roomEgressPayload, other.roomEgressPayload); } @Override public int hashCode() { - return Objects.hash( - id, - roomEgressPayload); + return Utils.enhancedHash( + id, roomEgressPayload); } @Override @@ -86,34 +84,37 @@ public String toString() { "id", id, "roomEgressPayload", roomEgressPayload); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - - private RoomEgressPayload roomEgressPayload; - + + private RoomEgressPayload roomEgressPayload; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } + public Builder roomEgressPayload(RoomEgressPayload roomEgressPayload) { Utils.checkNotNull(roomEgressPayload, "roomEgressPayload"); this.roomEgressPayload = roomEgressPayload; return this; } - + public StartRoomEgressRequest build() { + return new StartRoomEgressRequest( - id, - roomEgressPayload); + id, roomEgressPayload); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressRequestBuilder.java index ee8e6329..4c41878f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressRequestBuilder.java @@ -1,39 +1,55 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.RoomEgressPayload; +import studio.livepeer.livepeer.operations.StartRoomEgress; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class StartRoomEgressRequestBuilder { private String id; private RoomEgressPayload roomEgressPayload; - private final SDKMethodInterfaces.MethodCallStartRoomEgress sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public StartRoomEgressRequestBuilder(SDKMethodInterfaces.MethodCallStartRoomEgress sdk) { - this.sdk = sdk; + public StartRoomEgressRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public StartRoomEgressRequestBuilder id(java.lang.String id) { + public StartRoomEgressRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public StartRoomEgressRequestBuilder roomEgressPayload(studio.livepeer.livepeer.models.components.RoomEgressPayload roomEgressPayload) { + public StartRoomEgressRequestBuilder roomEgressPayload(RoomEgressPayload roomEgressPayload) { Utils.checkNotNull(roomEgressPayload, "roomEgressPayload"); this.roomEgressPayload = roomEgressPayload; return this; } - public StartRoomEgressResponse call() throws Exception { - return sdk.startEgress( - id, + private StartRoomEgressRequest buildRequest() { + + StartRoomEgressRequest request = new StartRoomEgressRequest(id, roomEgressPayload); + + return request; + } + + public StartRoomEgressResponse call() { + + RequestOperation operation + = new StartRoomEgress.Sync(sdkConfiguration, _headers); + StartRoomEgressRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressResponse.java index 248f0ea1..f8c76ed6 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/StartRoomEgressResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class StartRoomEgressResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public StartRoomEgressResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public StartRoomEgressResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public StartRoomEgressResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } StartRoomEgressResponse other = (StartRoomEgressResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public StartRoomEgressResponse build() { + return new StartRoomEgressResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressRequest.java index ac7c2f1d..c093f217 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -31,16 +28,17 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public StopRoomEgressRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -51,12 +49,12 @@ public boolean equals(java.lang.Object o) { } StopRoomEgressRequest other = (StopRoomEgressRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -65,25 +63,28 @@ public String toString() { return Utils.toString(StopRoomEgressRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + public StopRoomEgressRequest build() { + return new StopRoomEgressRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressRequestBuilder.java index 53f69e6d..34a30e3d 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.StopRoomEgress; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class StopRoomEgressRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallStopRoomEgress sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public StopRoomEgressRequestBuilder(SDKMethodInterfaces.MethodCallStopRoomEgress sdk) { - this.sdk = sdk; + public StopRoomEgressRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public StopRoomEgressRequestBuilder id(java.lang.String id) { + public StopRoomEgressRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public StopRoomEgressResponse call() throws Exception { - return sdk.stopEgress( - id); + private StopRoomEgressRequest buildRequest() { + + StopRoomEgressRequest request = new StopRoomEgressRequest(id); + + return request; + } + + public StopRoomEgressResponse call() { + + RequestOperation operation + = new StopRoomEgress.Sync(sdkConfiguration, _headers); + StopRoomEgressRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressResponse.java index e3036d24..06a0259c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/StopRoomEgressResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class StopRoomEgressResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public StopRoomEgressResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public StopRoomEgressResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public StopRoomEgressResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } StopRoomEgressResponse other = (StopRoomEgressResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public StopRoomEgressResponse build() { + return new StopRoomEgressResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/Task.java b/src/main/java/studio/livepeer/livepeer/models/operations/Task.java index c89f6173..4fb1056a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/Task.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/Task.java @@ -1,16 +1,13 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; @@ -31,16 +28,17 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public Task withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -51,12 +49,12 @@ public boolean equals(java.lang.Object o) { } Task other = (Task) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -65,25 +63,28 @@ public String toString() { return Utils.toString(Task.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + public Task build() { + return new Task( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamRequest.java index e843cb94..9da70987 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamRequest.java @@ -1,21 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class TerminateStreamRequest { - /** * ID of the stream */ @@ -37,10 +33,11 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the stream */ @@ -49,7 +46,7 @@ public TerminateStreamRequest withId(String id) { this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -60,12 +57,12 @@ public boolean equals(java.lang.Object o) { } TerminateStreamRequest other = (TerminateStreamRequest) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -74,15 +71,17 @@ public String toString() { return Utils.toString(TerminateStreamRequest.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + /** * ID of the stream */ @@ -91,11 +90,12 @@ public Builder id(String id) { this.id = id; return this; } - + public TerminateStreamRequest build() { + return new TerminateStreamRequest( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamRequestBuilder.java index 78e27258..72a6feb8 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamRequestBuilder.java @@ -1,30 +1,46 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.TerminateStream; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class TerminateStreamRequestBuilder { private String id; - private final SDKMethodInterfaces.MethodCallTerminateStream sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public TerminateStreamRequestBuilder(SDKMethodInterfaces.MethodCallTerminateStream sdk) { - this.sdk = sdk; + public TerminateStreamRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public TerminateStreamRequestBuilder id(java.lang.String id) { + public TerminateStreamRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public TerminateStreamResponse call() throws Exception { - return sdk.terminate( - id); + private TerminateStreamRequest buildRequest() { + + TerminateStreamRequest request = new TerminateStreamRequest(id); + + return request; + } + + public TerminateStreamResponse call() { + + RequestOperation operation + = new TerminateStream.Sync(sdkConfiguration, _headers); + TerminateStreamRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamResponse.java index 286cddcc..592a293e 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/TerminateStreamResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class TerminateStreamResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public TerminateStreamResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public TerminateStreamResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public TerminateStreamResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } TerminateStreamResponse other = (TerminateStreamResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public TerminateStreamResponse build() { + return new TerminateStreamResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/TimeStep.java b/src/main/java/studio/livepeer/livepeer/models/operations/TimeStep.java index d762743e..53e13839 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/TimeStep.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/TimeStep.java @@ -1,14 +1,17 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; import com.fasterxml.jackson.annotation.JsonValue; import java.lang.String; +import java.util.Objects; +import java.util.Optional; /** - * TimeStep - The time step to aggregate viewership metrics by + * TimeStep + * + *

The time step to aggregate viewership metrics by */ public enum TimeStep { HOUR("hour"), @@ -20,11 +23,21 @@ public enum TimeStep { @JsonValue private final String value; - private TimeStep(String value) { + TimeStep(String value) { this.value = value; } public String value() { return value; } + + public static Optional fromValue(String value) { + for (TimeStep o: TimeStep.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/To.java b/src/main/java/studio/livepeer/livepeer/models/operations/To.java index 7a25a676..fddc9e7a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/To.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/To.java @@ -1,18 +1,16 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonValue; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.lang.Long; import java.lang.Override; import java.lang.String; import java.lang.SuppressWarnings; import java.time.OffsetDateTime; -import java.util.Objects; import studio.livepeer.livepeer.utils.OneOfDeserializer; import studio.livepeer.livepeer.utils.TypedObject; import studio.livepeer.livepeer.utils.Utils.JsonShape; @@ -20,9 +18,10 @@ import studio.livepeer.livepeer.utils.Utils; /** - * To - End timestamp for the query range (exclusive) + * To + * + *

End timestamp for the query range (exclusive) */ - @JsonDeserialize(using = To._Deserializer.class) public class To { @@ -74,12 +73,12 @@ public boolean equals(java.lang.Object o) { return false; } To other = (To) o; - return Objects.deepEquals(this.value.value(), other.value.value()); + return Utils.enhancedDeepEquals(this.value.value(), other.value.value()); } @Override public int hashCode() { - return Objects.hash(value.value()); + return Utils.enhancedHash(value.value()); } @SuppressWarnings("serial") @@ -87,8 +86,8 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(To.class, false, - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } @@ -99,3 +98,4 @@ public String toString() { } } + diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/TranscodeVideoRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/TranscodeVideoRequestBuilder.java index c350c687..5160c3cc 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/TranscodeVideoRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/TranscodeVideoRequestBuilder.java @@ -1,30 +1,37 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.TranscodePayload; +import studio.livepeer.livepeer.operations.TranscodeVideo; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class TranscodeVideoRequestBuilder { private TranscodePayload request; - private final SDKMethodInterfaces.MethodCallTranscodeVideo sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public TranscodeVideoRequestBuilder(SDKMethodInterfaces.MethodCallTranscodeVideo sdk) { - this.sdk = sdk; + public TranscodeVideoRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public TranscodeVideoRequestBuilder request(studio.livepeer.livepeer.models.components.TranscodePayload request) { + public TranscodeVideoRequestBuilder request(TranscodePayload request) { Utils.checkNotNull(request, "request"); this.request = request; return this; } - public TranscodeVideoResponse call() throws Exception { + public TranscodeVideoResponse call() { + + RequestOperation operation + = new TranscodeVideo.Sync(sdkConfiguration, _headers); - return sdk.create( - request); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/TranscodeVideoResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/TranscodeVideoResponse.java index cf5c29f8..fee0a6d3 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/TranscodeVideoResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/TranscodeVideoResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Task; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class TranscodeVideoResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public TranscodeVideoResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public TranscodeVideoResponse withTask(Task task) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public TranscodeVideoResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public TranscodeVideoResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } TranscodeVideoResponse other = (TranscodeVideoResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.task, other.task) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.task, other.task) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - task, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + task, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "task", task, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional task = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder task(Optional task) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public TranscodeVideoResponse build() { + return new TranscodeVideoResponse( - contentType, - statusCode, - rawResponse, - task, - error); + contentType, statusCode, rawResponse, + task, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetRequest.java index 317bfb2b..6d3756e1 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetRequest.java @@ -1,28 +1,25 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.models.components.AssetPatchPayload; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class UpdateAssetRequest { - /** * ID of the asset */ @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=assetId") private String assetId; + @SpeakeasyMetadata("request:mediaType=application/json") private AssetPatchPayload assetPatchPayload; @@ -49,10 +46,11 @@ public AssetPatchPayload assetPatchPayload() { return assetPatchPayload; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the asset */ @@ -67,7 +65,7 @@ public UpdateAssetRequest withAssetPatchPayload(AssetPatchPayload assetPatchPayl this.assetPatchPayload = assetPatchPayload; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -78,15 +76,14 @@ public boolean equals(java.lang.Object o) { } UpdateAssetRequest other = (UpdateAssetRequest) o; return - Objects.deepEquals(this.assetId, other.assetId) && - Objects.deepEquals(this.assetPatchPayload, other.assetPatchPayload); + Utils.enhancedDeepEquals(this.assetId, other.assetId) && + Utils.enhancedDeepEquals(this.assetPatchPayload, other.assetPatchPayload); } @Override public int hashCode() { - return Objects.hash( - assetId, - assetPatchPayload); + return Utils.enhancedHash( + assetId, assetPatchPayload); } @Override @@ -95,17 +92,19 @@ public String toString() { "assetId", assetId, "assetPatchPayload", assetPatchPayload); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String assetId; - - private AssetPatchPayload assetPatchPayload; - + + private AssetPatchPayload assetPatchPayload; + private Builder() { // force use of static builder() method } + /** * ID of the asset */ @@ -115,17 +114,18 @@ public Builder assetId(String assetId) { return this; } + public Builder assetPatchPayload(AssetPatchPayload assetPatchPayload) { Utils.checkNotNull(assetPatchPayload, "assetPatchPayload"); this.assetPatchPayload = assetPatchPayload; return this; } - + public UpdateAssetRequest build() { + return new UpdateAssetRequest( - assetId, - assetPatchPayload); + assetId, assetPatchPayload); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetRequestBuilder.java index d1a1997f..51b2c9a4 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetRequestBuilder.java @@ -1,39 +1,55 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.AssetPatchPayload; +import studio.livepeer.livepeer.operations.UpdateAsset; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class UpdateAssetRequestBuilder { private String assetId; private AssetPatchPayload assetPatchPayload; - private final SDKMethodInterfaces.MethodCallUpdateAsset sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public UpdateAssetRequestBuilder(SDKMethodInterfaces.MethodCallUpdateAsset sdk) { - this.sdk = sdk; + public UpdateAssetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public UpdateAssetRequestBuilder assetId(java.lang.String assetId) { + public UpdateAssetRequestBuilder assetId(String assetId) { Utils.checkNotNull(assetId, "assetId"); this.assetId = assetId; return this; } - public UpdateAssetRequestBuilder assetPatchPayload(studio.livepeer.livepeer.models.components.AssetPatchPayload assetPatchPayload) { + public UpdateAssetRequestBuilder assetPatchPayload(AssetPatchPayload assetPatchPayload) { Utils.checkNotNull(assetPatchPayload, "assetPatchPayload"); this.assetPatchPayload = assetPatchPayload; return this; } - public UpdateAssetResponse call() throws Exception { - return sdk.update( - assetId, + private UpdateAssetRequest buildRequest() { + + UpdateAssetRequest request = new UpdateAssetRequest(assetId, assetPatchPayload); + + return request; + } + + public UpdateAssetResponse call() { + + RequestOperation operation + = new UpdateAsset.Sync(sdkConfiguration, _headers); + UpdateAssetRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetResponse.java index fae20626..84f78e93 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateAssetResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.models.components.Asset; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class UpdateAssetResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public UpdateAssetResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public UpdateAssetResponse withAsset(Asset asset) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public UpdateAssetResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public UpdateAssetResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } UpdateAssetResponse other = (UpdateAssetResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.asset, other.asset) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.asset, other.asset) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - asset, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + asset, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "asset", asset, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional asset = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder asset(Optional asset) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public UpdateAssetResponse build() { + return new UpdateAssetResponse( - contentType, - statusCode, - rawResponse, - asset, - error); + contentType, statusCode, rawResponse, + asset, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetRequest.java index ef14cde1..fd3dc496 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetRequest.java @@ -1,39 +1,36 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; -import studio.livepeer.livepeer.models.components.MultistreamTargetPatchPayload; +import studio.livepeer.livepeer.models.components.MultistreamTargetInput; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class UpdateMultistreamTargetRequest { - /** * ID of the multistream target */ @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; + @SpeakeasyMetadata("request:mediaType=application/json") - private MultistreamTargetPatchPayload multistreamTargetPatchPayload; + private MultistreamTargetInput multistreamTarget; @JsonCreator public UpdateMultistreamTargetRequest( String id, - MultistreamTargetPatchPayload multistreamTargetPatchPayload) { + MultistreamTargetInput multistreamTarget) { Utils.checkNotNull(id, "id"); - Utils.checkNotNull(multistreamTargetPatchPayload, "multistreamTargetPatchPayload"); + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); this.id = id; - this.multistreamTargetPatchPayload = multistreamTargetPatchPayload; + this.multistreamTarget = multistreamTarget; } /** @@ -45,14 +42,15 @@ public String id() { } @JsonIgnore - public MultistreamTargetPatchPayload multistreamTargetPatchPayload() { - return multistreamTargetPatchPayload; + public MultistreamTargetInput multistreamTarget() { + return multistreamTarget; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the multistream target */ @@ -62,12 +60,12 @@ public UpdateMultistreamTargetRequest withId(String id) { return this; } - public UpdateMultistreamTargetRequest withMultistreamTargetPatchPayload(MultistreamTargetPatchPayload multistreamTargetPatchPayload) { - Utils.checkNotNull(multistreamTargetPatchPayload, "multistreamTargetPatchPayload"); - this.multistreamTargetPatchPayload = multistreamTargetPatchPayload; + public UpdateMultistreamTargetRequest withMultistreamTarget(MultistreamTargetInput multistreamTarget) { + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + this.multistreamTarget = multistreamTarget; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -78,34 +76,35 @@ public boolean equals(java.lang.Object o) { } UpdateMultistreamTargetRequest other = (UpdateMultistreamTargetRequest) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.multistreamTargetPatchPayload, other.multistreamTargetPatchPayload); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.multistreamTarget, other.multistreamTarget); } @Override public int hashCode() { - return Objects.hash( - id, - multistreamTargetPatchPayload); + return Utils.enhancedHash( + id, multistreamTarget); } @Override public String toString() { return Utils.toString(UpdateMultistreamTargetRequest.class, "id", id, - "multistreamTargetPatchPayload", multistreamTargetPatchPayload); + "multistreamTarget", multistreamTarget); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - - private MultistreamTargetPatchPayload multistreamTargetPatchPayload; - + + private MultistreamTargetInput multistreamTarget; + private Builder() { // force use of static builder() method } + /** * ID of the multistream target */ @@ -115,17 +114,18 @@ public Builder id(String id) { return this; } - public Builder multistreamTargetPatchPayload(MultistreamTargetPatchPayload multistreamTargetPatchPayload) { - Utils.checkNotNull(multistreamTargetPatchPayload, "multistreamTargetPatchPayload"); - this.multistreamTargetPatchPayload = multistreamTargetPatchPayload; + + public Builder multistreamTarget(MultistreamTargetInput multistreamTarget) { + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + this.multistreamTarget = multistreamTarget; return this; } - + public UpdateMultistreamTargetRequest build() { + return new UpdateMultistreamTargetRequest( - id, - multistreamTargetPatchPayload); + id, multistreamTarget); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetRequestBuilder.java index 7f734f05..40fd6176 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetRequestBuilder.java @@ -1,39 +1,55 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; -import studio.livepeer.livepeer.models.components.MultistreamTargetPatchPayload; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.MultistreamTargetInput; +import studio.livepeer.livepeer.operations.UpdateMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class UpdateMultistreamTargetRequestBuilder { private String id; - private MultistreamTargetPatchPayload multistreamTargetPatchPayload; - private final SDKMethodInterfaces.MethodCallUpdateMultistreamTarget sdk; + private MultistreamTargetInput multistreamTarget; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public UpdateMultistreamTargetRequestBuilder(SDKMethodInterfaces.MethodCallUpdateMultistreamTarget sdk) { - this.sdk = sdk; + public UpdateMultistreamTargetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public UpdateMultistreamTargetRequestBuilder id(java.lang.String id) { + public UpdateMultistreamTargetRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public UpdateMultistreamTargetRequestBuilder multistreamTargetPatchPayload(studio.livepeer.livepeer.models.components.MultistreamTargetPatchPayload multistreamTargetPatchPayload) { - Utils.checkNotNull(multistreamTargetPatchPayload, "multistreamTargetPatchPayload"); - this.multistreamTargetPatchPayload = multistreamTargetPatchPayload; + public UpdateMultistreamTargetRequestBuilder multistreamTarget(MultistreamTargetInput multistreamTarget) { + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + this.multistreamTarget = multistreamTarget; return this; } - public UpdateMultistreamTargetResponse call() throws Exception { - return sdk.update( - id, - multistreamTargetPatchPayload); + private UpdateMultistreamTargetRequest buildRequest() { + + UpdateMultistreamTargetRequest request = new UpdateMultistreamTargetRequest(id, + multistreamTarget); + + return request; + } + + public UpdateMultistreamTargetResponse call() { + + RequestOperation operation + = new UpdateMultistreamTarget.Sync(sdkConfiguration, _headers); + UpdateMultistreamTargetRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetResponse.java index 583616d8..1377279b 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateMultistreamTargetResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class UpdateMultistreamTargetResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public UpdateMultistreamTargetResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public UpdateMultistreamTargetResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public UpdateMultistreamTargetResponse withError(Optional error this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } UpdateMultistreamTargetResponse other = (UpdateMultistreamTargetResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public UpdateMultistreamTargetResponse build() { + return new UpdateMultistreamTargetResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserRequest.java index 79ab6f0a..9b34fce2 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.models.components.RoomUserUpdatePayload; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -20,9 +17,11 @@ public class UpdateRoomUserRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=userId") private String userId; + @SpeakeasyMetadata("request:mediaType=application/json") private RoomUserUpdatePayload roomUserUpdatePayload; @@ -54,10 +53,11 @@ public RoomUserUpdatePayload roomUserUpdatePayload() { return roomUserUpdatePayload; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public UpdateRoomUserRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -75,7 +75,7 @@ public UpdateRoomUserRequest withRoomUserUpdatePayload(RoomUserUpdatePayload roo this.roomUserUpdatePayload = roomUserUpdatePayload; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -86,17 +86,15 @@ public boolean equals(java.lang.Object o) { } UpdateRoomUserRequest other = (UpdateRoomUserRequest) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.userId, other.userId) && - Objects.deepEquals(this.roomUserUpdatePayload, other.roomUserUpdatePayload); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.userId, other.userId) && + Utils.enhancedDeepEquals(this.roomUserUpdatePayload, other.roomUserUpdatePayload); } @Override public int hashCode() { - return Objects.hash( - id, - userId, - roomUserUpdatePayload); + return Utils.enhancedHash( + id, userId, roomUserUpdatePayload); } @Override @@ -106,43 +104,46 @@ public String toString() { "userId", userId, "roomUserUpdatePayload", roomUserUpdatePayload); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - + private String userId; - - private RoomUserUpdatePayload roomUserUpdatePayload; - + + private RoomUserUpdatePayload roomUserUpdatePayload; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } + public Builder userId(String userId) { Utils.checkNotNull(userId, "userId"); this.userId = userId; return this; } + public Builder roomUserUpdatePayload(RoomUserUpdatePayload roomUserUpdatePayload) { Utils.checkNotNull(roomUserUpdatePayload, "roomUserUpdatePayload"); this.roomUserUpdatePayload = roomUserUpdatePayload; return this; } - + public UpdateRoomUserRequest build() { + return new UpdateRoomUserRequest( - id, - userId, - roomUserUpdatePayload); + id, userId, roomUserUpdatePayload); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserRequestBuilder.java index 8775e3e0..11090fb6 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserRequestBuilder.java @@ -1,11 +1,15 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.RoomUserUpdatePayload; +import studio.livepeer.livepeer.operations.UpdateRoomUser; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class UpdateRoomUserRequestBuilder { @@ -13,35 +17,47 @@ public class UpdateRoomUserRequestBuilder { private String id; private String userId; private RoomUserUpdatePayload roomUserUpdatePayload; - private final SDKMethodInterfaces.MethodCallUpdateRoomUser sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public UpdateRoomUserRequestBuilder(SDKMethodInterfaces.MethodCallUpdateRoomUser sdk) { - this.sdk = sdk; + public UpdateRoomUserRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public UpdateRoomUserRequestBuilder id(java.lang.String id) { + public UpdateRoomUserRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public UpdateRoomUserRequestBuilder userId(java.lang.String userId) { + public UpdateRoomUserRequestBuilder userId(String userId) { Utils.checkNotNull(userId, "userId"); this.userId = userId; return this; } - public UpdateRoomUserRequestBuilder roomUserUpdatePayload(studio.livepeer.livepeer.models.components.RoomUserUpdatePayload roomUserUpdatePayload) { + public UpdateRoomUserRequestBuilder roomUserUpdatePayload(RoomUserUpdatePayload roomUserUpdatePayload) { Utils.checkNotNull(roomUserUpdatePayload, "roomUserUpdatePayload"); this.roomUserUpdatePayload = roomUserUpdatePayload; return this; } - public UpdateRoomUserResponse call() throws Exception { - return sdk.updateUser( - id, + private UpdateRoomUserRequest buildRequest() { + + UpdateRoomUserRequest request = new UpdateRoomUserRequest(id, userId, roomUserUpdatePayload); + + return request; + } + + public UpdateRoomUserResponse call() { + + RequestOperation operation + = new UpdateRoomUser.Sync(sdkConfiguration, _headers); + UpdateRoomUserRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserResponse.java index 2a218528..6abe7776 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateRoomUserResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class UpdateRoomUserResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public UpdateRoomUserResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public UpdateRoomUserResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public UpdateRoomUserResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } UpdateRoomUserResponse other = (UpdateRoomUserResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public UpdateRoomUserResponse build() { + return new UpdateRoomUserResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequest.java index f66e40f4..bc42c04b 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequest.java @@ -1,27 +1,24 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class UpdateSigningKeyRequest { - /** * ID of the signing key */ @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=keyId") private String keyId; + @SpeakeasyMetadata("request:mediaType=application/json") private UpdateSigningKeyRequestBody requestBody; @@ -48,10 +45,11 @@ public UpdateSigningKeyRequestBody requestBody() { return requestBody; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the signing key */ @@ -66,7 +64,7 @@ public UpdateSigningKeyRequest withRequestBody(UpdateSigningKeyRequestBody reque this.requestBody = requestBody; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -77,15 +75,14 @@ public boolean equals(java.lang.Object o) { } UpdateSigningKeyRequest other = (UpdateSigningKeyRequest) o; return - Objects.deepEquals(this.keyId, other.keyId) && - Objects.deepEquals(this.requestBody, other.requestBody); + Utils.enhancedDeepEquals(this.keyId, other.keyId) && + Utils.enhancedDeepEquals(this.requestBody, other.requestBody); } @Override public int hashCode() { - return Objects.hash( - keyId, - requestBody); + return Utils.enhancedHash( + keyId, requestBody); } @Override @@ -94,17 +91,19 @@ public String toString() { "keyId", keyId, "requestBody", requestBody); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String keyId; - - private UpdateSigningKeyRequestBody requestBody; - + + private UpdateSigningKeyRequestBody requestBody; + private Builder() { // force use of static builder() method } + /** * ID of the signing key */ @@ -114,17 +113,18 @@ public Builder keyId(String keyId) { return this; } + public Builder requestBody(UpdateSigningKeyRequestBody requestBody) { Utils.checkNotNull(requestBody, "requestBody"); this.requestBody = requestBody; return this; } - + public UpdateSigningKeyRequest build() { + return new UpdateSigningKeyRequest( - keyId, - requestBody); + keyId, requestBody); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequestBody.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequestBody.java index 43d6be2b..5f698df1 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequestBody.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequestBody.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude.Include; @@ -13,7 +11,6 @@ import java.lang.Boolean; import java.lang.Override; import java.lang.String; -import java.util.Objects; import java.util.Optional; import studio.livepeer.livepeer.utils.Utils; @@ -24,6 +21,7 @@ public class UpdateSigningKeyRequestBody { @JsonProperty("disabled") private Optional disabled; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("name") private Optional name; @@ -52,16 +50,18 @@ public Optional name() { return name; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public UpdateSigningKeyRequestBody withDisabled(boolean disabled) { Utils.checkNotNull(disabled, "disabled"); this.disabled = Optional.ofNullable(disabled); return this; } + public UpdateSigningKeyRequestBody withDisabled(Optional disabled) { Utils.checkNotNull(disabled, "disabled"); this.disabled = disabled; @@ -74,12 +74,13 @@ public UpdateSigningKeyRequestBody withName(String name) { return this; } + public UpdateSigningKeyRequestBody withName(Optional name) { Utils.checkNotNull(name, "name"); this.name = name; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -90,15 +91,14 @@ public boolean equals(java.lang.Object o) { } UpdateSigningKeyRequestBody other = (UpdateSigningKeyRequestBody) o; return - Objects.deepEquals(this.disabled, other.disabled) && - Objects.deepEquals(this.name, other.name); + Utils.enhancedDeepEquals(this.disabled, other.disabled) && + Utils.enhancedDeepEquals(this.name, other.name); } @Override public int hashCode() { - return Objects.hash( - disabled, - name); + return Utils.enhancedHash( + disabled, name); } @Override @@ -107,17 +107,19 @@ public String toString() { "disabled", disabled, "name", name); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Optional disabled = Optional.empty(); - - private Optional name = Optional.empty(); - + + private Optional name = Optional.empty(); + private Builder() { // force use of static builder() method } + public Builder disabled(boolean disabled) { Utils.checkNotNull(disabled, "disabled"); this.disabled = Optional.ofNullable(disabled); @@ -130,6 +132,7 @@ public Builder disabled(Optional disabled) { return this; } + public Builder name(String name) { Utils.checkNotNull(name, "name"); this.name = Optional.ofNullable(name); @@ -141,12 +144,12 @@ public Builder name(Optional name) { this.name = name; return this; } - + public UpdateSigningKeyRequestBody build() { + return new UpdateSigningKeyRequestBody( - disabled, - name); + disabled, name); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequestBuilder.java index 7b841c56..11d54e27 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyRequestBuilder.java @@ -1,38 +1,54 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.UpdateSigningKey; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class UpdateSigningKeyRequestBuilder { private String keyId; private UpdateSigningKeyRequestBody requestBody; - private final SDKMethodInterfaces.MethodCallUpdateSigningKey sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public UpdateSigningKeyRequestBuilder(SDKMethodInterfaces.MethodCallUpdateSigningKey sdk) { - this.sdk = sdk; + public UpdateSigningKeyRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public UpdateSigningKeyRequestBuilder keyId(java.lang.String keyId) { + public UpdateSigningKeyRequestBuilder keyId(String keyId) { Utils.checkNotNull(keyId, "keyId"); this.keyId = keyId; return this; } - public UpdateSigningKeyRequestBuilder requestBody(studio.livepeer.livepeer.models.operations.UpdateSigningKeyRequestBody requestBody) { + public UpdateSigningKeyRequestBuilder requestBody(UpdateSigningKeyRequestBody requestBody) { Utils.checkNotNull(requestBody, "requestBody"); this.requestBody = requestBody; return this; } - public UpdateSigningKeyResponse call() throws Exception { - return sdk.update( - keyId, + private UpdateSigningKeyRequest buildRequest() { + + UpdateSigningKeyRequest request = new UpdateSigningKeyRequest(keyId, requestBody); + + return request; + } + + public UpdateSigningKeyResponse call() { + + RequestOperation operation + = new UpdateSigningKey.Sync(sdkConfiguration, _headers); + UpdateSigningKeyRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyResponse.java index 36b502dd..d128467a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateSigningKeyResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class UpdateSigningKeyResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public UpdateSigningKeyResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public UpdateSigningKeyResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public UpdateSigningKeyResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } UpdateSigningKeyResponse other = (UpdateSigningKeyResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public UpdateSigningKeyResponse build() { + return new UpdateSigningKeyResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamRequest.java index 51e28e77..5c1d0ca1 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamRequest.java @@ -1,28 +1,25 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.models.components.StreamPatchPayload; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; public class UpdateStreamRequest { - /** * ID of the stream */ @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; + @SpeakeasyMetadata("request:mediaType=application/json") private StreamPatchPayload streamPatchPayload; @@ -49,10 +46,11 @@ public StreamPatchPayload streamPatchPayload() { return streamPatchPayload; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * ID of the stream */ @@ -67,7 +65,7 @@ public UpdateStreamRequest withStreamPatchPayload(StreamPatchPayload streamPatch this.streamPatchPayload = streamPatchPayload; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -78,15 +76,14 @@ public boolean equals(java.lang.Object o) { } UpdateStreamRequest other = (UpdateStreamRequest) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.streamPatchPayload, other.streamPatchPayload); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.streamPatchPayload, other.streamPatchPayload); } @Override public int hashCode() { - return Objects.hash( - id, - streamPatchPayload); + return Utils.enhancedHash( + id, streamPatchPayload); } @Override @@ -95,17 +92,19 @@ public String toString() { "id", id, "streamPatchPayload", streamPatchPayload); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - - private StreamPatchPayload streamPatchPayload; - + + private StreamPatchPayload streamPatchPayload; + private Builder() { // force use of static builder() method } + /** * ID of the stream */ @@ -115,17 +114,18 @@ public Builder id(String id) { return this; } + public Builder streamPatchPayload(StreamPatchPayload streamPatchPayload) { Utils.checkNotNull(streamPatchPayload, "streamPatchPayload"); this.streamPatchPayload = streamPatchPayload; return this; } - + public UpdateStreamRequest build() { + return new UpdateStreamRequest( - id, - streamPatchPayload); + id, streamPatchPayload); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamRequestBuilder.java index 78844075..3cf68d10 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamRequestBuilder.java @@ -1,39 +1,55 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.StreamPatchPayload; +import studio.livepeer.livepeer.operations.UpdateStream; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class UpdateStreamRequestBuilder { private String id; private StreamPatchPayload streamPatchPayload; - private final SDKMethodInterfaces.MethodCallUpdateStream sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public UpdateStreamRequestBuilder(SDKMethodInterfaces.MethodCallUpdateStream sdk) { - this.sdk = sdk; + public UpdateStreamRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public UpdateStreamRequestBuilder id(java.lang.String id) { + public UpdateStreamRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public UpdateStreamRequestBuilder streamPatchPayload(studio.livepeer.livepeer.models.components.StreamPatchPayload streamPatchPayload) { + public UpdateStreamRequestBuilder streamPatchPayload(StreamPatchPayload streamPatchPayload) { Utils.checkNotNull(streamPatchPayload, "streamPatchPayload"); this.streamPatchPayload = streamPatchPayload; return this; } - public UpdateStreamResponse call() throws Exception { - return sdk.update( - id, + private UpdateStreamRequest buildRequest() { + + UpdateStreamRequest request = new UpdateStreamRequest(id, streamPatchPayload); + + return request; + } + + public UpdateStreamResponse call() { + + RequestOperation operation + = new UpdateStream.Sync(sdkConfiguration, _headers); + UpdateStreamRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamResponse.java index a2697f0e..7ee52a82 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateStreamResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class UpdateStreamResponse implements Response { - /** * HTTP response content type for this operation */ @@ -62,7 +58,8 @@ public UpdateStreamResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty()); } /** @@ -98,10 +95,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -138,6 +136,7 @@ public UpdateStreamResponse withError(Error error) { return this; } + /** * Error */ @@ -146,7 +145,7 @@ public UpdateStreamResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -157,18 +156,16 @@ public boolean equals(java.lang.Object o) { } UpdateStreamResponse other = (UpdateStreamResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, + return Utils.enhancedHash( + contentType, statusCode, rawResponse, error); } @@ -180,21 +177,23 @@ public String toString() { "rawResponse", rawResponse, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -204,6 +203,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -213,6 +213,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -222,6 +223,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Error */ @@ -239,14 +241,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public UpdateStreamResponse build() { + return new UpdateStreamResponse( - contentType, - statusCode, - rawResponse, + contentType, statusCode, rawResponse, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookRequest.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookRequest.java index c14f2342..f2d3c9a6 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookRequest.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookRequest.java @@ -1,15 +1,12 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.models.components.WebhookInput; import studio.livepeer.livepeer.utils.SpeakeasyMetadata; import studio.livepeer.livepeer.utils.Utils; @@ -20,6 +17,7 @@ public class UpdateWebhookRequest { @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") private String id; + @SpeakeasyMetadata("request:mediaType=application/json") private WebhookInput webhook; @@ -43,10 +41,11 @@ public WebhookInput webhook() { return webhook; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public UpdateWebhookRequest withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; @@ -58,7 +57,7 @@ public UpdateWebhookRequest withWebhook(WebhookInput webhook) { this.webhook = webhook; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -69,15 +68,14 @@ public boolean equals(java.lang.Object o) { } UpdateWebhookRequest other = (UpdateWebhookRequest) o; return - Objects.deepEquals(this.id, other.id) && - Objects.deepEquals(this.webhook, other.webhook); + Utils.enhancedDeepEquals(this.id, other.id) && + Utils.enhancedDeepEquals(this.webhook, other.webhook); } @Override public int hashCode() { - return Objects.hash( - id, - webhook); + return Utils.enhancedHash( + id, webhook); } @Override @@ -86,34 +84,37 @@ public String toString() { "id", id, "webhook", webhook); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String id; - - private WebhookInput webhook; - + + private WebhookInput webhook; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } + public Builder webhook(WebhookInput webhook) { Utils.checkNotNull(webhook, "webhook"); this.webhook = webhook; return this; } - + public UpdateWebhookRequest build() { + return new UpdateWebhookRequest( - id, - webhook); + id, webhook); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookRequestBuilder.java index 5ee1a061..d1d8fb4a 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookRequestBuilder.java @@ -1,39 +1,55 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + import java.lang.String; +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.WebhookInput; +import studio.livepeer.livepeer.operations.UpdateWebhook; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class UpdateWebhookRequestBuilder { private String id; private WebhookInput webhook; - private final SDKMethodInterfaces.MethodCallUpdateWebhook sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public UpdateWebhookRequestBuilder(SDKMethodInterfaces.MethodCallUpdateWebhook sdk) { - this.sdk = sdk; + public UpdateWebhookRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public UpdateWebhookRequestBuilder id(java.lang.String id) { + public UpdateWebhookRequestBuilder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - public UpdateWebhookRequestBuilder webhook(studio.livepeer.livepeer.models.components.WebhookInput webhook) { + public UpdateWebhookRequestBuilder webhook(WebhookInput webhook) { Utils.checkNotNull(webhook, "webhook"); this.webhook = webhook; return this; } - public UpdateWebhookResponse call() throws Exception { - return sdk.update( - id, + private UpdateWebhookRequest buildRequest() { + + UpdateWebhookRequest request = new UpdateWebhookRequest(id, webhook); + + return request; + } + + public UpdateWebhookResponse call() { + + RequestOperation operation + = new UpdateWebhook.Sync(sdkConfiguration, _headers); + UpdateWebhookRequest request = buildRequest(); + + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookResponse.java index 7bdaa178..a26e38c3 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UpdateWebhookResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,16 +11,14 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.models.components.Webhook; -import studio.livepeer.livepeer.models.errors.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class UpdateWebhookResponse implements Response { - /** * HTTP response content type for this operation */ @@ -71,7 +67,8 @@ public UpdateWebhookResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); } /** @@ -116,10 +113,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -156,6 +154,7 @@ public UpdateWebhookResponse withWebhook(Webhook webhook) { return this; } + /** * Success */ @@ -174,6 +173,7 @@ public UpdateWebhookResponse withError(Error error) { return this; } + /** * Error */ @@ -182,7 +182,7 @@ public UpdateWebhookResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -193,21 +193,18 @@ public boolean equals(java.lang.Object o) { } UpdateWebhookResponse other = (UpdateWebhookResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.webhook, other.webhook) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.webhook, other.webhook) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - webhook, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + webhook, error); } @Override @@ -219,23 +216,25 @@ public String toString() { "webhook", webhook, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional webhook = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -245,6 +244,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -254,6 +254,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -263,6 +264,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Success */ @@ -281,6 +283,7 @@ public Builder webhook(Optional webhook) { return this; } + /** * Error */ @@ -298,15 +301,13 @@ public Builder error(Optional error) { this.error = error; return this; } - + public UpdateWebhookResponse build() { + return new UpdateWebhookResponse( - contentType, - statusCode, - rawResponse, - webhook, - error); + contentType, statusCode, rawResponse, + webhook, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetAssetTask.java b/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetAssetTask.java index 9533f383..f87c9012 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetAssetTask.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetAssetTask.java @@ -1,16 +1,13 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; @@ -31,16 +28,17 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public UploadAssetAssetTask withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -51,12 +49,12 @@ public boolean equals(java.lang.Object o) { } UploadAssetAssetTask other = (UploadAssetAssetTask) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -65,25 +63,28 @@ public String toString() { return Utils.toString(UploadAssetAssetTask.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + public UploadAssetAssetTask build() { + return new UploadAssetAssetTask( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetData.java b/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetData.java index 2e21400f..f06e33e1 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetData.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetData.java @@ -1,28 +1,27 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.models.components.Asset; import studio.livepeer.livepeer.utils.Utils; /** - * UploadAssetData - Upload in progress + * UploadAssetData + * + *

Upload in progress */ - public class UploadAssetData { @JsonProperty("asset") private Asset asset; + @JsonProperty("task") private UploadAssetTask task; @@ -46,10 +45,11 @@ public UploadAssetTask task() { return task; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public UploadAssetData withAsset(Asset asset) { Utils.checkNotNull(asset, "asset"); this.asset = asset; @@ -61,7 +61,7 @@ public UploadAssetData withTask(UploadAssetTask task) { this.task = task; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -72,15 +72,14 @@ public boolean equals(java.lang.Object o) { } UploadAssetData other = (UploadAssetData) o; return - Objects.deepEquals(this.asset, other.asset) && - Objects.deepEquals(this.task, other.task); + Utils.enhancedDeepEquals(this.asset, other.asset) && + Utils.enhancedDeepEquals(this.task, other.task); } @Override public int hashCode() { - return Objects.hash( - asset, - task); + return Utils.enhancedHash( + asset, task); } @Override @@ -89,34 +88,37 @@ public String toString() { "asset", asset, "task", task); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Asset asset; - - private UploadAssetTask task; - + + private UploadAssetTask task; + private Builder() { // force use of static builder() method } + public Builder asset(Asset asset) { Utils.checkNotNull(asset, "asset"); this.asset = asset; return this; } + public Builder task(UploadAssetTask task) { Utils.checkNotNull(task, "task"); this.task = task; return this; } - + public UploadAssetData build() { + return new UploadAssetData( - asset, - task); + asset, task); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetDataOutput.java b/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetDataOutput.java index 958c46a3..41cbbd4f 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetDataOutput.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetDataOutput.java @@ -1,28 +1,27 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.models.components.Asset; import studio.livepeer.livepeer.utils.Utils; /** - * UploadAssetDataOutput - Upload started + * UploadAssetDataOutput + * + *

Upload started */ - public class UploadAssetDataOutput { @JsonProperty("asset") private Asset asset; + @JsonProperty("task") private UploadAssetAssetTask task; @@ -46,10 +45,11 @@ public UploadAssetAssetTask task() { return task; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public UploadAssetDataOutput withAsset(Asset asset) { Utils.checkNotNull(asset, "asset"); this.asset = asset; @@ -61,7 +61,7 @@ public UploadAssetDataOutput withTask(UploadAssetAssetTask task) { this.task = task; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -72,15 +72,14 @@ public boolean equals(java.lang.Object o) { } UploadAssetDataOutput other = (UploadAssetDataOutput) o; return - Objects.deepEquals(this.asset, other.asset) && - Objects.deepEquals(this.task, other.task); + Utils.enhancedDeepEquals(this.asset, other.asset) && + Utils.enhancedDeepEquals(this.task, other.task); } @Override public int hashCode() { - return Objects.hash( - asset, - task); + return Utils.enhancedHash( + asset, task); } @Override @@ -89,34 +88,37 @@ public String toString() { "asset", asset, "task", task); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private Asset asset; - - private UploadAssetAssetTask task; - + + private UploadAssetAssetTask task; + private Builder() { // force use of static builder() method } + public Builder asset(Asset asset) { Utils.checkNotNull(asset, "asset"); this.asset = asset; return this; } + public Builder task(UploadAssetAssetTask task) { Utils.checkNotNull(task, "task"); this.task = task; return this; } - + public UploadAssetDataOutput build() { + return new UploadAssetDataOutput( - asset, - task); + asset, task); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetRequestBuilder.java index c32ae049..8cc46fd2 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetRequestBuilder.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetRequestBuilder.java @@ -1,30 +1,37 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; + +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.models.components.NewAssetFromUrlPayload; +import studio.livepeer.livepeer.operations.UploadAsset; +import studio.livepeer.livepeer.utils.Headers; import studio.livepeer.livepeer.utils.Utils; public class UploadAssetRequestBuilder { private NewAssetFromUrlPayload request; - private final SDKMethodInterfaces.MethodCallUploadAsset sdk; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); - public UploadAssetRequestBuilder(SDKMethodInterfaces.MethodCallUploadAsset sdk) { - this.sdk = sdk; + public UploadAssetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; } - public UploadAssetRequestBuilder request(studio.livepeer.livepeer.models.components.NewAssetFromUrlPayload request) { + public UploadAssetRequestBuilder request(NewAssetFromUrlPayload request) { Utils.checkNotNull(request, "request"); this.request = request; return this; } - public UploadAssetResponse call() throws Exception { + public UploadAssetResponse call() { + + RequestOperation operation + = new UploadAsset.Sync(sdkConfiguration, _headers); - return sdk.createViaUrl( - request); + return operation.handleResponse(operation.doRequest(request)); } } diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetResponse.java index a02e51db..89ce0b7c 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetResponse.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetResponse.java @@ -1,10 +1,8 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import java.io.InputStream; @@ -13,15 +11,13 @@ import java.lang.String; import java.lang.SuppressWarnings; import java.net.http.HttpResponse; -import java.util.Objects; import java.util.Optional; -import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.components.Error; import studio.livepeer.livepeer.utils.Response; import studio.livepeer.livepeer.utils.Utils; public class UploadAssetResponse implements Response { - /** * HTTP response content type for this operation */ @@ -78,7 +74,8 @@ public UploadAssetResponse( String contentType, int statusCode, HttpResponse rawResponse) { - this(contentType, statusCode, rawResponse, Optional.empty(), Optional.empty(), Optional.empty()); + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty(), Optional.empty()); } /** @@ -132,10 +129,11 @@ public Optional error() { return (Optional) error; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + /** * HTTP response content type for this operation */ @@ -172,6 +170,7 @@ public UploadAssetResponse withTwoHundredApplicationJsonData(UploadAssetData two return this; } + /** * Upload in progress */ @@ -190,6 +189,7 @@ public UploadAssetResponse withTwoHundredAndOneApplicationJsonData(UploadAssetDa return this; } + /** * Upload started */ @@ -208,6 +208,7 @@ public UploadAssetResponse withError(Error error) { return this; } + /** * Error */ @@ -216,7 +217,7 @@ public UploadAssetResponse withError(Optional error) { this.error = error; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -227,23 +228,19 @@ public boolean equals(java.lang.Object o) { } UploadAssetResponse other = (UploadAssetResponse) o; return - Objects.deepEquals(this.contentType, other.contentType) && - Objects.deepEquals(this.statusCode, other.statusCode) && - Objects.deepEquals(this.rawResponse, other.rawResponse) && - Objects.deepEquals(this.twoHundredApplicationJsonData, other.twoHundredApplicationJsonData) && - Objects.deepEquals(this.twoHundredAndOneApplicationJsonData, other.twoHundredAndOneApplicationJsonData) && - Objects.deepEquals(this.error, other.error); + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.twoHundredApplicationJsonData, other.twoHundredApplicationJsonData) && + Utils.enhancedDeepEquals(this.twoHundredAndOneApplicationJsonData, other.twoHundredAndOneApplicationJsonData) && + Utils.enhancedDeepEquals(this.error, other.error); } @Override public int hashCode() { - return Objects.hash( - contentType, - statusCode, - rawResponse, - twoHundredApplicationJsonData, - twoHundredAndOneApplicationJsonData, - error); + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + twoHundredApplicationJsonData, twoHundredAndOneApplicationJsonData, error); } @Override @@ -256,25 +253,27 @@ public String toString() { "twoHundredAndOneApplicationJsonData", twoHundredAndOneApplicationJsonData, "error", error); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - + private String contentType; - + private Integer statusCode; - + private HttpResponse rawResponse; - + private Optional twoHundredApplicationJsonData = Optional.empty(); - + private Optional twoHundredAndOneApplicationJsonData = Optional.empty(); - - private Optional error = Optional.empty(); - + + private Optional error = Optional.empty(); + private Builder() { // force use of static builder() method } + /** * HTTP response content type for this operation */ @@ -284,6 +283,7 @@ public Builder contentType(String contentType) { return this; } + /** * HTTP response status code for this operation */ @@ -293,6 +293,7 @@ public Builder statusCode(int statusCode) { return this; } + /** * Raw HTTP response; suitable for custom response parsing */ @@ -302,6 +303,7 @@ public Builder rawResponse(HttpResponse rawResponse) { return this; } + /** * Upload in progress */ @@ -320,6 +322,7 @@ public Builder twoHundredApplicationJsonData(Optional return this; } + /** * Upload started */ @@ -338,6 +341,7 @@ public Builder twoHundredAndOneApplicationJsonData(Optional error) { this.error = error; return this; } - + public UploadAssetResponse build() { + return new UploadAssetResponse( - contentType, - statusCode, - rawResponse, - twoHundredApplicationJsonData, - twoHundredAndOneApplicationJsonData, - error); + contentType, statusCode, rawResponse, + twoHundredApplicationJsonData, twoHundredAndOneApplicationJsonData, error); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetTask.java b/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetTask.java index 2fd86b39..2afc1ad8 100644 --- a/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetTask.java +++ b/src/main/java/studio/livepeer/livepeer/models/operations/UploadAssetTask.java @@ -1,16 +1,13 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.models.operations; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.lang.Override; import java.lang.String; -import java.util.Objects; import studio.livepeer.livepeer.utils.Utils; @@ -31,16 +28,17 @@ public String id() { return id; } - public final static Builder builder() { + public static Builder builder() { return new Builder(); } + public UploadAssetTask withId(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -51,12 +49,12 @@ public boolean equals(java.lang.Object o) { } UploadAssetTask other = (UploadAssetTask) o; return - Objects.deepEquals(this.id, other.id); + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { - return Objects.hash( + return Utils.enhancedHash( id); } @@ -65,25 +63,28 @@ public String toString() { return Utils.toString(UploadAssetTask.class, "id", id); } - + + @SuppressWarnings("UnusedReturnValue") public final static class Builder { - - private String id; - + + private String id; + private Builder() { // force use of static builder() method } + public Builder id(String id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } - + public UploadAssetTask build() { + return new UploadAssetTask( id); } + } } - diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/AddMultistreamTargetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/AddMultistreamTargetRequestBuilder.java new file mode 100644 index 00000000..6bdf6f62 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/AddMultistreamTargetRequestBuilder.java @@ -0,0 +1,58 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.TargetAddPayload; +import studio.livepeer.livepeer.models.operations.AddMultistreamTargetRequest; +import studio.livepeer.livepeer.operations.AddMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class AddMultistreamTargetRequestBuilder { + + private String id; + private TargetAddPayload targetAddPayload; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public AddMultistreamTargetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public AddMultistreamTargetRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public AddMultistreamTargetRequestBuilder targetAddPayload(TargetAddPayload targetAddPayload) { + Utils.checkNotNull(targetAddPayload, "targetAddPayload"); + this.targetAddPayload = targetAddPayload; + return this; + } + + + private AddMultistreamTargetRequest buildRequest() { + + AddMultistreamTargetRequest request = new AddMultistreamTargetRequest(id, + targetAddPayload); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new AddMultistreamTarget.Async(sdkConfiguration, _headers); + AddMultistreamTargetRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/AddMultistreamTargetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/AddMultistreamTargetResponse.java new file mode 100644 index 00000000..bdc4c9dc --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/AddMultistreamTargetResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class AddMultistreamTargetResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public AddMultistreamTargetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public AddMultistreamTargetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public AddMultistreamTargetResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public AddMultistreamTargetResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public AddMultistreamTargetResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public AddMultistreamTargetResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public AddMultistreamTargetResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddMultistreamTargetResponse other = (AddMultistreamTargetResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(AddMultistreamTargetResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public AddMultistreamTargetResponse build() { + + return new AddMultistreamTargetResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateClipRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateClipRequestBuilder.java new file mode 100644 index 00000000..7f13625a --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateClipRequestBuilder.java @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.ClipPayload; +import studio.livepeer.livepeer.operations.CreateClip; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class CreateClipRequestBuilder { + + private ClipPayload request; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public CreateClipRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CreateClipRequestBuilder request(ClipPayload request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new CreateClip.Async(sdkConfiguration, _headers); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateClipResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateClipResponse.java new file mode 100644 index 00000000..f3718cf6 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateClipResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.operations.CreateClipData; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateClipResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public CreateClipResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public CreateClipResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional data() { + return (Optional) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public CreateClipResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public CreateClipResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public CreateClipResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public CreateClipResponse withData(CreateClipData data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public CreateClipResponse withData(Optional data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public CreateClipResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public CreateClipResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateClipResponse other = (CreateClipResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(CreateClipResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(CreateClipData data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public CreateClipResponse build() { + + return new CreateClipResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateMultistreamTargetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateMultistreamTargetRequestBuilder.java new file mode 100644 index 00000000..6e06c1b4 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateMultistreamTargetRequestBuilder.java @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.MultistreamTargetInput; +import studio.livepeer.livepeer.operations.CreateMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class CreateMultistreamTargetRequestBuilder { + + private MultistreamTargetInput request; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public CreateMultistreamTargetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CreateMultistreamTargetRequestBuilder request(MultistreamTargetInput request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new CreateMultistreamTarget.Async(sdkConfiguration, _headers); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateMultistreamTargetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateMultistreamTargetResponse.java new file mode 100644 index 00000000..bc4892a2 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateMultistreamTargetResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.MultistreamTarget; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateMultistreamTargetResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional multistreamTarget; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public CreateMultistreamTargetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional multistreamTarget, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.multistreamTarget = multistreamTarget; + this.error = error; + } + + public CreateMultistreamTargetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional multistreamTarget() { + return (Optional) multistreamTarget; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public CreateMultistreamTargetResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public CreateMultistreamTargetResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public CreateMultistreamTargetResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public CreateMultistreamTargetResponse withMultistreamTarget(MultistreamTarget multistreamTarget) { + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + this.multistreamTarget = Optional.ofNullable(multistreamTarget); + return this; + } + + + /** + * Success + */ + public CreateMultistreamTargetResponse withMultistreamTarget(Optional multistreamTarget) { + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + this.multistreamTarget = multistreamTarget; + return this; + } + + /** + * Error + */ + public CreateMultistreamTargetResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public CreateMultistreamTargetResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateMultistreamTargetResponse other = (CreateMultistreamTargetResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.multistreamTarget, other.multistreamTarget) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + multistreamTarget, error); + } + + @Override + public String toString() { + return Utils.toString(CreateMultistreamTargetResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "multistreamTarget", multistreamTarget, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional multistreamTarget = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder multistreamTarget(MultistreamTarget multistreamTarget) { + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + this.multistreamTarget = Optional.ofNullable(multistreamTarget); + return this; + } + + /** + * Success + */ + public Builder multistreamTarget(Optional multistreamTarget) { + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + this.multistreamTarget = multistreamTarget; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public CreateMultistreamTargetResponse build() { + + return new CreateMultistreamTargetResponse( + contentType, statusCode, rawResponse, + multistreamTarget, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomRequestBuilder.java new file mode 100644 index 00000000..9343465a --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomRequestBuilder.java @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.CreateRoom; +import studio.livepeer.livepeer.utils.Headers; + +public class CreateRoomRequestBuilder { + + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public CreateRoomRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CompletableFuture call() { + + AsyncRequestlessOperation operation + = new CreateRoom.Async(sdkConfiguration, _headers); + + return operation.doRequest() + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomResponse.java new file mode 100644 index 00000000..931e586e --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomResponse.java @@ -0,0 +1,312 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateRoomResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional createRoomResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public CreateRoomResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional createRoomResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(createRoomResponse, "createRoomResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.createRoomResponse = createRoomResponse; + this.error = error; + } + + public CreateRoomResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional createRoomResponse() { + return (Optional) createRoomResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public CreateRoomResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public CreateRoomResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public CreateRoomResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public CreateRoomResponse withCreateRoomResponse(studio.livepeer.livepeer.models.components.CreateRoomResponse createRoomResponse) { + Utils.checkNotNull(createRoomResponse, "createRoomResponse"); + this.createRoomResponse = Optional.ofNullable(createRoomResponse); + return this; + } + + + /** + * Success + */ + public CreateRoomResponse withCreateRoomResponse(Optional createRoomResponse) { + Utils.checkNotNull(createRoomResponse, "createRoomResponse"); + this.createRoomResponse = createRoomResponse; + return this; + } + + /** + * Error + */ + public CreateRoomResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public CreateRoomResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateRoomResponse other = (CreateRoomResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.createRoomResponse, other.createRoomResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + createRoomResponse, error); + } + + @Override + public String toString() { + return Utils.toString(CreateRoomResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "createRoomResponse", createRoomResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional createRoomResponse = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder createRoomResponse(studio.livepeer.livepeer.models.components.CreateRoomResponse createRoomResponse) { + Utils.checkNotNull(createRoomResponse, "createRoomResponse"); + this.createRoomResponse = Optional.ofNullable(createRoomResponse); + return this; + } + + /** + * Success + */ + public Builder createRoomResponse(Optional createRoomResponse) { + Utils.checkNotNull(createRoomResponse, "createRoomResponse"); + this.createRoomResponse = createRoomResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public CreateRoomResponse build() { + + return new CreateRoomResponse( + contentType, statusCode, rawResponse, + createRoomResponse, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomUserRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomUserRequestBuilder.java new file mode 100644 index 00000000..3ba59fbd --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomUserRequestBuilder.java @@ -0,0 +1,58 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.RoomUserPayload; +import studio.livepeer.livepeer.models.operations.CreateRoomUserRequest; +import studio.livepeer.livepeer.operations.CreateRoomUser; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class CreateRoomUserRequestBuilder { + + private String id; + private RoomUserPayload roomUserPayload; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public CreateRoomUserRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CreateRoomUserRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public CreateRoomUserRequestBuilder roomUserPayload(RoomUserPayload roomUserPayload) { + Utils.checkNotNull(roomUserPayload, "roomUserPayload"); + this.roomUserPayload = roomUserPayload; + return this; + } + + + private CreateRoomUserRequest buildRequest() { + + CreateRoomUserRequest request = new CreateRoomUserRequest(id, + roomUserPayload); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new CreateRoomUser.Async(sdkConfiguration, _headers); + CreateRoomUserRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomUserResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomUserResponse.java new file mode 100644 index 00000000..86c78e1d --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateRoomUserResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.RoomUserResponse; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateRoomUserResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional roomUserResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public CreateRoomUserResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional roomUserResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(roomUserResponse, "roomUserResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.roomUserResponse = roomUserResponse; + this.error = error; + } + + public CreateRoomUserResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional roomUserResponse() { + return (Optional) roomUserResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public CreateRoomUserResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public CreateRoomUserResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public CreateRoomUserResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public CreateRoomUserResponse withRoomUserResponse(RoomUserResponse roomUserResponse) { + Utils.checkNotNull(roomUserResponse, "roomUserResponse"); + this.roomUserResponse = Optional.ofNullable(roomUserResponse); + return this; + } + + + /** + * Success + */ + public CreateRoomUserResponse withRoomUserResponse(Optional roomUserResponse) { + Utils.checkNotNull(roomUserResponse, "roomUserResponse"); + this.roomUserResponse = roomUserResponse; + return this; + } + + /** + * Error + */ + public CreateRoomUserResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public CreateRoomUserResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateRoomUserResponse other = (CreateRoomUserResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.roomUserResponse, other.roomUserResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + roomUserResponse, error); + } + + @Override + public String toString() { + return Utils.toString(CreateRoomUserResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "roomUserResponse", roomUserResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional roomUserResponse = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder roomUserResponse(RoomUserResponse roomUserResponse) { + Utils.checkNotNull(roomUserResponse, "roomUserResponse"); + this.roomUserResponse = Optional.ofNullable(roomUserResponse); + return this; + } + + /** + * Success + */ + public Builder roomUserResponse(Optional roomUserResponse) { + Utils.checkNotNull(roomUserResponse, "roomUserResponse"); + this.roomUserResponse = roomUserResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public CreateRoomUserResponse build() { + + return new CreateRoomUserResponse( + contentType, statusCode, rawResponse, + roomUserResponse, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateSigningKeyRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateSigningKeyRequestBuilder.java new file mode 100644 index 00000000..791b446c --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateSigningKeyRequestBuilder.java @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.CreateSigningKey; +import studio.livepeer.livepeer.utils.Headers; + +public class CreateSigningKeyRequestBuilder { + + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public CreateSigningKeyRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CompletableFuture call() { + + AsyncRequestlessOperation operation + = new CreateSigningKey.Async(sdkConfiguration, _headers); + + return operation.doRequest() + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateSigningKeyResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateSigningKeyResponse.java new file mode 100644 index 00000000..6c5d2267 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateSigningKeyResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.SigningKey; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateSigningKeyResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional signingKey; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public CreateSigningKeyResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional signingKey, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(signingKey, "signingKey"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.signingKey = signingKey; + this.error = error; + } + + public CreateSigningKeyResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional signingKey() { + return (Optional) signingKey; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public CreateSigningKeyResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public CreateSigningKeyResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public CreateSigningKeyResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public CreateSigningKeyResponse withSigningKey(SigningKey signingKey) { + Utils.checkNotNull(signingKey, "signingKey"); + this.signingKey = Optional.ofNullable(signingKey); + return this; + } + + + /** + * Success + */ + public CreateSigningKeyResponse withSigningKey(Optional signingKey) { + Utils.checkNotNull(signingKey, "signingKey"); + this.signingKey = signingKey; + return this; + } + + /** + * Error + */ + public CreateSigningKeyResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public CreateSigningKeyResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSigningKeyResponse other = (CreateSigningKeyResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.signingKey, other.signingKey) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + signingKey, error); + } + + @Override + public String toString() { + return Utils.toString(CreateSigningKeyResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "signingKey", signingKey, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional signingKey = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder signingKey(SigningKey signingKey) { + Utils.checkNotNull(signingKey, "signingKey"); + this.signingKey = Optional.ofNullable(signingKey); + return this; + } + + /** + * Success + */ + public Builder signingKey(Optional signingKey) { + Utils.checkNotNull(signingKey, "signingKey"); + this.signingKey = signingKey; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public CreateSigningKeyResponse build() { + + return new CreateSigningKeyResponse( + contentType, statusCode, rawResponse, + signingKey, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateStreamRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateStreamRequestBuilder.java new file mode 100644 index 00000000..e571c3a4 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateStreamRequestBuilder.java @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.NewStreamPayload; +import studio.livepeer.livepeer.operations.CreateStream; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class CreateStreamRequestBuilder { + + private NewStreamPayload request; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public CreateStreamRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CreateStreamRequestBuilder request(NewStreamPayload request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new CreateStream.Async(sdkConfiguration, _headers); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateStreamResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateStreamResponse.java new file mode 100644 index 00000000..e443c46e --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateStreamResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Stream; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateStreamResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional stream; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public CreateStreamResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional stream, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(stream, "stream"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.stream = stream; + this.error = error; + } + + public CreateStreamResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional stream() { + return (Optional) stream; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public CreateStreamResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public CreateStreamResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public CreateStreamResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public CreateStreamResponse withStream(Stream stream) { + Utils.checkNotNull(stream, "stream"); + this.stream = Optional.ofNullable(stream); + return this; + } + + + /** + * Success + */ + public CreateStreamResponse withStream(Optional stream) { + Utils.checkNotNull(stream, "stream"); + this.stream = stream; + return this; + } + + /** + * Error + */ + public CreateStreamResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public CreateStreamResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateStreamResponse other = (CreateStreamResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.stream, other.stream) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + stream, error); + } + + @Override + public String toString() { + return Utils.toString(CreateStreamResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "stream", stream, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional stream = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder stream(Stream stream) { + Utils.checkNotNull(stream, "stream"); + this.stream = Optional.ofNullable(stream); + return this; + } + + /** + * Success + */ + public Builder stream(Optional stream) { + Utils.checkNotNull(stream, "stream"); + this.stream = stream; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public CreateStreamResponse build() { + + return new CreateStreamResponse( + contentType, statusCode, rawResponse, + stream, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateWebhookRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateWebhookRequestBuilder.java new file mode 100644 index 00000000..9ccc6ffe --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateWebhookRequestBuilder.java @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.WebhookInput; +import studio.livepeer.livepeer.operations.CreateWebhook; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class CreateWebhookRequestBuilder { + + private WebhookInput request; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public CreateWebhookRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CreateWebhookRequestBuilder request(WebhookInput request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new CreateWebhook.Async(sdkConfiguration, _headers); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateWebhookResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateWebhookResponse.java new file mode 100644 index 00000000..8e492340 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/CreateWebhookResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Webhook; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateWebhookResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional webhook; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public CreateWebhookResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional webhook, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(webhook, "webhook"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.webhook = webhook; + this.error = error; + } + + public CreateWebhookResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional webhook() { + return (Optional) webhook; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public CreateWebhookResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public CreateWebhookResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public CreateWebhookResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public CreateWebhookResponse withWebhook(Webhook webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = Optional.ofNullable(webhook); + return this; + } + + + /** + * Success + */ + public CreateWebhookResponse withWebhook(Optional webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = webhook; + return this; + } + + /** + * Error + */ + public CreateWebhookResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public CreateWebhookResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateWebhookResponse other = (CreateWebhookResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.webhook, other.webhook) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + webhook, error); + } + + @Override + public String toString() { + return Utils.toString(CreateWebhookResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "webhook", webhook, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional webhook = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder webhook(Webhook webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = Optional.ofNullable(webhook); + return this; + } + + /** + * Success + */ + public Builder webhook(Optional webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = webhook; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public CreateWebhookResponse build() { + + return new CreateWebhookResponse( + contentType, statusCode, rawResponse, + webhook, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteAssetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteAssetRequestBuilder.java new file mode 100644 index 00000000..38a5b259 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteAssetRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.DeleteAssetRequest; +import studio.livepeer.livepeer.operations.DeleteAsset; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class DeleteAssetRequestBuilder { + + private String assetId; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public DeleteAssetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public DeleteAssetRequestBuilder assetId(String assetId) { + Utils.checkNotNull(assetId, "assetId"); + this.assetId = assetId; + return this; + } + + + private DeleteAssetRequest buildRequest() { + + DeleteAssetRequest request = new DeleteAssetRequest(assetId); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new DeleteAsset.Async(sdkConfiguration, _headers); + DeleteAssetRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteAssetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteAssetResponse.java new file mode 100644 index 00000000..fdf47103 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteAssetResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteAssetResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public DeleteAssetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public DeleteAssetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public DeleteAssetResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public DeleteAssetResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public DeleteAssetResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public DeleteAssetResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public DeleteAssetResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteAssetResponse other = (DeleteAssetResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(DeleteAssetResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public DeleteAssetResponse build() { + + return new DeleteAssetResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteMultistreamTargetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteMultistreamTargetRequestBuilder.java new file mode 100644 index 00000000..48b7afd7 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteMultistreamTargetRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.DeleteMultistreamTargetRequest; +import studio.livepeer.livepeer.operations.DeleteMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class DeleteMultistreamTargetRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public DeleteMultistreamTargetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public DeleteMultistreamTargetRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private DeleteMultistreamTargetRequest buildRequest() { + + DeleteMultistreamTargetRequest request = new DeleteMultistreamTargetRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new DeleteMultistreamTarget.Async(sdkConfiguration, _headers); + DeleteMultistreamTargetRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteMultistreamTargetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteMultistreamTargetResponse.java new file mode 100644 index 00000000..32cc5e67 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteMultistreamTargetResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteMultistreamTargetResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public DeleteMultistreamTargetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public DeleteMultistreamTargetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public DeleteMultistreamTargetResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public DeleteMultistreamTargetResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public DeleteMultistreamTargetResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public DeleteMultistreamTargetResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public DeleteMultistreamTargetResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteMultistreamTargetResponse other = (DeleteMultistreamTargetResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(DeleteMultistreamTargetResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public DeleteMultistreamTargetResponse build() { + + return new DeleteMultistreamTargetResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomRequestBuilder.java new file mode 100644 index 00000000..65d0bcd9 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.DeleteRoomRequest; +import studio.livepeer.livepeer.operations.DeleteRoom; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class DeleteRoomRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public DeleteRoomRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public DeleteRoomRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private DeleteRoomRequest buildRequest() { + + DeleteRoomRequest request = new DeleteRoomRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new DeleteRoom.Async(sdkConfiguration, _headers); + DeleteRoomRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomResponse.java new file mode 100644 index 00000000..bfa49da5 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteRoomResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public DeleteRoomResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public DeleteRoomResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public DeleteRoomResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public DeleteRoomResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public DeleteRoomResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public DeleteRoomResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public DeleteRoomResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteRoomResponse other = (DeleteRoomResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(DeleteRoomResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public DeleteRoomResponse build() { + + return new DeleteRoomResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomUserRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomUserRequestBuilder.java new file mode 100644 index 00000000..af90c737 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomUserRequestBuilder.java @@ -0,0 +1,57 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.DeleteRoomUserRequest; +import studio.livepeer.livepeer.operations.DeleteRoomUser; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class DeleteRoomUserRequestBuilder { + + private String id; + private String userId; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public DeleteRoomUserRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public DeleteRoomUserRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public DeleteRoomUserRequestBuilder userId(String userId) { + Utils.checkNotNull(userId, "userId"); + this.userId = userId; + return this; + } + + + private DeleteRoomUserRequest buildRequest() { + + DeleteRoomUserRequest request = new DeleteRoomUserRequest(id, + userId); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new DeleteRoomUser.Async(sdkConfiguration, _headers); + DeleteRoomUserRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomUserResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomUserResponse.java new file mode 100644 index 00000000..955df013 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteRoomUserResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteRoomUserResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public DeleteRoomUserResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public DeleteRoomUserResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public DeleteRoomUserResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public DeleteRoomUserResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public DeleteRoomUserResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public DeleteRoomUserResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public DeleteRoomUserResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteRoomUserResponse other = (DeleteRoomUserResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(DeleteRoomUserResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public DeleteRoomUserResponse build() { + + return new DeleteRoomUserResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteSigningKeyRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteSigningKeyRequestBuilder.java new file mode 100644 index 00000000..b29c8cb6 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteSigningKeyRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.DeleteSigningKeyRequest; +import studio.livepeer.livepeer.operations.DeleteSigningKey; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class DeleteSigningKeyRequestBuilder { + + private String keyId; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public DeleteSigningKeyRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public DeleteSigningKeyRequestBuilder keyId(String keyId) { + Utils.checkNotNull(keyId, "keyId"); + this.keyId = keyId; + return this; + } + + + private DeleteSigningKeyRequest buildRequest() { + + DeleteSigningKeyRequest request = new DeleteSigningKeyRequest(keyId); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new DeleteSigningKey.Async(sdkConfiguration, _headers); + DeleteSigningKeyRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteSigningKeyResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteSigningKeyResponse.java new file mode 100644 index 00000000..41f0c6df --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteSigningKeyResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteSigningKeyResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public DeleteSigningKeyResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public DeleteSigningKeyResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public DeleteSigningKeyResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public DeleteSigningKeyResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public DeleteSigningKeyResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public DeleteSigningKeyResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public DeleteSigningKeyResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteSigningKeyResponse other = (DeleteSigningKeyResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(DeleteSigningKeyResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public DeleteSigningKeyResponse build() { + + return new DeleteSigningKeyResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteStreamRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteStreamRequestBuilder.java new file mode 100644 index 00000000..742477d9 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteStreamRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.DeleteStreamRequest; +import studio.livepeer.livepeer.operations.DeleteStream; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class DeleteStreamRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public DeleteStreamRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public DeleteStreamRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private DeleteStreamRequest buildRequest() { + + DeleteStreamRequest request = new DeleteStreamRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new DeleteStream.Async(sdkConfiguration, _headers); + DeleteStreamRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteStreamResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteStreamResponse.java new file mode 100644 index 00000000..c32d08a5 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteStreamResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteStreamResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public DeleteStreamResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public DeleteStreamResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public DeleteStreamResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public DeleteStreamResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public DeleteStreamResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public DeleteStreamResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public DeleteStreamResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteStreamResponse other = (DeleteStreamResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(DeleteStreamResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public DeleteStreamResponse build() { + + return new DeleteStreamResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteWebhookRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteWebhookRequestBuilder.java new file mode 100644 index 00000000..ac442e6b --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteWebhookRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.DeleteWebhookRequest; +import studio.livepeer.livepeer.operations.DeleteWebhook; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class DeleteWebhookRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public DeleteWebhookRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public DeleteWebhookRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private DeleteWebhookRequest buildRequest() { + + DeleteWebhookRequest request = new DeleteWebhookRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new DeleteWebhook.Async(sdkConfiguration, _headers); + DeleteWebhookRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteWebhookResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteWebhookResponse.java new file mode 100644 index 00000000..b0c3bd8d --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/DeleteWebhookResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Webhook; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteWebhookResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional webhook; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public DeleteWebhookResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional webhook, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(webhook, "webhook"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.webhook = webhook; + this.error = error; + } + + public DeleteWebhookResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional webhook() { + return (Optional) webhook; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public DeleteWebhookResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public DeleteWebhookResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public DeleteWebhookResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public DeleteWebhookResponse withWebhook(Webhook webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = Optional.ofNullable(webhook); + return this; + } + + + /** + * Success + */ + public DeleteWebhookResponse withWebhook(Optional webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = webhook; + return this; + } + + /** + * Error + */ + public DeleteWebhookResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public DeleteWebhookResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeleteWebhookResponse other = (DeleteWebhookResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.webhook, other.webhook) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + webhook, error); + } + + @Override + public String toString() { + return Utils.toString(DeleteWebhookResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "webhook", webhook, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional webhook = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder webhook(Webhook webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = Optional.ofNullable(webhook); + return this; + } + + /** + * Success + */ + public Builder webhook(Optional webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = webhook; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public DeleteWebhookResponse build() { + + return new DeleteWebhookResponse( + contentType, statusCode, rawResponse, + webhook, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetRequestBuilder.java new file mode 100644 index 00000000..bd680250 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetAssetRequest; +import studio.livepeer.livepeer.operations.GetAsset; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetAssetRequestBuilder { + + private String assetId; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetAssetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetAssetRequestBuilder assetId(String assetId) { + Utils.checkNotNull(assetId, "assetId"); + this.assetId = assetId; + return this; + } + + + private GetAssetRequest buildRequest() { + + GetAssetRequest request = new GetAssetRequest(assetId); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetAsset.Async(sdkConfiguration, _headers); + GetAssetRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetResponse.java new file mode 100644 index 00000000..c88057ea --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Asset; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetAssetResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional asset; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetAssetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional asset, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(asset, "asset"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.asset = asset; + this.error = error; + } + + public GetAssetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional asset() { + return (Optional) asset; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetAssetResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetAssetResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetAssetResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetAssetResponse withAsset(Asset asset) { + Utils.checkNotNull(asset, "asset"); + this.asset = Optional.ofNullable(asset); + return this; + } + + + /** + * Success + */ + public GetAssetResponse withAsset(Optional asset) { + Utils.checkNotNull(asset, "asset"); + this.asset = asset; + return this; + } + + /** + * Error + */ + public GetAssetResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetAssetResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAssetResponse other = (GetAssetResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.asset, other.asset) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + asset, error); + } + + @Override + public String toString() { + return Utils.toString(GetAssetResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "asset", asset, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional asset = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder asset(Asset asset) { + Utils.checkNotNull(asset, "asset"); + this.asset = Optional.ofNullable(asset); + return this; + } + + /** + * Success + */ + public Builder asset(Optional asset) { + Utils.checkNotNull(asset, "asset"); + this.asset = asset; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetAssetResponse build() { + + return new GetAssetResponse( + contentType, statusCode, rawResponse, + asset, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetsRequestBuilder.java new file mode 100644 index 00000000..5c9f4bf9 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetsRequestBuilder.java @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetAssets; +import studio.livepeer.livepeer.utils.Headers; + +public class GetAssetsRequestBuilder { + + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetAssetsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CompletableFuture call() { + + AsyncRequestlessOperation operation + = new GetAssets.Async(sdkConfiguration, _headers); + + return operation.doRequest() + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetsResponse.java new file mode 100644 index 00000000..df1b3ff5 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetAssetsResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Asset; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetAssetsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetAssetsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetAssetsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetAssetsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetAssetsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetAssetsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetAssetsResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public GetAssetsResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetAssetsResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetAssetsResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetAssetsResponse other = (GetAssetsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetAssetsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetAssetsResponse build() { + + return new GetAssetsResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetClipsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetClipsRequestBuilder.java new file mode 100644 index 00000000..d3606c9f --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetClipsRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetClipsRequest; +import studio.livepeer.livepeer.operations.GetClips; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetClipsRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetClipsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetClipsRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private GetClipsRequest buildRequest() { + + GetClipsRequest request = new GetClipsRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetClips.Async(sdkConfiguration, _headers); + GetClipsRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetClipsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetClipsResponse.java new file mode 100644 index 00000000..b5a765ad --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetClipsResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Asset; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetClipsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetClipsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetClipsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetClipsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetClipsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetClipsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetClipsResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public GetClipsResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetClipsResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetClipsResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetClipsResponse other = (GetClipsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetClipsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetClipsResponse build() { + + return new GetClipsResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetCreatorViewershipMetricsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetCreatorViewershipMetricsRequestBuilder.java new file mode 100644 index 00000000..744b41de --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetCreatorViewershipMetricsRequestBuilder.java @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsRequest; +import studio.livepeer.livepeer.operations.GetCreatorViewershipMetrics; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetCreatorViewershipMetricsRequestBuilder { + + private GetCreatorViewershipMetricsRequest request; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetCreatorViewershipMetricsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetCreatorViewershipMetricsRequestBuilder request(GetCreatorViewershipMetricsRequest request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetCreatorViewershipMetrics.Async(sdkConfiguration, _headers); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetCreatorViewershipMetricsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetCreatorViewershipMetricsResponse.java new file mode 100644 index 00000000..62a1778a --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetCreatorViewershipMetricsResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.ViewershipMetric; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetCreatorViewershipMetricsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * A list of Metric objects + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetCreatorViewershipMetricsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetCreatorViewershipMetricsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * A list of Metric objects + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetCreatorViewershipMetricsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetCreatorViewershipMetricsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetCreatorViewershipMetricsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * A list of Metric objects + */ + public GetCreatorViewershipMetricsResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * A list of Metric objects + */ + public GetCreatorViewershipMetricsResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetCreatorViewershipMetricsResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetCreatorViewershipMetricsResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetCreatorViewershipMetricsResponse other = (GetCreatorViewershipMetricsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetCreatorViewershipMetricsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * A list of Metric objects + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * A list of Metric objects + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetCreatorViewershipMetricsResponse build() { + + return new GetCreatorViewershipMetricsResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetRequestBuilder.java new file mode 100644 index 00000000..904f6e01 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetMultistreamTargetRequest; +import studio.livepeer.livepeer.operations.GetMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetMultistreamTargetRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetMultistreamTargetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetMultistreamTargetRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private GetMultistreamTargetRequest buildRequest() { + + GetMultistreamTargetRequest request = new GetMultistreamTargetRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetMultistreamTarget.Async(sdkConfiguration, _headers); + GetMultistreamTargetRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetResponse.java new file mode 100644 index 00000000..6ba9e072 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.MultistreamTarget; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetMultistreamTargetResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional multistreamTarget; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetMultistreamTargetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional multistreamTarget, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.multistreamTarget = multistreamTarget; + this.error = error; + } + + public GetMultistreamTargetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional multistreamTarget() { + return (Optional) multistreamTarget; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetMultistreamTargetResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetMultistreamTargetResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetMultistreamTargetResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetMultistreamTargetResponse withMultistreamTarget(MultistreamTarget multistreamTarget) { + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + this.multistreamTarget = Optional.ofNullable(multistreamTarget); + return this; + } + + + /** + * Success + */ + public GetMultistreamTargetResponse withMultistreamTarget(Optional multistreamTarget) { + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + this.multistreamTarget = multistreamTarget; + return this; + } + + /** + * Error + */ + public GetMultistreamTargetResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetMultistreamTargetResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetMultistreamTargetResponse other = (GetMultistreamTargetResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.multistreamTarget, other.multistreamTarget) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + multistreamTarget, error); + } + + @Override + public String toString() { + return Utils.toString(GetMultistreamTargetResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "multistreamTarget", multistreamTarget, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional multistreamTarget = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder multistreamTarget(MultistreamTarget multistreamTarget) { + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + this.multistreamTarget = Optional.ofNullable(multistreamTarget); + return this; + } + + /** + * Success + */ + public Builder multistreamTarget(Optional multistreamTarget) { + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + this.multistreamTarget = multistreamTarget; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetMultistreamTargetResponse build() { + + return new GetMultistreamTargetResponse( + contentType, statusCode, rawResponse, + multistreamTarget, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetsRequestBuilder.java new file mode 100644 index 00000000..82f35259 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetsRequestBuilder.java @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetMultistreamTargets; +import studio.livepeer.livepeer.utils.Headers; + +public class GetMultistreamTargetsRequestBuilder { + + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetMultistreamTargetsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CompletableFuture call() { + + AsyncRequestlessOperation operation + = new GetMultistreamTargets.Async(sdkConfiguration, _headers); + + return operation.doRequest() + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetsResponse.java new file mode 100644 index 00000000..c6495872 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetMultistreamTargetsResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.MultistreamTarget; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetMultistreamTargetsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetMultistreamTargetsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetMultistreamTargetsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetMultistreamTargetsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetMultistreamTargetsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetMultistreamTargetsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetMultistreamTargetsResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public GetMultistreamTargetsResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetMultistreamTargetsResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetMultistreamTargetsResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetMultistreamTargetsResponse other = (GetMultistreamTargetsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetMultistreamTargetsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetMultistreamTargetsResponse build() { + + return new GetMultistreamTargetsResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetPlaybackInfoRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetPlaybackInfoRequestBuilder.java new file mode 100644 index 00000000..5c4029e2 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetPlaybackInfoRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetPlaybackInfoRequest; +import studio.livepeer.livepeer.operations.GetPlaybackInfo; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetPlaybackInfoRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetPlaybackInfoRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetPlaybackInfoRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private GetPlaybackInfoRequest buildRequest() { + + GetPlaybackInfoRequest request = new GetPlaybackInfoRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetPlaybackInfo.Async(sdkConfiguration, _headers); + GetPlaybackInfoRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetPlaybackInfoResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetPlaybackInfoResponse.java new file mode 100644 index 00000000..4d2d1db1 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetPlaybackInfoResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.PlaybackInfo; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetPlaybackInfoResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful response + */ + private Optional playbackInfo; + + /** + * Playback not found + */ + private Optional error; + + @JsonCreator + public GetPlaybackInfoResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional playbackInfo, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(playbackInfo, "playbackInfo"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.playbackInfo = playbackInfo; + this.error = error; + } + + public GetPlaybackInfoResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional playbackInfo() { + return (Optional) playbackInfo; + } + + /** + * Playback not found + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetPlaybackInfoResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetPlaybackInfoResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetPlaybackInfoResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful response + */ + public GetPlaybackInfoResponse withPlaybackInfo(PlaybackInfo playbackInfo) { + Utils.checkNotNull(playbackInfo, "playbackInfo"); + this.playbackInfo = Optional.ofNullable(playbackInfo); + return this; + } + + + /** + * Successful response + */ + public GetPlaybackInfoResponse withPlaybackInfo(Optional playbackInfo) { + Utils.checkNotNull(playbackInfo, "playbackInfo"); + this.playbackInfo = playbackInfo; + return this; + } + + /** + * Playback not found + */ + public GetPlaybackInfoResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Playback not found + */ + public GetPlaybackInfoResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetPlaybackInfoResponse other = (GetPlaybackInfoResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.playbackInfo, other.playbackInfo) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + playbackInfo, error); + } + + @Override + public String toString() { + return Utils.toString(GetPlaybackInfoResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "playbackInfo", playbackInfo, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional playbackInfo = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Successful response + */ + public Builder playbackInfo(PlaybackInfo playbackInfo) { + Utils.checkNotNull(playbackInfo, "playbackInfo"); + this.playbackInfo = Optional.ofNullable(playbackInfo); + return this; + } + + /** + * Successful response + */ + public Builder playbackInfo(Optional playbackInfo) { + Utils.checkNotNull(playbackInfo, "playbackInfo"); + this.playbackInfo = playbackInfo; + return this; + } + + + /** + * Playback not found + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Playback not found + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetPlaybackInfoResponse build() { + + return new GetPlaybackInfoResponse( + contentType, statusCode, rawResponse, + playbackInfo, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetPublicViewershipMetricsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetPublicViewershipMetricsRequestBuilder.java new file mode 100644 index 00000000..1356b426 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetPublicViewershipMetricsRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsRequest; +import studio.livepeer.livepeer.operations.GetPublicViewershipMetrics; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetPublicViewershipMetricsRequestBuilder { + + private String playbackId; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetPublicViewershipMetricsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetPublicViewershipMetricsRequestBuilder playbackId(String playbackId) { + Utils.checkNotNull(playbackId, "playbackId"); + this.playbackId = playbackId; + return this; + } + + + private GetPublicViewershipMetricsRequest buildRequest() { + + GetPublicViewershipMetricsRequest request = new GetPublicViewershipMetricsRequest(playbackId); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetPublicViewershipMetrics.Async(sdkConfiguration, _headers); + GetPublicViewershipMetricsRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetPublicViewershipMetricsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetPublicViewershipMetricsResponse.java new file mode 100644 index 00000000..bd9ad03f --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetPublicViewershipMetricsResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsData; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetPublicViewershipMetricsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * A single Metric object with the viewCount and playtimeMins metrics. + */ + private Optional data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetPublicViewershipMetricsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetPublicViewershipMetricsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * A single Metric object with the viewCount and playtimeMins metrics. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional data() { + return (Optional) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetPublicViewershipMetricsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetPublicViewershipMetricsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetPublicViewershipMetricsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * A single Metric object with the viewCount and playtimeMins metrics. + */ + public GetPublicViewershipMetricsResponse withData(GetPublicViewershipMetricsData data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * A single Metric object with the viewCount and playtimeMins metrics. + */ + public GetPublicViewershipMetricsResponse withData(Optional data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetPublicViewershipMetricsResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetPublicViewershipMetricsResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetPublicViewershipMetricsResponse other = (GetPublicViewershipMetricsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetPublicViewershipMetricsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * A single Metric object with the viewCount and playtimeMins metrics. + */ + public Builder data(GetPublicViewershipMetricsData data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * A single Metric object with the viewCount and playtimeMins metrics. + */ + public Builder data(Optional data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetPublicViewershipMetricsResponse build() { + + return new GetPublicViewershipMetricsResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRealtimeViewershipNowRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRealtimeViewershipNowRequestBuilder.java new file mode 100644 index 00000000..b544de99 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRealtimeViewershipNowRequestBuilder.java @@ -0,0 +1,86 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.BreakdownBy; +import studio.livepeer.livepeer.models.operations.GetRealtimeViewershipNowRequest; +import studio.livepeer.livepeer.operations.GetRealtimeViewershipNow; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetRealtimeViewershipNowRequestBuilder { + + private Optional playbackId = Optional.empty(); + private Optional creatorId = Optional.empty(); + private Optional> breakdownBy = Optional.empty(); + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetRealtimeViewershipNowRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetRealtimeViewershipNowRequestBuilder playbackId(String playbackId) { + Utils.checkNotNull(playbackId, "playbackId"); + this.playbackId = Optional.of(playbackId); + return this; + } + + public GetRealtimeViewershipNowRequestBuilder playbackId(Optional playbackId) { + Utils.checkNotNull(playbackId, "playbackId"); + this.playbackId = playbackId; + return this; + } + + public GetRealtimeViewershipNowRequestBuilder creatorId(String creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = Optional.of(creatorId); + return this; + } + + public GetRealtimeViewershipNowRequestBuilder creatorId(Optional creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = creatorId; + return this; + } + + public GetRealtimeViewershipNowRequestBuilder breakdownBy(List breakdownBy) { + Utils.checkNotNull(breakdownBy, "breakdownBy"); + this.breakdownBy = Optional.of(breakdownBy); + return this; + } + + public GetRealtimeViewershipNowRequestBuilder breakdownBy(Optional> breakdownBy) { + Utils.checkNotNull(breakdownBy, "breakdownBy"); + this.breakdownBy = breakdownBy; + return this; + } + + + private GetRealtimeViewershipNowRequest buildRequest() { + + GetRealtimeViewershipNowRequest request = new GetRealtimeViewershipNowRequest(playbackId, + creatorId, + breakdownBy); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetRealtimeViewershipNow.Async(sdkConfiguration, _headers); + GetRealtimeViewershipNowRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRealtimeViewershipNowResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRealtimeViewershipNowResponse.java new file mode 100644 index 00000000..4e57fd63 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRealtimeViewershipNowResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.RealtimeViewershipMetric; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetRealtimeViewershipNowResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * A list of Metric objects + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetRealtimeViewershipNowResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetRealtimeViewershipNowResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * A list of Metric objects + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetRealtimeViewershipNowResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetRealtimeViewershipNowResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetRealtimeViewershipNowResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * A list of Metric objects + */ + public GetRealtimeViewershipNowResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * A list of Metric objects + */ + public GetRealtimeViewershipNowResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetRealtimeViewershipNowResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetRealtimeViewershipNowResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetRealtimeViewershipNowResponse other = (GetRealtimeViewershipNowResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetRealtimeViewershipNowResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * A list of Metric objects + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * A list of Metric objects + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetRealtimeViewershipNowResponse build() { + + return new GetRealtimeViewershipNowResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRecordedSessionsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRecordedSessionsRequestBuilder.java new file mode 100644 index 00000000..6d052626 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRecordedSessionsRequestBuilder.java @@ -0,0 +1,65 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetRecordedSessionsRequest; +import studio.livepeer.livepeer.models.operations.Record; +import studio.livepeer.livepeer.operations.GetRecordedSessions; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetRecordedSessionsRequestBuilder { + + private String parentId; + private Optional record = Optional.empty(); + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetRecordedSessionsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetRecordedSessionsRequestBuilder parentId(String parentId) { + Utils.checkNotNull(parentId, "parentId"); + this.parentId = parentId; + return this; + } + + public GetRecordedSessionsRequestBuilder record(Record record) { + Utils.checkNotNull(record, "record"); + this.record = Optional.of(record); + return this; + } + + public GetRecordedSessionsRequestBuilder record(Optional record) { + Utils.checkNotNull(record, "record"); + this.record = record; + return this; + } + + + private GetRecordedSessionsRequest buildRequest() { + + GetRecordedSessionsRequest request = new GetRecordedSessionsRequest(parentId, + record); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetRecordedSessions.Async(sdkConfiguration, _headers); + GetRecordedSessionsRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRecordedSessionsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRecordedSessionsResponse.java new file mode 100644 index 00000000..20a5b942 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRecordedSessionsResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Session; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetRecordedSessionsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetRecordedSessionsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetRecordedSessionsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetRecordedSessionsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetRecordedSessionsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetRecordedSessionsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetRecordedSessionsResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public GetRecordedSessionsResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetRecordedSessionsResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetRecordedSessionsResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetRecordedSessionsResponse other = (GetRecordedSessionsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetRecordedSessionsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetRecordedSessionsResponse build() { + + return new GetRecordedSessionsResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomRequestBuilder.java new file mode 100644 index 00000000..ca110241 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetRoomRequest; +import studio.livepeer.livepeer.operations.GetRoom; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetRoomRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetRoomRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetRoomRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private GetRoomRequest buildRequest() { + + GetRoomRequest request = new GetRoomRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetRoom.Async(sdkConfiguration, _headers); + GetRoomRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomResponse.java new file mode 100644 index 00000000..c12eab89 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Room; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetRoomResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional room; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetRoomResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional room, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(room, "room"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.room = room; + this.error = error; + } + + public GetRoomResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional room() { + return (Optional) room; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetRoomResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetRoomResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetRoomResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetRoomResponse withRoom(Room room) { + Utils.checkNotNull(room, "room"); + this.room = Optional.ofNullable(room); + return this; + } + + + /** + * Success + */ + public GetRoomResponse withRoom(Optional room) { + Utils.checkNotNull(room, "room"); + this.room = room; + return this; + } + + /** + * Error + */ + public GetRoomResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetRoomResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetRoomResponse other = (GetRoomResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.room, other.room) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + room, error); + } + + @Override + public String toString() { + return Utils.toString(GetRoomResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "room", room, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional room = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder room(Room room) { + Utils.checkNotNull(room, "room"); + this.room = Optional.ofNullable(room); + return this; + } + + /** + * Success + */ + public Builder room(Optional room) { + Utils.checkNotNull(room, "room"); + this.room = room; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetRoomResponse build() { + + return new GetRoomResponse( + contentType, statusCode, rawResponse, + room, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomUserRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomUserRequestBuilder.java new file mode 100644 index 00000000..296ff40e --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomUserRequestBuilder.java @@ -0,0 +1,57 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetRoomUserRequest; +import studio.livepeer.livepeer.operations.GetRoomUser; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetRoomUserRequestBuilder { + + private String id; + private String userId; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetRoomUserRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetRoomUserRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public GetRoomUserRequestBuilder userId(String userId) { + Utils.checkNotNull(userId, "userId"); + this.userId = userId; + return this; + } + + + private GetRoomUserRequest buildRequest() { + + GetRoomUserRequest request = new GetRoomUserRequest(id, + userId); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetRoomUser.Async(sdkConfiguration, _headers); + GetRoomUserRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomUserResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomUserResponse.java new file mode 100644 index 00000000..efd271d6 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetRoomUserResponse.java @@ -0,0 +1,312 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetRoomUserResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional getRoomUserResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetRoomUserResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional getRoomUserResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(getRoomUserResponse, "getRoomUserResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.getRoomUserResponse = getRoomUserResponse; + this.error = error; + } + + public GetRoomUserResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional getRoomUserResponse() { + return (Optional) getRoomUserResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetRoomUserResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetRoomUserResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetRoomUserResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetRoomUserResponse withGetRoomUserResponse(studio.livepeer.livepeer.models.components.GetRoomUserResponse getRoomUserResponse) { + Utils.checkNotNull(getRoomUserResponse, "getRoomUserResponse"); + this.getRoomUserResponse = Optional.ofNullable(getRoomUserResponse); + return this; + } + + + /** + * Success + */ + public GetRoomUserResponse withGetRoomUserResponse(Optional getRoomUserResponse) { + Utils.checkNotNull(getRoomUserResponse, "getRoomUserResponse"); + this.getRoomUserResponse = getRoomUserResponse; + return this; + } + + /** + * Error + */ + public GetRoomUserResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetRoomUserResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetRoomUserResponse other = (GetRoomUserResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.getRoomUserResponse, other.getRoomUserResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + getRoomUserResponse, error); + } + + @Override + public String toString() { + return Utils.toString(GetRoomUserResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "getRoomUserResponse", getRoomUserResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional getRoomUserResponse = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder getRoomUserResponse(studio.livepeer.livepeer.models.components.GetRoomUserResponse getRoomUserResponse) { + Utils.checkNotNull(getRoomUserResponse, "getRoomUserResponse"); + this.getRoomUserResponse = Optional.ofNullable(getRoomUserResponse); + return this; + } + + /** + * Success + */ + public Builder getRoomUserResponse(Optional getRoomUserResponse) { + Utils.checkNotNull(getRoomUserResponse, "getRoomUserResponse"); + this.getRoomUserResponse = getRoomUserResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetRoomUserResponse build() { + + return new GetRoomUserResponse( + contentType, statusCode, rawResponse, + getRoomUserResponse, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionClipsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionClipsRequestBuilder.java new file mode 100644 index 00000000..398b3753 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionClipsRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetSessionClipsRequest; +import studio.livepeer.livepeer.operations.GetSessionClips; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetSessionClipsRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetSessionClipsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetSessionClipsRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private GetSessionClipsRequest buildRequest() { + + GetSessionClipsRequest request = new GetSessionClipsRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetSessionClips.Async(sdkConfiguration, _headers); + GetSessionClipsRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionClipsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionClipsResponse.java new file mode 100644 index 00000000..64144a41 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionClipsResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Asset; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetSessionClipsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetSessionClipsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetSessionClipsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetSessionClipsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetSessionClipsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetSessionClipsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetSessionClipsResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public GetSessionClipsResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetSessionClipsResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetSessionClipsResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSessionClipsResponse other = (GetSessionClipsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetSessionClipsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetSessionClipsResponse build() { + + return new GetSessionClipsResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionRequestBuilder.java new file mode 100644 index 00000000..f7de12d5 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetSessionRequest; +import studio.livepeer.livepeer.operations.GetSession; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetSessionRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetSessionRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetSessionRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private GetSessionRequest buildRequest() { + + GetSessionRequest request = new GetSessionRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetSession.Async(sdkConfiguration, _headers); + GetSessionRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionResponse.java new file mode 100644 index 00000000..ef3cb972 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Session; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetSessionResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional session; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetSessionResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional session, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(session, "session"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.session = session; + this.error = error; + } + + public GetSessionResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional session() { + return (Optional) session; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetSessionResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetSessionResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetSessionResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetSessionResponse withSession(Session session) { + Utils.checkNotNull(session, "session"); + this.session = Optional.ofNullable(session); + return this; + } + + + /** + * Success + */ + public GetSessionResponse withSession(Optional session) { + Utils.checkNotNull(session, "session"); + this.session = session; + return this; + } + + /** + * Error + */ + public GetSessionResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetSessionResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSessionResponse other = (GetSessionResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.session, other.session) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + session, error); + } + + @Override + public String toString() { + return Utils.toString(GetSessionResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "session", session, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional session = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder session(Session session) { + Utils.checkNotNull(session, "session"); + this.session = Optional.ofNullable(session); + return this; + } + + /** + * Success + */ + public Builder session(Optional session) { + Utils.checkNotNull(session, "session"); + this.session = session; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetSessionResponse build() { + + return new GetSessionResponse( + contentType, statusCode, rawResponse, + session, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionsRequestBuilder.java new file mode 100644 index 00000000..4c0f46d5 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionsRequestBuilder.java @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetSessions; +import studio.livepeer.livepeer.utils.Headers; + +public class GetSessionsRequestBuilder { + + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetSessionsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CompletableFuture call() { + + AsyncRequestlessOperation operation + = new GetSessions.Async(sdkConfiguration, _headers); + + return operation.doRequest() + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionsResponse.java new file mode 100644 index 00000000..ec4a24e6 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSessionsResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Session; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetSessionsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetSessionsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetSessionsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetSessionsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetSessionsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetSessionsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetSessionsResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public GetSessionsResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetSessionsResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetSessionsResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSessionsResponse other = (GetSessionsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetSessionsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetSessionsResponse build() { + + return new GetSessionsResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeyRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeyRequestBuilder.java new file mode 100644 index 00000000..ef8f47d6 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeyRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetSigningKeyRequest; +import studio.livepeer.livepeer.operations.GetSigningKey; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetSigningKeyRequestBuilder { + + private String keyId; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetSigningKeyRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetSigningKeyRequestBuilder keyId(String keyId) { + Utils.checkNotNull(keyId, "keyId"); + this.keyId = keyId; + return this; + } + + + private GetSigningKeyRequest buildRequest() { + + GetSigningKeyRequest request = new GetSigningKeyRequest(keyId); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetSigningKey.Async(sdkConfiguration, _headers); + GetSigningKeyRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeyResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeyResponse.java new file mode 100644 index 00000000..a14f3e17 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeyResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.SigningKey; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetSigningKeyResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional signingKey; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetSigningKeyResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional signingKey, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(signingKey, "signingKey"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.signingKey = signingKey; + this.error = error; + } + + public GetSigningKeyResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional signingKey() { + return (Optional) signingKey; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetSigningKeyResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetSigningKeyResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetSigningKeyResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetSigningKeyResponse withSigningKey(SigningKey signingKey) { + Utils.checkNotNull(signingKey, "signingKey"); + this.signingKey = Optional.ofNullable(signingKey); + return this; + } + + + /** + * Success + */ + public GetSigningKeyResponse withSigningKey(Optional signingKey) { + Utils.checkNotNull(signingKey, "signingKey"); + this.signingKey = signingKey; + return this; + } + + /** + * Error + */ + public GetSigningKeyResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetSigningKeyResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSigningKeyResponse other = (GetSigningKeyResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.signingKey, other.signingKey) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + signingKey, error); + } + + @Override + public String toString() { + return Utils.toString(GetSigningKeyResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "signingKey", signingKey, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional signingKey = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder signingKey(SigningKey signingKey) { + Utils.checkNotNull(signingKey, "signingKey"); + this.signingKey = Optional.ofNullable(signingKey); + return this; + } + + /** + * Success + */ + public Builder signingKey(Optional signingKey) { + Utils.checkNotNull(signingKey, "signingKey"); + this.signingKey = signingKey; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetSigningKeyResponse build() { + + return new GetSigningKeyResponse( + contentType, statusCode, rawResponse, + signingKey, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeysRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeysRequestBuilder.java new file mode 100644 index 00000000..513380a0 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeysRequestBuilder.java @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetSigningKeys; +import studio.livepeer.livepeer.utils.Headers; + +public class GetSigningKeysRequestBuilder { + + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetSigningKeysRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CompletableFuture call() { + + AsyncRequestlessOperation operation + = new GetSigningKeys.Async(sdkConfiguration, _headers); + + return operation.doRequest() + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeysResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeysResponse.java new file mode 100644 index 00000000..040e2a25 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetSigningKeysResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.SigningKey; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetSigningKeysResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetSigningKeysResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetSigningKeysResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetSigningKeysResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetSigningKeysResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetSigningKeysResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetSigningKeysResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public GetSigningKeysResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetSigningKeysResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetSigningKeysResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetSigningKeysResponse other = (GetSigningKeysResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetSigningKeysResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetSigningKeysResponse build() { + + return new GetSigningKeysResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamRequestBuilder.java new file mode 100644 index 00000000..6fd5243f --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetStreamRequest; +import studio.livepeer.livepeer.operations.GetStream; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetStreamRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetStreamRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetStreamRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private GetStreamRequest buildRequest() { + + GetStreamRequest request = new GetStreamRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetStream.Async(sdkConfiguration, _headers); + GetStreamRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamResponse.java new file mode 100644 index 00000000..29b9ac50 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Stream; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetStreamResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional stream; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetStreamResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional stream, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(stream, "stream"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.stream = stream; + this.error = error; + } + + public GetStreamResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional stream() { + return (Optional) stream; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetStreamResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetStreamResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetStreamResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetStreamResponse withStream(Stream stream) { + Utils.checkNotNull(stream, "stream"); + this.stream = Optional.ofNullable(stream); + return this; + } + + + /** + * Success + */ + public GetStreamResponse withStream(Optional stream) { + Utils.checkNotNull(stream, "stream"); + this.stream = stream; + return this; + } + + /** + * Error + */ + public GetStreamResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetStreamResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetStreamResponse other = (GetStreamResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.stream, other.stream) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + stream, error); + } + + @Override + public String toString() { + return Utils.toString(GetStreamResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "stream", stream, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional stream = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder stream(Stream stream) { + Utils.checkNotNull(stream, "stream"); + this.stream = Optional.ofNullable(stream); + return this; + } + + /** + * Success + */ + public Builder stream(Optional stream) { + Utils.checkNotNull(stream, "stream"); + this.stream = stream; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetStreamResponse build() { + + return new GetStreamResponse( + contentType, statusCode, rawResponse, + stream, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamsRequestBuilder.java new file mode 100644 index 00000000..6b7dd7c6 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamsRequestBuilder.java @@ -0,0 +1,56 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetStreamsRequest; +import studio.livepeer.livepeer.operations.GetStreams; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetStreamsRequestBuilder { + + private Optional streamsonly = Optional.empty(); + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetStreamsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetStreamsRequestBuilder streamsonly(String streamsonly) { + Utils.checkNotNull(streamsonly, "streamsonly"); + this.streamsonly = Optional.of(streamsonly); + return this; + } + + public GetStreamsRequestBuilder streamsonly(Optional streamsonly) { + Utils.checkNotNull(streamsonly, "streamsonly"); + this.streamsonly = streamsonly; + return this; + } + + + private GetStreamsRequest buildRequest() { + + GetStreamsRequest request = new GetStreamsRequest(streamsonly); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetStreams.Async(sdkConfiguration, _headers); + GetStreamsRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamsResponse.java new file mode 100644 index 00000000..5dc393f9 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetStreamsResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Stream; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetStreamsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetStreamsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetStreamsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetStreamsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetStreamsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetStreamsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetStreamsResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public GetStreamsResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetStreamsResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetStreamsResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetStreamsResponse other = (GetStreamsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetStreamsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetStreamsResponse build() { + + return new GetStreamsResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetTaskRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetTaskRequestBuilder.java new file mode 100644 index 00000000..1e415834 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetTaskRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetTaskRequest; +import studio.livepeer.livepeer.operations.GetTask; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetTaskRequestBuilder { + + private String taskId; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetTaskRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetTaskRequestBuilder taskId(String taskId) { + Utils.checkNotNull(taskId, "taskId"); + this.taskId = taskId; + return this; + } + + + private GetTaskRequest buildRequest() { + + GetTaskRequest request = new GetTaskRequest(taskId); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetTask.Async(sdkConfiguration, _headers); + GetTaskRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetTaskResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetTaskResponse.java new file mode 100644 index 00000000..f4c966b0 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetTaskResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Task; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetTaskResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional task; + + @JsonCreator + public GetTaskResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional task) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(task, "task"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.task = task; + } + + public GetTaskResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional task() { + return (Optional) task; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetTaskResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetTaskResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetTaskResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetTaskResponse withTask(Task task) { + Utils.checkNotNull(task, "task"); + this.task = Optional.ofNullable(task); + return this; + } + + + /** + * Success + */ + public GetTaskResponse withTask(Optional task) { + Utils.checkNotNull(task, "task"); + this.task = task; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTaskResponse other = (GetTaskResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.task, other.task); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + task); + } + + @Override + public String toString() { + return Utils.toString(GetTaskResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "task", task); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional task = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder task(Task task) { + Utils.checkNotNull(task, "task"); + this.task = Optional.ofNullable(task); + return this; + } + + /** + * Success + */ + public Builder task(Optional task) { + Utils.checkNotNull(task, "task"); + this.task = task; + return this; + } + + public GetTaskResponse build() { + + return new GetTaskResponse( + contentType, statusCode, rawResponse, + task); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetTasksRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetTasksRequestBuilder.java new file mode 100644 index 00000000..260a4a1f --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetTasksRequestBuilder.java @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetTasks; +import studio.livepeer.livepeer.utils.Headers; + +public class GetTasksRequestBuilder { + + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetTasksRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CompletableFuture call() { + + AsyncRequestlessOperation operation + = new GetTasks.Async(sdkConfiguration, _headers); + + return operation.doRequest() + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetTasksResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetTasksResponse.java new file mode 100644 index 00000000..34b10e14 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetTasksResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Task; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetTasksResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetTasksResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetTasksResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetTasksResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetTasksResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetTasksResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetTasksResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public GetTasksResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetTasksResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetTasksResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTasksResponse other = (GetTasksResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetTasksResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetTasksResponse build() { + + return new GetTasksResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetUsageMetricsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetUsageMetricsRequestBuilder.java new file mode 100644 index 00000000..43010516 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetUsageMetricsRequestBuilder.java @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetUsageMetricsRequest; +import studio.livepeer.livepeer.operations.GetUsageMetrics; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetUsageMetricsRequestBuilder { + + private GetUsageMetricsRequest request; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetUsageMetricsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetUsageMetricsRequestBuilder request(GetUsageMetricsRequest request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetUsageMetrics.Async(sdkConfiguration, _headers); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetUsageMetricsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetUsageMetricsResponse.java new file mode 100644 index 00000000..65ac9a2a --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetUsageMetricsResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.UsageMetric; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetUsageMetricsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * A Usage Metric object + */ + private Optional usageMetric; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetUsageMetricsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional usageMetric, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(usageMetric, "usageMetric"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.usageMetric = usageMetric; + this.error = error; + } + + public GetUsageMetricsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * A Usage Metric object + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional usageMetric() { + return (Optional) usageMetric; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetUsageMetricsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetUsageMetricsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetUsageMetricsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * A Usage Metric object + */ + public GetUsageMetricsResponse withUsageMetric(UsageMetric usageMetric) { + Utils.checkNotNull(usageMetric, "usageMetric"); + this.usageMetric = Optional.ofNullable(usageMetric); + return this; + } + + + /** + * A Usage Metric object + */ + public GetUsageMetricsResponse withUsageMetric(Optional usageMetric) { + Utils.checkNotNull(usageMetric, "usageMetric"); + this.usageMetric = usageMetric; + return this; + } + + /** + * Error + */ + public GetUsageMetricsResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetUsageMetricsResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUsageMetricsResponse other = (GetUsageMetricsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.usageMetric, other.usageMetric) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + usageMetric, error); + } + + @Override + public String toString() { + return Utils.toString(GetUsageMetricsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "usageMetric", usageMetric, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional usageMetric = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * A Usage Metric object + */ + public Builder usageMetric(UsageMetric usageMetric) { + Utils.checkNotNull(usageMetric, "usageMetric"); + this.usageMetric = Optional.ofNullable(usageMetric); + return this; + } + + /** + * A Usage Metric object + */ + public Builder usageMetric(Optional usageMetric) { + Utils.checkNotNull(usageMetric, "usageMetric"); + this.usageMetric = usageMetric; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetUsageMetricsResponse build() { + + return new GetUsageMetricsResponse( + contentType, statusCode, rawResponse, + usageMetric, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetViewershipMetricsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetViewershipMetricsRequestBuilder.java new file mode 100644 index 00000000..14fff025 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetViewershipMetricsRequestBuilder.java @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetViewershipMetricsRequest; +import studio.livepeer.livepeer.operations.GetViewershipMetrics; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetViewershipMetricsRequestBuilder { + + private GetViewershipMetricsRequest request; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetViewershipMetricsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetViewershipMetricsRequestBuilder request(GetViewershipMetricsRequest request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetViewershipMetrics.Async(sdkConfiguration, _headers); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetViewershipMetricsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetViewershipMetricsResponse.java new file mode 100644 index 00000000..36d8a657 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetViewershipMetricsResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.ViewershipMetric; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetViewershipMetricsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * A list of Metric objects + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetViewershipMetricsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetViewershipMetricsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * A list of Metric objects + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetViewershipMetricsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetViewershipMetricsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetViewershipMetricsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * A list of Metric objects + */ + public GetViewershipMetricsResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * A list of Metric objects + */ + public GetViewershipMetricsResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetViewershipMetricsResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetViewershipMetricsResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetViewershipMetricsResponse other = (GetViewershipMetricsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetViewershipMetricsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * A list of Metric objects + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * A list of Metric objects + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetViewershipMetricsResponse build() { + + return new GetViewershipMetricsResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogRequestBuilder.java new file mode 100644 index 00000000..b45de127 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogRequestBuilder.java @@ -0,0 +1,57 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetWebhookLogRequest; +import studio.livepeer.livepeer.operations.GetWebhookLog; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetWebhookLogRequestBuilder { + + private String id; + private String logId; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetWebhookLogRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetWebhookLogRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public GetWebhookLogRequestBuilder logId(String logId) { + Utils.checkNotNull(logId, "logId"); + this.logId = logId; + return this; + } + + + private GetWebhookLogRequest buildRequest() { + + GetWebhookLogRequest request = new GetWebhookLogRequest(id, + logId); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetWebhookLog.Async(sdkConfiguration, _headers); + GetWebhookLogRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogResponse.java new file mode 100644 index 00000000..7f196cfe --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.WebhookLog; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetWebhookLogResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional webhookLog; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetWebhookLogResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional webhookLog, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(webhookLog, "webhookLog"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.webhookLog = webhookLog; + this.error = error; + } + + public GetWebhookLogResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional webhookLog() { + return (Optional) webhookLog; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetWebhookLogResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetWebhookLogResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetWebhookLogResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetWebhookLogResponse withWebhookLog(WebhookLog webhookLog) { + Utils.checkNotNull(webhookLog, "webhookLog"); + this.webhookLog = Optional.ofNullable(webhookLog); + return this; + } + + + /** + * Success + */ + public GetWebhookLogResponse withWebhookLog(Optional webhookLog) { + Utils.checkNotNull(webhookLog, "webhookLog"); + this.webhookLog = webhookLog; + return this; + } + + /** + * Error + */ + public GetWebhookLogResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetWebhookLogResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWebhookLogResponse other = (GetWebhookLogResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.webhookLog, other.webhookLog) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + webhookLog, error); + } + + @Override + public String toString() { + return Utils.toString(GetWebhookLogResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "webhookLog", webhookLog, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional webhookLog = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder webhookLog(WebhookLog webhookLog) { + Utils.checkNotNull(webhookLog, "webhookLog"); + this.webhookLog = Optional.ofNullable(webhookLog); + return this; + } + + /** + * Success + */ + public Builder webhookLog(Optional webhookLog) { + Utils.checkNotNull(webhookLog, "webhookLog"); + this.webhookLog = webhookLog; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetWebhookLogResponse build() { + + return new GetWebhookLogResponse( + contentType, statusCode, rawResponse, + webhookLog, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogsRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogsRequestBuilder.java new file mode 100644 index 00000000..071dbc8a --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogsRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetWebhookLogsRequest; +import studio.livepeer.livepeer.operations.GetWebhookLogs; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetWebhookLogsRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetWebhookLogsRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetWebhookLogsRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private GetWebhookLogsRequest buildRequest() { + + GetWebhookLogsRequest request = new GetWebhookLogsRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetWebhookLogs.Async(sdkConfiguration, _headers); + GetWebhookLogsRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogsResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogsResponse.java new file mode 100644 index 00000000..7177b17c --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookLogsResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.WebhookLog; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetWebhookLogsResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetWebhookLogsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetWebhookLogsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetWebhookLogsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetWebhookLogsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetWebhookLogsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetWebhookLogsResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public GetWebhookLogsResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetWebhookLogsResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetWebhookLogsResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWebhookLogsResponse other = (GetWebhookLogsResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetWebhookLogsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetWebhookLogsResponse build() { + + return new GetWebhookLogsResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookRequestBuilder.java new file mode 100644 index 00000000..3df4ac5e --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.GetWebhookRequest; +import studio.livepeer.livepeer.operations.GetWebhook; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class GetWebhookRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetWebhookRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public GetWebhookRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private GetWebhookRequest buildRequest() { + + GetWebhookRequest request = new GetWebhookRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new GetWebhook.Async(sdkConfiguration, _headers); + GetWebhookRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookResponse.java new file mode 100644 index 00000000..972f4e62 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhookResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Webhook; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetWebhookResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional webhook; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetWebhookResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional webhook, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(webhook, "webhook"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.webhook = webhook; + this.error = error; + } + + public GetWebhookResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional webhook() { + return (Optional) webhook; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetWebhookResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetWebhookResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetWebhookResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetWebhookResponse withWebhook(Webhook webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = Optional.ofNullable(webhook); + return this; + } + + + /** + * Success + */ + public GetWebhookResponse withWebhook(Optional webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = webhook; + return this; + } + + /** + * Error + */ + public GetWebhookResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetWebhookResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWebhookResponse other = (GetWebhookResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.webhook, other.webhook) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + webhook, error); + } + + @Override + public String toString() { + return Utils.toString(GetWebhookResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "webhook", webhook, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional webhook = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder webhook(Webhook webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = Optional.ofNullable(webhook); + return this; + } + + /** + * Success + */ + public Builder webhook(Optional webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = webhook; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetWebhookResponse build() { + + return new GetWebhookResponse( + contentType, statusCode, rawResponse, + webhook, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhooksRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhooksRequestBuilder.java new file mode 100644 index 00000000..ae634d2b --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhooksRequestBuilder.java @@ -0,0 +1,30 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.operations.GetWebhooks; +import studio.livepeer.livepeer.utils.Headers; + +public class GetWebhooksRequestBuilder { + + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public GetWebhooksRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public CompletableFuture call() { + + AsyncRequestlessOperation operation + = new GetWebhooks.Async(sdkConfiguration, _headers); + + return operation.doRequest() + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhooksResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhooksResponse.java new file mode 100644 index 00000000..7696937b --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/GetWebhooksResponse.java @@ -0,0 +1,314 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Webhook; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetWebhooksResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional> data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public GetWebhooksResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional> data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public GetWebhooksResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional> data() { + return (Optional>) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public GetWebhooksResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetWebhooksResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetWebhooksResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public GetWebhooksResponse withData(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public GetWebhooksResponse withData(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public GetWebhooksResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public GetWebhooksResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetWebhooksResponse other = (GetWebhooksResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(GetWebhooksResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional> data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(List data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional> data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public GetWebhooksResponse build() { + + return new GetWebhooksResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/RemoveMultistreamTargetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/RemoveMultistreamTargetRequestBuilder.java new file mode 100644 index 00000000..eabbef6e --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/RemoveMultistreamTargetRequestBuilder.java @@ -0,0 +1,57 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.RemoveMultistreamTargetRequest; +import studio.livepeer.livepeer.operations.RemoveMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class RemoveMultistreamTargetRequestBuilder { + + private String id; + private String targetId; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public RemoveMultistreamTargetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public RemoveMultistreamTargetRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public RemoveMultistreamTargetRequestBuilder targetId(String targetId) { + Utils.checkNotNull(targetId, "targetId"); + this.targetId = targetId; + return this; + } + + + private RemoveMultistreamTargetRequest buildRequest() { + + RemoveMultistreamTargetRequest request = new RemoveMultistreamTargetRequest(id, + targetId); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new RemoveMultistreamTarget.Async(sdkConfiguration, _headers); + RemoveMultistreamTargetRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/RemoveMultistreamTargetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/RemoveMultistreamTargetResponse.java new file mode 100644 index 00000000..5c12d1a6 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/RemoveMultistreamTargetResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class RemoveMultistreamTargetResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public RemoveMultistreamTargetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public RemoveMultistreamTargetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public RemoveMultistreamTargetResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public RemoveMultistreamTargetResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public RemoveMultistreamTargetResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public RemoveMultistreamTargetResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public RemoveMultistreamTargetResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RemoveMultistreamTargetResponse other = (RemoveMultistreamTargetResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(RemoveMultistreamTargetResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public RemoveMultistreamTargetResponse build() { + + return new RemoveMultistreamTargetResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/RequestUploadRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/RequestUploadRequestBuilder.java new file mode 100644 index 00000000..1430dcc2 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/RequestUploadRequestBuilder.java @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.NewAssetPayload; +import studio.livepeer.livepeer.operations.RequestUpload; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class RequestUploadRequestBuilder { + + private NewAssetPayload request; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public RequestUploadRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public RequestUploadRequestBuilder request(NewAssetPayload request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new RequestUpload.Async(sdkConfiguration, _headers); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/RequestUploadResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/RequestUploadResponse.java new file mode 100644 index 00000000..8d6dde13 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/RequestUploadResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.operations.RequestUploadData; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class RequestUploadResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional data; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public RequestUploadResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional data, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(data, "data"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.data = data; + this.error = error; + } + + public RequestUploadResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional data() { + return (Optional) data; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public RequestUploadResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public RequestUploadResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public RequestUploadResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public RequestUploadResponse withData(RequestUploadData data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + + /** + * Success + */ + public RequestUploadResponse withData(Optional data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + /** + * Error + */ + public RequestUploadResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public RequestUploadResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequestUploadResponse other = (RequestUploadResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + data, error); + } + + @Override + public String toString() { + return Utils.toString(RequestUploadResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "data", data, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional data = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder data(RequestUploadData data) { + Utils.checkNotNull(data, "data"); + this.data = Optional.ofNullable(data); + return this; + } + + /** + * Success + */ + public Builder data(Optional data) { + Utils.checkNotNull(data, "data"); + this.data = data; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public RequestUploadResponse build() { + + return new RequestUploadResponse( + contentType, statusCode, rawResponse, + data, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/ResendWebhookRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/ResendWebhookRequestBuilder.java new file mode 100644 index 00000000..d08733a7 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/ResendWebhookRequestBuilder.java @@ -0,0 +1,57 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.ResendWebhookRequest; +import studio.livepeer.livepeer.operations.ResendWebhook; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class ResendWebhookRequestBuilder { + + private String id; + private String logId; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public ResendWebhookRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public ResendWebhookRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public ResendWebhookRequestBuilder logId(String logId) { + Utils.checkNotNull(logId, "logId"); + this.logId = logId; + return this; + } + + + private ResendWebhookRequest buildRequest() { + + ResendWebhookRequest request = new ResendWebhookRequest(id, + logId); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new ResendWebhook.Async(sdkConfiguration, _headers); + ResendWebhookRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/ResendWebhookResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/ResendWebhookResponse.java new file mode 100644 index 00000000..791407ec --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/ResendWebhookResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.WebhookLog; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class ResendWebhookResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional webhookLog; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public ResendWebhookResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional webhookLog, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(webhookLog, "webhookLog"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.webhookLog = webhookLog; + this.error = error; + } + + public ResendWebhookResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional webhookLog() { + return (Optional) webhookLog; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public ResendWebhookResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public ResendWebhookResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public ResendWebhookResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public ResendWebhookResponse withWebhookLog(WebhookLog webhookLog) { + Utils.checkNotNull(webhookLog, "webhookLog"); + this.webhookLog = Optional.ofNullable(webhookLog); + return this; + } + + + /** + * Success + */ + public ResendWebhookResponse withWebhookLog(Optional webhookLog) { + Utils.checkNotNull(webhookLog, "webhookLog"); + this.webhookLog = webhookLog; + return this; + } + + /** + * Error + */ + public ResendWebhookResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public ResendWebhookResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResendWebhookResponse other = (ResendWebhookResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.webhookLog, other.webhookLog) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + webhookLog, error); + } + + @Override + public String toString() { + return Utils.toString(ResendWebhookResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "webhookLog", webhookLog, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional webhookLog = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder webhookLog(WebhookLog webhookLog) { + Utils.checkNotNull(webhookLog, "webhookLog"); + this.webhookLog = Optional.ofNullable(webhookLog); + return this; + } + + /** + * Success + */ + public Builder webhookLog(Optional webhookLog) { + Utils.checkNotNull(webhookLog, "webhookLog"); + this.webhookLog = webhookLog; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public ResendWebhookResponse build() { + + return new ResendWebhookResponse( + contentType, statusCode, rawResponse, + webhookLog, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/StartPullStreamRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/StartPullStreamRequestBuilder.java new file mode 100644 index 00000000..4611337b --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/StartPullStreamRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.StartPullStreamRequest; +import studio.livepeer.livepeer.operations.StartPullStream; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class StartPullStreamRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public StartPullStreamRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public StartPullStreamRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private StartPullStreamRequest buildRequest() { + + StartPullStreamRequest request = new StartPullStreamRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new StartPullStream.Async(sdkConfiguration, _headers); + StartPullStreamRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/StartPullStreamResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/StartPullStreamResponse.java new file mode 100644 index 00000000..5ca8a876 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/StartPullStreamResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class StartPullStreamResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public StartPullStreamResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public StartPullStreamResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public StartPullStreamResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public StartPullStreamResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public StartPullStreamResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public StartPullStreamResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public StartPullStreamResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StartPullStreamResponse other = (StartPullStreamResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(StartPullStreamResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public StartPullStreamResponse build() { + + return new StartPullStreamResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/StartRoomEgressRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/StartRoomEgressRequestBuilder.java new file mode 100644 index 00000000..0cf374dd --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/StartRoomEgressRequestBuilder.java @@ -0,0 +1,58 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.RoomEgressPayload; +import studio.livepeer.livepeer.models.operations.StartRoomEgressRequest; +import studio.livepeer.livepeer.operations.StartRoomEgress; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class StartRoomEgressRequestBuilder { + + private String id; + private RoomEgressPayload roomEgressPayload; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public StartRoomEgressRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public StartRoomEgressRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public StartRoomEgressRequestBuilder roomEgressPayload(RoomEgressPayload roomEgressPayload) { + Utils.checkNotNull(roomEgressPayload, "roomEgressPayload"); + this.roomEgressPayload = roomEgressPayload; + return this; + } + + + private StartRoomEgressRequest buildRequest() { + + StartRoomEgressRequest request = new StartRoomEgressRequest(id, + roomEgressPayload); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new StartRoomEgress.Async(sdkConfiguration, _headers); + StartRoomEgressRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/StartRoomEgressResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/StartRoomEgressResponse.java new file mode 100644 index 00000000..1d4efb14 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/StartRoomEgressResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class StartRoomEgressResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public StartRoomEgressResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public StartRoomEgressResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public StartRoomEgressResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public StartRoomEgressResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public StartRoomEgressResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public StartRoomEgressResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public StartRoomEgressResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StartRoomEgressResponse other = (StartRoomEgressResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(StartRoomEgressResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public StartRoomEgressResponse build() { + + return new StartRoomEgressResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/StopRoomEgressRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/StopRoomEgressRequestBuilder.java new file mode 100644 index 00000000..b78282b8 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/StopRoomEgressRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.StopRoomEgressRequest; +import studio.livepeer.livepeer.operations.StopRoomEgress; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class StopRoomEgressRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public StopRoomEgressRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public StopRoomEgressRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private StopRoomEgressRequest buildRequest() { + + StopRoomEgressRequest request = new StopRoomEgressRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new StopRoomEgress.Async(sdkConfiguration, _headers); + StopRoomEgressRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/StopRoomEgressResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/StopRoomEgressResponse.java new file mode 100644 index 00000000..56f06bb3 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/StopRoomEgressResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class StopRoomEgressResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public StopRoomEgressResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public StopRoomEgressResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public StopRoomEgressResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public StopRoomEgressResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public StopRoomEgressResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public StopRoomEgressResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public StopRoomEgressResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StopRoomEgressResponse other = (StopRoomEgressResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(StopRoomEgressResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public StopRoomEgressResponse build() { + + return new StopRoomEgressResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/TerminateStreamRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/TerminateStreamRequestBuilder.java new file mode 100644 index 00000000..7b840cca --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/TerminateStreamRequestBuilder.java @@ -0,0 +1,49 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.TerminateStreamRequest; +import studio.livepeer.livepeer.operations.TerminateStream; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class TerminateStreamRequestBuilder { + + private String id; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public TerminateStreamRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public TerminateStreamRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + + private TerminateStreamRequest buildRequest() { + + TerminateStreamRequest request = new TerminateStreamRequest(id); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new TerminateStream.Async(sdkConfiguration, _headers); + TerminateStreamRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/TerminateStreamResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/TerminateStreamResponse.java new file mode 100644 index 00000000..732218b8 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/TerminateStreamResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class TerminateStreamResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public TerminateStreamResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public TerminateStreamResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public TerminateStreamResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public TerminateStreamResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public TerminateStreamResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public TerminateStreamResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public TerminateStreamResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TerminateStreamResponse other = (TerminateStreamResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(TerminateStreamResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public TerminateStreamResponse build() { + + return new TerminateStreamResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/TranscodeVideoRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/TranscodeVideoRequestBuilder.java new file mode 100644 index 00000000..d8f3bd11 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/TranscodeVideoRequestBuilder.java @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.TranscodePayload; +import studio.livepeer.livepeer.operations.TranscodeVideo; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class TranscodeVideoRequestBuilder { + + private TranscodePayload request; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public TranscodeVideoRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public TranscodeVideoRequestBuilder request(TranscodePayload request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new TranscodeVideo.Async(sdkConfiguration, _headers); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/TranscodeVideoResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/TranscodeVideoResponse.java new file mode 100644 index 00000000..fdeee11a --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/TranscodeVideoResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Task; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class TranscodeVideoResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional task; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public TranscodeVideoResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional task, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(task, "task"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.task = task; + this.error = error; + } + + public TranscodeVideoResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional task() { + return (Optional) task; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public TranscodeVideoResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public TranscodeVideoResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public TranscodeVideoResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public TranscodeVideoResponse withTask(Task task) { + Utils.checkNotNull(task, "task"); + this.task = Optional.ofNullable(task); + return this; + } + + + /** + * Success + */ + public TranscodeVideoResponse withTask(Optional task) { + Utils.checkNotNull(task, "task"); + this.task = task; + return this; + } + + /** + * Error + */ + public TranscodeVideoResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public TranscodeVideoResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TranscodeVideoResponse other = (TranscodeVideoResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.task, other.task) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + task, error); + } + + @Override + public String toString() { + return Utils.toString(TranscodeVideoResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "task", task, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional task = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder task(Task task) { + Utils.checkNotNull(task, "task"); + this.task = Optional.ofNullable(task); + return this; + } + + /** + * Success + */ + public Builder task(Optional task) { + Utils.checkNotNull(task, "task"); + this.task = task; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public TranscodeVideoResponse build() { + + return new TranscodeVideoResponse( + contentType, statusCode, rawResponse, + task, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateAssetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateAssetRequestBuilder.java new file mode 100644 index 00000000..a0fff6e5 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateAssetRequestBuilder.java @@ -0,0 +1,58 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.AssetPatchPayload; +import studio.livepeer.livepeer.models.operations.UpdateAssetRequest; +import studio.livepeer.livepeer.operations.UpdateAsset; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class UpdateAssetRequestBuilder { + + private String assetId; + private AssetPatchPayload assetPatchPayload; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public UpdateAssetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public UpdateAssetRequestBuilder assetId(String assetId) { + Utils.checkNotNull(assetId, "assetId"); + this.assetId = assetId; + return this; + } + + public UpdateAssetRequestBuilder assetPatchPayload(AssetPatchPayload assetPatchPayload) { + Utils.checkNotNull(assetPatchPayload, "assetPatchPayload"); + this.assetPatchPayload = assetPatchPayload; + return this; + } + + + private UpdateAssetRequest buildRequest() { + + UpdateAssetRequest request = new UpdateAssetRequest(assetId, + assetPatchPayload); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new UpdateAsset.Async(sdkConfiguration, _headers); + UpdateAssetRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateAssetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateAssetResponse.java new file mode 100644 index 00000000..e37b4f5b --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateAssetResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Asset; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class UpdateAssetResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional asset; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public UpdateAssetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional asset, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(asset, "asset"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.asset = asset; + this.error = error; + } + + public UpdateAssetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional asset() { + return (Optional) asset; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public UpdateAssetResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public UpdateAssetResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public UpdateAssetResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public UpdateAssetResponse withAsset(Asset asset) { + Utils.checkNotNull(asset, "asset"); + this.asset = Optional.ofNullable(asset); + return this; + } + + + /** + * Success + */ + public UpdateAssetResponse withAsset(Optional asset) { + Utils.checkNotNull(asset, "asset"); + this.asset = asset; + return this; + } + + /** + * Error + */ + public UpdateAssetResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public UpdateAssetResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateAssetResponse other = (UpdateAssetResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.asset, other.asset) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + asset, error); + } + + @Override + public String toString() { + return Utils.toString(UpdateAssetResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "asset", asset, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional asset = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder asset(Asset asset) { + Utils.checkNotNull(asset, "asset"); + this.asset = Optional.ofNullable(asset); + return this; + } + + /** + * Success + */ + public Builder asset(Optional asset) { + Utils.checkNotNull(asset, "asset"); + this.asset = asset; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public UpdateAssetResponse build() { + + return new UpdateAssetResponse( + contentType, statusCode, rawResponse, + asset, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateMultistreamTargetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateMultistreamTargetRequestBuilder.java new file mode 100644 index 00000000..7c15d896 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateMultistreamTargetRequestBuilder.java @@ -0,0 +1,58 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.MultistreamTargetInput; +import studio.livepeer.livepeer.models.operations.UpdateMultistreamTargetRequest; +import studio.livepeer.livepeer.operations.UpdateMultistreamTarget; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class UpdateMultistreamTargetRequestBuilder { + + private String id; + private MultistreamTargetInput multistreamTarget; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public UpdateMultistreamTargetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public UpdateMultistreamTargetRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public UpdateMultistreamTargetRequestBuilder multistreamTarget(MultistreamTargetInput multistreamTarget) { + Utils.checkNotNull(multistreamTarget, "multistreamTarget"); + this.multistreamTarget = multistreamTarget; + return this; + } + + + private UpdateMultistreamTargetRequest buildRequest() { + + UpdateMultistreamTargetRequest request = new UpdateMultistreamTargetRequest(id, + multistreamTarget); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new UpdateMultistreamTarget.Async(sdkConfiguration, _headers); + UpdateMultistreamTargetRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateMultistreamTargetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateMultistreamTargetResponse.java new file mode 100644 index 00000000..2e72fae1 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateMultistreamTargetResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class UpdateMultistreamTargetResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public UpdateMultistreamTargetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public UpdateMultistreamTargetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public UpdateMultistreamTargetResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public UpdateMultistreamTargetResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public UpdateMultistreamTargetResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public UpdateMultistreamTargetResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public UpdateMultistreamTargetResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateMultistreamTargetResponse other = (UpdateMultistreamTargetResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(UpdateMultistreamTargetResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public UpdateMultistreamTargetResponse build() { + + return new UpdateMultistreamTargetResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateRoomUserRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateRoomUserRequestBuilder.java new file mode 100644 index 00000000..a0b0f5bb --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateRoomUserRequestBuilder.java @@ -0,0 +1,66 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.RoomUserUpdatePayload; +import studio.livepeer.livepeer.models.operations.UpdateRoomUserRequest; +import studio.livepeer.livepeer.operations.UpdateRoomUser; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class UpdateRoomUserRequestBuilder { + + private String id; + private String userId; + private RoomUserUpdatePayload roomUserUpdatePayload; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public UpdateRoomUserRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public UpdateRoomUserRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public UpdateRoomUserRequestBuilder userId(String userId) { + Utils.checkNotNull(userId, "userId"); + this.userId = userId; + return this; + } + + public UpdateRoomUserRequestBuilder roomUserUpdatePayload(RoomUserUpdatePayload roomUserUpdatePayload) { + Utils.checkNotNull(roomUserUpdatePayload, "roomUserUpdatePayload"); + this.roomUserUpdatePayload = roomUserUpdatePayload; + return this; + } + + + private UpdateRoomUserRequest buildRequest() { + + UpdateRoomUserRequest request = new UpdateRoomUserRequest(id, + userId, + roomUserUpdatePayload); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new UpdateRoomUser.Async(sdkConfiguration, _headers); + UpdateRoomUserRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateRoomUserResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateRoomUserResponse.java new file mode 100644 index 00000000..dcbb33a7 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateRoomUserResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class UpdateRoomUserResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public UpdateRoomUserResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public UpdateRoomUserResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public UpdateRoomUserResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public UpdateRoomUserResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public UpdateRoomUserResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public UpdateRoomUserResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public UpdateRoomUserResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateRoomUserResponse other = (UpdateRoomUserResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(UpdateRoomUserResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public UpdateRoomUserResponse build() { + + return new UpdateRoomUserResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateSigningKeyRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateSigningKeyRequestBuilder.java new file mode 100644 index 00000000..e46804a6 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateSigningKeyRequestBuilder.java @@ -0,0 +1,58 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.operations.UpdateSigningKeyRequest; +import studio.livepeer.livepeer.models.operations.UpdateSigningKeyRequestBody; +import studio.livepeer.livepeer.operations.UpdateSigningKey; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class UpdateSigningKeyRequestBuilder { + + private String keyId; + private UpdateSigningKeyRequestBody requestBody; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public UpdateSigningKeyRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public UpdateSigningKeyRequestBuilder keyId(String keyId) { + Utils.checkNotNull(keyId, "keyId"); + this.keyId = keyId; + return this; + } + + public UpdateSigningKeyRequestBuilder requestBody(UpdateSigningKeyRequestBody requestBody) { + Utils.checkNotNull(requestBody, "requestBody"); + this.requestBody = requestBody; + return this; + } + + + private UpdateSigningKeyRequest buildRequest() { + + UpdateSigningKeyRequest request = new UpdateSigningKeyRequest(keyId, + requestBody); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new UpdateSigningKey.Async(sdkConfiguration, _headers); + UpdateSigningKeyRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateSigningKeyResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateSigningKeyResponse.java new file mode 100644 index 00000000..8e412d18 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateSigningKeyResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class UpdateSigningKeyResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public UpdateSigningKeyResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public UpdateSigningKeyResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public UpdateSigningKeyResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public UpdateSigningKeyResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public UpdateSigningKeyResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public UpdateSigningKeyResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public UpdateSigningKeyResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSigningKeyResponse other = (UpdateSigningKeyResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(UpdateSigningKeyResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public UpdateSigningKeyResponse build() { + + return new UpdateSigningKeyResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateStreamRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateStreamRequestBuilder.java new file mode 100644 index 00000000..e72289e2 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateStreamRequestBuilder.java @@ -0,0 +1,58 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.StreamPatchPayload; +import studio.livepeer.livepeer.models.operations.UpdateStreamRequest; +import studio.livepeer.livepeer.operations.UpdateStream; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class UpdateStreamRequestBuilder { + + private String id; + private StreamPatchPayload streamPatchPayload; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public UpdateStreamRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public UpdateStreamRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public UpdateStreamRequestBuilder streamPatchPayload(StreamPatchPayload streamPatchPayload) { + Utils.checkNotNull(streamPatchPayload, "streamPatchPayload"); + this.streamPatchPayload = streamPatchPayload; + return this; + } + + + private UpdateStreamRequest buildRequest() { + + UpdateStreamRequest request = new UpdateStreamRequest(id, + streamPatchPayload); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new UpdateStream.Async(sdkConfiguration, _headers); + UpdateStreamRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateStreamResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateStreamResponse.java new file mode 100644 index 00000000..cb658ce9 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateStreamResponse.java @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class UpdateStreamResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public UpdateStreamResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.error = error; + } + + public UpdateStreamResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public UpdateStreamResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public UpdateStreamResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public UpdateStreamResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Error + */ + public UpdateStreamResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public UpdateStreamResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateStreamResponse other = (UpdateStreamResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + error); + } + + @Override + public String toString() { + return Utils.toString(UpdateStreamResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public UpdateStreamResponse build() { + + return new UpdateStreamResponse( + contentType, statusCode, rawResponse, + error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateWebhookRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateWebhookRequestBuilder.java new file mode 100644 index 00000000..8ea61dc6 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateWebhookRequestBuilder.java @@ -0,0 +1,58 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.lang.String; +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.WebhookInput; +import studio.livepeer.livepeer.models.operations.UpdateWebhookRequest; +import studio.livepeer.livepeer.operations.UpdateWebhook; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class UpdateWebhookRequestBuilder { + + private String id; + private WebhookInput webhook; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public UpdateWebhookRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public UpdateWebhookRequestBuilder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public UpdateWebhookRequestBuilder webhook(WebhookInput webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = webhook; + return this; + } + + + private UpdateWebhookRequest buildRequest() { + + UpdateWebhookRequest request = new UpdateWebhookRequest(id, + webhook); + + return request; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new UpdateWebhook.Async(sdkConfiguration, _headers); + UpdateWebhookRequest request = buildRequest(); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateWebhookResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateWebhookResponse.java new file mode 100644 index 00000000..7c5c5963 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UpdateWebhookResponse.java @@ -0,0 +1,313 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Webhook; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class UpdateWebhookResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Success + */ + private Optional webhook; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public UpdateWebhookResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional webhook, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(webhook, "webhook"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.webhook = webhook; + this.error = error; + } + + public UpdateWebhookResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Success + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional webhook() { + return (Optional) webhook; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public UpdateWebhookResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public UpdateWebhookResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public UpdateWebhookResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Success + */ + public UpdateWebhookResponse withWebhook(Webhook webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = Optional.ofNullable(webhook); + return this; + } + + + /** + * Success + */ + public UpdateWebhookResponse withWebhook(Optional webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = webhook; + return this; + } + + /** + * Error + */ + public UpdateWebhookResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public UpdateWebhookResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWebhookResponse other = (UpdateWebhookResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.webhook, other.webhook) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + webhook, error); + } + + @Override + public String toString() { + return Utils.toString(UpdateWebhookResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "webhook", webhook, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional webhook = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Success + */ + public Builder webhook(Webhook webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = Optional.ofNullable(webhook); + return this; + } + + /** + * Success + */ + public Builder webhook(Optional webhook) { + Utils.checkNotNull(webhook, "webhook"); + this.webhook = webhook; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public UpdateWebhookResponse build() { + + return new UpdateWebhookResponse( + contentType, statusCode, rawResponse, + webhook, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UploadAssetRequestBuilder.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UploadAssetRequestBuilder.java new file mode 100644 index 00000000..d6ec02e6 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UploadAssetRequestBuilder.java @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import java.util.concurrent.CompletableFuture; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.models.components.NewAssetFromUrlPayload; +import studio.livepeer.livepeer.operations.UploadAsset; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Utils; + +public class UploadAssetRequestBuilder { + + private NewAssetFromUrlPayload request; + private final SDKConfiguration sdkConfiguration; + private final Headers _headers = new Headers(); + + public UploadAssetRequestBuilder(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + public UploadAssetRequestBuilder request(NewAssetFromUrlPayload request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public CompletableFuture call() { + + AsyncRequestOperation operation + = new UploadAsset.Async(sdkConfiguration, _headers); + + return operation.doRequest(request) + .thenCompose(operation::handleResponse); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/models/operations/async/UploadAssetResponse.java b/src/main/java/studio/livepeer/livepeer/models/operations/async/UploadAssetResponse.java new file mode 100644 index 00000000..ac3e5a64 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/models/operations/async/UploadAssetResponse.java @@ -0,0 +1,373 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.models.operations.async; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Optional; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.operations.UploadAssetData; +import studio.livepeer.livepeer.models.operations.UploadAssetDataOutput; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.Utils; + + +public class UploadAssetResponse implements AsyncResponse { + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Upload in progress + */ + private Optional twoHundredApplicationJsonData; + + /** + * Upload started + */ + private Optional twoHundredAndOneApplicationJsonData; + + /** + * Error + */ + private Optional error; + + @JsonCreator + public UploadAssetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional twoHundredApplicationJsonData, + Optional twoHundredAndOneApplicationJsonData, + Optional error) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(twoHundredApplicationJsonData, "twoHundredApplicationJsonData"); + Utils.checkNotNull(twoHundredAndOneApplicationJsonData, "twoHundredAndOneApplicationJsonData"); + Utils.checkNotNull(error, "error"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.twoHundredApplicationJsonData = twoHundredApplicationJsonData; + this.twoHundredAndOneApplicationJsonData = twoHundredAndOneApplicationJsonData; + this.error = error; + } + + public UploadAssetResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, + Optional.empty(), Optional.empty(), Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Upload in progress + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional twoHundredApplicationJsonData() { + return (Optional) twoHundredApplicationJsonData; + } + + /** + * Upload started + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional twoHundredAndOneApplicationJsonData() { + return (Optional) twoHundredAndOneApplicationJsonData; + } + + /** + * Error + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional error() { + return (Optional) error; + } + + public static Builder builder() { + return new Builder(); + } + + + /** + * HTTP response content type for this operation + */ + public UploadAssetResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public UploadAssetResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public UploadAssetResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Upload in progress + */ + public UploadAssetResponse withTwoHundredApplicationJsonData(UploadAssetData twoHundredApplicationJsonData) { + Utils.checkNotNull(twoHundredApplicationJsonData, "twoHundredApplicationJsonData"); + this.twoHundredApplicationJsonData = Optional.ofNullable(twoHundredApplicationJsonData); + return this; + } + + + /** + * Upload in progress + */ + public UploadAssetResponse withTwoHundredApplicationJsonData(Optional twoHundredApplicationJsonData) { + Utils.checkNotNull(twoHundredApplicationJsonData, "twoHundredApplicationJsonData"); + this.twoHundredApplicationJsonData = twoHundredApplicationJsonData; + return this; + } + + /** + * Upload started + */ + public UploadAssetResponse withTwoHundredAndOneApplicationJsonData(UploadAssetDataOutput twoHundredAndOneApplicationJsonData) { + Utils.checkNotNull(twoHundredAndOneApplicationJsonData, "twoHundredAndOneApplicationJsonData"); + this.twoHundredAndOneApplicationJsonData = Optional.ofNullable(twoHundredAndOneApplicationJsonData); + return this; + } + + + /** + * Upload started + */ + public UploadAssetResponse withTwoHundredAndOneApplicationJsonData(Optional twoHundredAndOneApplicationJsonData) { + Utils.checkNotNull(twoHundredAndOneApplicationJsonData, "twoHundredAndOneApplicationJsonData"); + this.twoHundredAndOneApplicationJsonData = twoHundredAndOneApplicationJsonData; + return this; + } + + /** + * Error + */ + public UploadAssetResponse withError(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + + /** + * Error + */ + public UploadAssetResponse withError(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UploadAssetResponse other = (UploadAssetResponse) o; + return + Utils.enhancedDeepEquals(this.contentType, other.contentType) && + Utils.enhancedDeepEquals(this.statusCode, other.statusCode) && + Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse) && + Utils.enhancedDeepEquals(this.twoHundredApplicationJsonData, other.twoHundredApplicationJsonData) && + Utils.enhancedDeepEquals(this.twoHundredAndOneApplicationJsonData, other.twoHundredAndOneApplicationJsonData) && + Utils.enhancedDeepEquals(this.error, other.error); + } + + @Override + public int hashCode() { + return Utils.enhancedHash( + contentType, statusCode, rawResponse, + twoHundredApplicationJsonData, twoHundredAndOneApplicationJsonData, error); + } + + @Override + public String toString() { + return Utils.toString(UploadAssetResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "twoHundredApplicationJsonData", twoHundredApplicationJsonData, + "twoHundredAndOneApplicationJsonData", twoHundredAndOneApplicationJsonData, + "error", error); + } + + @SuppressWarnings("UnusedReturnValue") + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional twoHundredApplicationJsonData = Optional.empty(); + + private Optional twoHundredAndOneApplicationJsonData = Optional.empty(); + + private Optional error = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + + /** + * Upload in progress + */ + public Builder twoHundredApplicationJsonData(UploadAssetData twoHundredApplicationJsonData) { + Utils.checkNotNull(twoHundredApplicationJsonData, "twoHundredApplicationJsonData"); + this.twoHundredApplicationJsonData = Optional.ofNullable(twoHundredApplicationJsonData); + return this; + } + + /** + * Upload in progress + */ + public Builder twoHundredApplicationJsonData(Optional twoHundredApplicationJsonData) { + Utils.checkNotNull(twoHundredApplicationJsonData, "twoHundredApplicationJsonData"); + this.twoHundredApplicationJsonData = twoHundredApplicationJsonData; + return this; + } + + + /** + * Upload started + */ + public Builder twoHundredAndOneApplicationJsonData(UploadAssetDataOutput twoHundredAndOneApplicationJsonData) { + Utils.checkNotNull(twoHundredAndOneApplicationJsonData, "twoHundredAndOneApplicationJsonData"); + this.twoHundredAndOneApplicationJsonData = Optional.ofNullable(twoHundredAndOneApplicationJsonData); + return this; + } + + /** + * Upload started + */ + public Builder twoHundredAndOneApplicationJsonData(Optional twoHundredAndOneApplicationJsonData) { + Utils.checkNotNull(twoHundredAndOneApplicationJsonData, "twoHundredAndOneApplicationJsonData"); + this.twoHundredAndOneApplicationJsonData = twoHundredAndOneApplicationJsonData; + return this; + } + + + /** + * Error + */ + public Builder error(Error error) { + Utils.checkNotNull(error, "error"); + this.error = Optional.ofNullable(error); + return this; + } + + /** + * Error + */ + public Builder error(Optional error) { + Utils.checkNotNull(error, "error"); + this.error = error; + return this; + } + + public UploadAssetResponse build() { + + return new UploadAssetResponse( + contentType, statusCode, rawResponse, + twoHundredApplicationJsonData, twoHundredAndOneApplicationJsonData, error); + } + + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/AddMultistreamTarget.java b/src/main/java/studio/livepeer/livepeer/operations/AddMultistreamTarget.java new file mode 100644 index 00000000..e1d06056 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/AddMultistreamTarget.java @@ -0,0 +1,269 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.AddMultistreamTargetRequest; +import studio.livepeer.livepeer.models.operations.AddMultistreamTargetResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class AddMultistreamTarget { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "addMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "addMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "addMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/stream/{id}/create-multistream-target", + request, null); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "targetAddPayload", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(AddMultistreamTargetRequest request) throws Exception { + HttpRequest req = buildRequest(request, AddMultistreamTargetRequest.class, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(AddMultistreamTargetRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public AddMultistreamTargetResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + AddMultistreamTargetResponse.Builder resBuilder = + AddMultistreamTargetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + AddMultistreamTargetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(AddMultistreamTargetRequest request) throws Exception { + HttpRequest req = buildRequest(request, AddMultistreamTargetRequest.class, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(AddMultistreamTargetRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.AddMultistreamTargetResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.AddMultistreamTargetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.AddMultistreamTargetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/CreateClip.java b/src/main/java/studio/livepeer/livepeer/operations/CreateClip.java new file mode 100644 index 00000000..6033baf7 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/CreateClip.java @@ -0,0 +1,275 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.ClipPayload; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.CreateClipData; +import studio.livepeer.livepeer.models.operations.CreateClipResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateClip { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createClip", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createClip", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createClip", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/clip"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(ClipPayload request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(ClipPayload request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public CreateClipResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateClipResponse.Builder resBuilder = + CreateClipResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateClipResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(ClipPayload request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(ClipPayload request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.CreateClipResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.CreateClipResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.CreateClipResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/CreateMultistreamTarget.java b/src/main/java/studio/livepeer/livepeer/operations/CreateMultistreamTarget.java new file mode 100644 index 00000000..23a3a6d0 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/CreateMultistreamTarget.java @@ -0,0 +1,275 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.MultistreamTarget; +import studio.livepeer.livepeer.models.components.MultistreamTargetInput; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.CreateMultistreamTargetResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateMultistreamTarget { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/multistream/target"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(MultistreamTargetInput request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(MultistreamTargetInput request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public CreateMultistreamTargetResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateMultistreamTargetResponse.Builder resBuilder = + CreateMultistreamTargetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateMultistreamTargetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "201")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withMultistreamTarget(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(MultistreamTargetInput request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(MultistreamTargetInput request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.CreateMultistreamTargetResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.CreateMultistreamTargetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.CreateMultistreamTargetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "201")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withMultistreamTarget); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/CreateRoom.java b/src/main/java/studio/livepeer/livepeer/operations/CreateRoom.java new file mode 100644 index 00000000..46a7cfea --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/CreateRoom.java @@ -0,0 +1,256 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.CreateRoomResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateRoom { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createRoom", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createRoom", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createRoom", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest() throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/room"); + HTTPRequest req = new HTTPRequest(url, "POST"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestlessOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest() { + HttpRequest r = unchecked(() -> onBuildRequest()).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public CreateRoomResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateRoomResponse.Builder resBuilder = + CreateRoomResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateRoomResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withCreateRoomResponse(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestlessOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest() { + return unchecked(() -> onBuildRequest()).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.CreateRoomResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.CreateRoomResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.CreateRoomResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withCreateRoomResponse); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/CreateRoomUser.java b/src/main/java/studio/livepeer/livepeer/operations/CreateRoomUser.java new file mode 100644 index 00000000..e1c05bb9 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/CreateRoomUser.java @@ -0,0 +1,277 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.RoomUserResponse; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.CreateRoomUserRequest; +import studio.livepeer.livepeer.models.operations.CreateRoomUserResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateRoomUser { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createRoomUser", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createRoomUser", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createRoomUser", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/room/{id}/user", + request, null); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "roomUserPayload", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(CreateRoomUserRequest request) throws Exception { + HttpRequest req = buildRequest(request, CreateRoomUserRequest.class, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(CreateRoomUserRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public CreateRoomUserResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateRoomUserResponse.Builder resBuilder = + CreateRoomUserResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateRoomUserResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "201")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withRoomUserResponse(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(CreateRoomUserRequest request) throws Exception { + HttpRequest req = buildRequest(request, CreateRoomUserRequest.class, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(CreateRoomUserRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.CreateRoomUserResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.CreateRoomUserResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.CreateRoomUserResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "201")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withRoomUserResponse); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/CreateSigningKey.java b/src/main/java/studio/livepeer/livepeer/operations/CreateSigningKey.java new file mode 100644 index 00000000..b9785d95 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/CreateSigningKey.java @@ -0,0 +1,257 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.SigningKey; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.CreateSigningKeyResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateSigningKey { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createSigningKey", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createSigningKey", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createSigningKey", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest() throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/access-control/signing-key"); + HTTPRequest req = new HTTPRequest(url, "POST"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestlessOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest() { + HttpRequest r = unchecked(() -> onBuildRequest()).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public CreateSigningKeyResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateSigningKeyResponse.Builder resBuilder = + CreateSigningKeyResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateSigningKeyResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withSigningKey(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestlessOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest() { + return unchecked(() -> onBuildRequest()).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.CreateSigningKeyResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.CreateSigningKeyResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.CreateSigningKeyResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withSigningKey); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/CreateStream.java b/src/main/java/studio/livepeer/livepeer/operations/CreateStream.java new file mode 100644 index 00000000..f52bf816 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/CreateStream.java @@ -0,0 +1,275 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.NewStreamPayload; +import studio.livepeer.livepeer.models.components.Stream; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.CreateStreamResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateStream { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createStream", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createStream", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createStream", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/stream"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(NewStreamPayload request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(NewStreamPayload request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public CreateStreamResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateStreamResponse.Builder resBuilder = + CreateStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "201")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withStream(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(NewStreamPayload request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(NewStreamPayload request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.CreateStreamResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.CreateStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.CreateStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "201")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withStream); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/CreateWebhook.java b/src/main/java/studio/livepeer/livepeer/operations/CreateWebhook.java new file mode 100644 index 00000000..0ac344a3 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/CreateWebhook.java @@ -0,0 +1,275 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Webhook; +import studio.livepeer.livepeer.models.components.WebhookInput; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.CreateWebhookResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class CreateWebhook { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createWebhook", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createWebhook", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "createWebhook", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/webhook"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(WebhookInput request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(WebhookInput request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public CreateWebhookResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateWebhookResponse.Builder resBuilder = + CreateWebhookResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + CreateWebhookResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withWebhook(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(WebhookInput request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(WebhookInput request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.CreateWebhookResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.CreateWebhookResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.CreateWebhookResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withWebhook); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/DeleteAsset.java b/src/main/java/studio/livepeer/livepeer/operations/DeleteAsset.java new file mode 100644 index 00000000..4b1c84e9 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/DeleteAsset.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.DeleteAssetRequest; +import studio.livepeer.livepeer.models.operations.DeleteAssetResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteAsset { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteAsset", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteAsset", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteAsset", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/asset/{assetId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "DELETE"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(DeleteAssetRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteAssetRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(DeleteAssetRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public DeleteAssetResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeleteAssetResponse.Builder resBuilder = + DeleteAssetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeleteAssetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(DeleteAssetRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteAssetRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(DeleteAssetRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.DeleteAssetResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.DeleteAssetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.DeleteAssetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/DeleteMultistreamTarget.java b/src/main/java/studio/livepeer/livepeer/operations/DeleteMultistreamTarget.java new file mode 100644 index 00000000..ebf1eb98 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/DeleteMultistreamTarget.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.DeleteMultistreamTargetRequest; +import studio.livepeer.livepeer.models.operations.DeleteMultistreamTargetResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteMultistreamTarget { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/multistream/target/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "DELETE"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(DeleteMultistreamTargetRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteMultistreamTargetRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(DeleteMultistreamTargetRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public DeleteMultistreamTargetResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeleteMultistreamTargetResponse.Builder resBuilder = + DeleteMultistreamTargetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeleteMultistreamTargetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(DeleteMultistreamTargetRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteMultistreamTargetRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(DeleteMultistreamTargetRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.DeleteMultistreamTargetResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.DeleteMultistreamTargetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.DeleteMultistreamTargetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/DeleteRoom.java b/src/main/java/studio/livepeer/livepeer/operations/DeleteRoom.java new file mode 100644 index 00000000..42ed5ce6 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/DeleteRoom.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.DeleteRoomRequest; +import studio.livepeer.livepeer.models.operations.DeleteRoomResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteRoom { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteRoom", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteRoom", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteRoom", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/room/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "DELETE"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(DeleteRoomRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteRoomRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(DeleteRoomRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public DeleteRoomResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeleteRoomResponse.Builder resBuilder = + DeleteRoomResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeleteRoomResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(DeleteRoomRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteRoomRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(DeleteRoomRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.DeleteRoomResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.DeleteRoomResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.DeleteRoomResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/DeleteRoomUser.java b/src/main/java/studio/livepeer/livepeer/operations/DeleteRoomUser.java new file mode 100644 index 00000000..4410b121 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/DeleteRoomUser.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.DeleteRoomUserRequest; +import studio.livepeer.livepeer.models.operations.DeleteRoomUserResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteRoomUser { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteRoomUser", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteRoomUser", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteRoomUser", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/room/{id}/user/{userId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "DELETE"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(DeleteRoomUserRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteRoomUserRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(DeleteRoomUserRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public DeleteRoomUserResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeleteRoomUserResponse.Builder resBuilder = + DeleteRoomUserResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeleteRoomUserResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(DeleteRoomUserRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteRoomUserRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(DeleteRoomUserRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.DeleteRoomUserResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.DeleteRoomUserResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.DeleteRoomUserResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/DeleteSigningKey.java b/src/main/java/studio/livepeer/livepeer/operations/DeleteSigningKey.java new file mode 100644 index 00000000..64123de2 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/DeleteSigningKey.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.DeleteSigningKeyRequest; +import studio.livepeer.livepeer.models.operations.DeleteSigningKeyResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteSigningKey { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteSigningKey", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteSigningKey", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteSigningKey", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/access-control/signing-key/{keyId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "DELETE"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(DeleteSigningKeyRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteSigningKeyRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(DeleteSigningKeyRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public DeleteSigningKeyResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeleteSigningKeyResponse.Builder resBuilder = + DeleteSigningKeyResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeleteSigningKeyResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(DeleteSigningKeyRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteSigningKeyRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(DeleteSigningKeyRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.DeleteSigningKeyResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.DeleteSigningKeyResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.DeleteSigningKeyResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/DeleteStream.java b/src/main/java/studio/livepeer/livepeer/operations/DeleteStream.java new file mode 100644 index 00000000..458cfb7f --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/DeleteStream.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.DeleteStreamRequest; +import studio.livepeer.livepeer.models.operations.DeleteStreamResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteStream { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteStream", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteStream", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteStream", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/stream/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "DELETE"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(DeleteStreamRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteStreamRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(DeleteStreamRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public DeleteStreamResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeleteStreamResponse.Builder resBuilder = + DeleteStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeleteStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(DeleteStreamRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteStreamRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(DeleteStreamRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.DeleteStreamResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.DeleteStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.DeleteStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/DeleteWebhook.java b/src/main/java/studio/livepeer/livepeer/operations/DeleteWebhook.java new file mode 100644 index 00000000..2b052b3e --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/DeleteWebhook.java @@ -0,0 +1,260 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Webhook; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.DeleteWebhookRequest; +import studio.livepeer.livepeer.models.operations.DeleteWebhookResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class DeleteWebhook { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteWebhook", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteWebhook", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "deleteWebhook", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/webhook/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "DELETE"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(DeleteWebhookRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteWebhookRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(DeleteWebhookRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public DeleteWebhookResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + DeleteWebhookResponse.Builder resBuilder = + DeleteWebhookResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + DeleteWebhookResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withWebhook(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(DeleteWebhookRequest request) throws Exception { + HttpRequest req = buildRequest(request, DeleteWebhookRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(DeleteWebhookRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.DeleteWebhookResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.DeleteWebhookResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.DeleteWebhookResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withWebhook); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetAsset.java b/src/main/java/studio/livepeer/livepeer/operations/GetAsset.java new file mode 100644 index 00000000..aa94c465 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetAsset.java @@ -0,0 +1,260 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Asset; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetAssetRequest; +import studio.livepeer.livepeer.models.operations.GetAssetResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetAsset { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getAsset", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getAsset", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getAsset", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/asset/{assetId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetAssetRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetAssetRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetAssetRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetAssetResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetAssetResponse.Builder resBuilder = + GetAssetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetAssetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withAsset(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetAssetRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetAssetRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetAssetRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetAssetResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetAssetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetAssetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withAsset); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetAssets.java b/src/main/java/studio/livepeer/livepeer/operations/GetAssets.java new file mode 100644 index 00000000..9d58c4bb --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetAssets.java @@ -0,0 +1,258 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Asset; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetAssetsResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetAssets { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getAssets", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getAssets", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getAssets", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest() throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/asset"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestlessOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest() { + HttpRequest r = unchecked(() -> onBuildRequest()).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetAssetsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetAssetsResponse.Builder resBuilder = + GetAssetsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetAssetsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestlessOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest() { + return unchecked(() -> onBuildRequest()).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetAssetsResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetAssetsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetAssetsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetClips.java b/src/main/java/studio/livepeer/livepeer/operations/GetClips.java new file mode 100644 index 00000000..c70b0a87 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetClips.java @@ -0,0 +1,261 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Asset; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetClipsRequest; +import studio.livepeer.livepeer.models.operations.GetClipsResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetClips { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getClips", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getClips", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getClips", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/stream/{id}/clips", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetClipsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetClipsRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetClipsRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetClipsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetClipsResponse.Builder resBuilder = + GetClipsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetClipsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetClipsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetClipsRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetClipsRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetClipsResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetClipsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetClipsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetCreatorViewershipMetrics.java b/src/main/java/studio/livepeer/livepeer/operations/GetCreatorViewershipMetrics.java new file mode 100644 index 00000000..eaeb0e62 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetCreatorViewershipMetrics.java @@ -0,0 +1,264 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.ViewershipMetric; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsRequest; +import studio.livepeer.livepeer.models.operations.GetCreatorViewershipMetricsResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetCreatorViewershipMetrics { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getCreatorViewershipMetrics", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getCreatorViewershipMetrics", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getCreatorViewershipMetrics", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/data/views/query/creator"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + + req.addQueryParams(Utils.getQueryParams( + klass, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetCreatorViewershipMetricsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetCreatorViewershipMetricsRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetCreatorViewershipMetricsRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetCreatorViewershipMetricsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetCreatorViewershipMetricsResponse.Builder resBuilder = + GetCreatorViewershipMetricsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetCreatorViewershipMetricsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetCreatorViewershipMetricsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetCreatorViewershipMetricsRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetCreatorViewershipMetricsRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetCreatorViewershipMetricsResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetCreatorViewershipMetricsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetCreatorViewershipMetricsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetMultistreamTarget.java b/src/main/java/studio/livepeer/livepeer/operations/GetMultistreamTarget.java new file mode 100644 index 00000000..4a5c32e3 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetMultistreamTarget.java @@ -0,0 +1,260 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.MultistreamTarget; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetMultistreamTargetRequest; +import studio.livepeer.livepeer.models.operations.GetMultistreamTargetResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetMultistreamTarget { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/multistream/target/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetMultistreamTargetRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetMultistreamTargetRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetMultistreamTargetRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetMultistreamTargetResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetMultistreamTargetResponse.Builder resBuilder = + GetMultistreamTargetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetMultistreamTargetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withMultistreamTarget(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetMultistreamTargetRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetMultistreamTargetRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetMultistreamTargetRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetMultistreamTargetResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetMultistreamTargetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetMultistreamTargetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withMultistreamTarget); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetMultistreamTargets.java b/src/main/java/studio/livepeer/livepeer/operations/GetMultistreamTargets.java new file mode 100644 index 00000000..dc3d0932 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetMultistreamTargets.java @@ -0,0 +1,258 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.MultistreamTarget; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetMultistreamTargetsResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetMultistreamTargets { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getMultistreamTargets", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getMultistreamTargets", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getMultistreamTargets", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest() throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/multistream/target"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestlessOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest() { + HttpRequest r = unchecked(() -> onBuildRequest()).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetMultistreamTargetsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetMultistreamTargetsResponse.Builder resBuilder = + GetMultistreamTargetsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetMultistreamTargetsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestlessOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest() { + return unchecked(() -> onBuildRequest()).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetMultistreamTargetsResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetMultistreamTargetsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetMultistreamTargetsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetPlaybackInfo.java b/src/main/java/studio/livepeer/livepeer/operations/GetPlaybackInfo.java new file mode 100644 index 00000000..36d8a753 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetPlaybackInfo.java @@ -0,0 +1,275 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.PlaybackInfo; +import studio.livepeer.livepeer.models.errors.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetPlaybackInfoRequest; +import studio.livepeer.livepeer.models.operations.GetPlaybackInfoResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetPlaybackInfo { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getPlaybackInfo", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getPlaybackInfo", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getPlaybackInfo", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/playback/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetPlaybackInfoRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetPlaybackInfoRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetPlaybackInfoRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "404", "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetPlaybackInfoResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetPlaybackInfoResponse.Builder resBuilder = + GetPlaybackInfoResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetPlaybackInfoResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withPlaybackInfo(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "404")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + throw Error.from(response); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetPlaybackInfoRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetPlaybackInfoRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetPlaybackInfoRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "404", "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetPlaybackInfoResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetPlaybackInfoResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetPlaybackInfoResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withPlaybackInfo); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "404")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Error.fromAsync(response) + .thenCompose(CompletableFuture::failedFuture); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetPublicViewershipMetrics.java b/src/main/java/studio/livepeer/livepeer/operations/GetPublicViewershipMetrics.java new file mode 100644 index 00000000..aada85f1 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetPublicViewershipMetrics.java @@ -0,0 +1,260 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsData; +import studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsRequest; +import studio.livepeer.livepeer.models.operations.GetPublicViewershipMetricsResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetPublicViewershipMetrics { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getPublicViewershipMetrics", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getPublicViewershipMetrics", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getPublicViewershipMetrics", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/data/views/query/total/{playbackId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetPublicViewershipMetricsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetPublicViewershipMetricsRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetPublicViewershipMetricsRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetPublicViewershipMetricsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetPublicViewershipMetricsResponse.Builder resBuilder = + GetPublicViewershipMetricsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetPublicViewershipMetricsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetPublicViewershipMetricsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetPublicViewershipMetricsRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetPublicViewershipMetricsRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetPublicViewershipMetricsResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetPublicViewershipMetricsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetPublicViewershipMetricsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetRealtimeViewershipNow.java b/src/main/java/studio/livepeer/livepeer/operations/GetRealtimeViewershipNow.java new file mode 100644 index 00000000..a295257e --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetRealtimeViewershipNow.java @@ -0,0 +1,264 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.RealtimeViewershipMetric; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetRealtimeViewershipNowRequest; +import studio.livepeer.livepeer.models.operations.GetRealtimeViewershipNowResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetRealtimeViewershipNow { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getRealtimeViewershipNow", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getRealtimeViewershipNow", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getRealtimeViewershipNow", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/data/views/now"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + + req.addQueryParams(Utils.getQueryParams( + klass, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetRealtimeViewershipNowRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetRealtimeViewershipNowRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetRealtimeViewershipNowRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetRealtimeViewershipNowResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetRealtimeViewershipNowResponse.Builder resBuilder = + GetRealtimeViewershipNowResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetRealtimeViewershipNowResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetRealtimeViewershipNowRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetRealtimeViewershipNowRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetRealtimeViewershipNowRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetRealtimeViewershipNowResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetRealtimeViewershipNowResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetRealtimeViewershipNowResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetRecordedSessions.java b/src/main/java/studio/livepeer/livepeer/operations/GetRecordedSessions.java new file mode 100644 index 00000000..cc7595e5 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetRecordedSessions.java @@ -0,0 +1,266 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Session; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetRecordedSessionsRequest; +import studio.livepeer.livepeer.models.operations.GetRecordedSessionsResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetRecordedSessions { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getRecordedSessions", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getRecordedSessions", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getRecordedSessions", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/stream/{parentId}/sessions", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + + req.addQueryParams(Utils.getQueryParams( + klass, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetRecordedSessionsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetRecordedSessionsRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetRecordedSessionsRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetRecordedSessionsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetRecordedSessionsResponse.Builder resBuilder = + GetRecordedSessionsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetRecordedSessionsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetRecordedSessionsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetRecordedSessionsRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetRecordedSessionsRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetRecordedSessionsResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetRecordedSessionsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetRecordedSessionsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetRoom.java b/src/main/java/studio/livepeer/livepeer/operations/GetRoom.java new file mode 100644 index 00000000..6d241a03 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetRoom.java @@ -0,0 +1,260 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Room; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetRoomRequest; +import studio.livepeer.livepeer.models.operations.GetRoomResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetRoom { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getRoom", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getRoom", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getRoom", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/room/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetRoomRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetRoomRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetRoomRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetRoomResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetRoomResponse.Builder resBuilder = + GetRoomResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetRoomResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withRoom(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetRoomRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetRoomRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetRoomRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetRoomResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetRoomResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetRoomResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withRoom); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetRoomUser.java b/src/main/java/studio/livepeer/livepeer/operations/GetRoomUser.java new file mode 100644 index 00000000..15d262b3 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetRoomUser.java @@ -0,0 +1,259 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetRoomUserRequest; +import studio.livepeer.livepeer.models.operations.GetRoomUserResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetRoomUser { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getRoomUser", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getRoomUser", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getRoomUser", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/room/{id}/user/{userId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetRoomUserRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetRoomUserRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetRoomUserRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetRoomUserResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetRoomUserResponse.Builder resBuilder = + GetRoomUserResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetRoomUserResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withGetRoomUserResponse(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetRoomUserRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetRoomUserRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetRoomUserRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetRoomUserResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetRoomUserResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetRoomUserResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withGetRoomUserResponse); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetSession.java b/src/main/java/studio/livepeer/livepeer/operations/GetSession.java new file mode 100644 index 00000000..23489703 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetSession.java @@ -0,0 +1,260 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Session; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetSessionRequest; +import studio.livepeer.livepeer.models.operations.GetSessionResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetSession { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSession", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSession", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSession", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/session/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetSessionRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetSessionRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetSessionRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetSessionResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetSessionResponse.Builder resBuilder = + GetSessionResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetSessionResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withSession(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetSessionRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetSessionRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetSessionRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetSessionResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetSessionResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetSessionResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withSession); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetSessionClips.java b/src/main/java/studio/livepeer/livepeer/operations/GetSessionClips.java new file mode 100644 index 00000000..d413433e --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetSessionClips.java @@ -0,0 +1,261 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Asset; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetSessionClipsRequest; +import studio.livepeer.livepeer.models.operations.GetSessionClipsResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetSessionClips { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSessionClips", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSessionClips", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSessionClips", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/session/{id}/clips", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetSessionClipsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetSessionClipsRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetSessionClipsRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetSessionClipsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetSessionClipsResponse.Builder resBuilder = + GetSessionClipsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetSessionClipsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetSessionClipsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetSessionClipsRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetSessionClipsRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetSessionClipsResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetSessionClipsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetSessionClipsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetSessions.java b/src/main/java/studio/livepeer/livepeer/operations/GetSessions.java new file mode 100644 index 00000000..394d3094 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetSessions.java @@ -0,0 +1,258 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Session; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetSessionsResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetSessions { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSessions", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSessions", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSessions", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest() throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/session"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestlessOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest() { + HttpRequest r = unchecked(() -> onBuildRequest()).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetSessionsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetSessionsResponse.Builder resBuilder = + GetSessionsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetSessionsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestlessOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest() { + return unchecked(() -> onBuildRequest()).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetSessionsResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetSessionsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetSessionsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetSigningKey.java b/src/main/java/studio/livepeer/livepeer/operations/GetSigningKey.java new file mode 100644 index 00000000..be284afe --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetSigningKey.java @@ -0,0 +1,260 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.SigningKey; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetSigningKeyRequest; +import studio.livepeer.livepeer.models.operations.GetSigningKeyResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetSigningKey { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSigningKey", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSigningKey", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSigningKey", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/access-control/signing-key/{keyId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetSigningKeyRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetSigningKeyRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetSigningKeyRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetSigningKeyResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetSigningKeyResponse.Builder resBuilder = + GetSigningKeyResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetSigningKeyResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withSigningKey(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetSigningKeyRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetSigningKeyRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetSigningKeyRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetSigningKeyResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetSigningKeyResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetSigningKeyResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withSigningKey); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetSigningKeys.java b/src/main/java/studio/livepeer/livepeer/operations/GetSigningKeys.java new file mode 100644 index 00000000..ae22eb5c --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetSigningKeys.java @@ -0,0 +1,258 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.SigningKey; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetSigningKeysResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetSigningKeys { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSigningKeys", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSigningKeys", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getSigningKeys", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest() throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/access-control/signing-key"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestlessOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest() { + HttpRequest r = unchecked(() -> onBuildRequest()).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetSigningKeysResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetSigningKeysResponse.Builder resBuilder = + GetSigningKeysResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetSigningKeysResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestlessOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest() { + return unchecked(() -> onBuildRequest()).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetSigningKeysResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetSigningKeysResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetSigningKeysResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetStream.java b/src/main/java/studio/livepeer/livepeer/operations/GetStream.java new file mode 100644 index 00000000..251c856f --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetStream.java @@ -0,0 +1,260 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Stream; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetStreamRequest; +import studio.livepeer.livepeer.models.operations.GetStreamResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetStream { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getStream", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getStream", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getStream", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/stream/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetStreamRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetStreamRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetStreamRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetStreamResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetStreamResponse.Builder resBuilder = + GetStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withStream(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetStreamRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetStreamRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetStreamRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetStreamResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withStream); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetStreams.java b/src/main/java/studio/livepeer/livepeer/operations/GetStreams.java new file mode 100644 index 00000000..65b18b3a --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetStreams.java @@ -0,0 +1,264 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Stream; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetStreamsRequest; +import studio.livepeer.livepeer.models.operations.GetStreamsResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetStreams { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getStreams", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getStreams", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getStreams", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/stream"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + + req.addQueryParams(Utils.getQueryParams( + klass, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetStreamsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetStreamsRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetStreamsRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetStreamsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetStreamsResponse.Builder resBuilder = + GetStreamsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetStreamsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetStreamsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetStreamsRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetStreamsRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetStreamsResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetStreamsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetStreamsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetTask.java b/src/main/java/studio/livepeer/livepeer/operations/GetTask.java new file mode 100644 index 00000000..55a658ba --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetTask.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Task; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetTaskRequest; +import studio.livepeer.livepeer.models.operations.GetTaskResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetTask { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getTask", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getTask", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getTask", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/task/{taskId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetTaskRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetTaskRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetTaskRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetTaskResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetTaskResponse.Builder resBuilder = + GetTaskResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetTaskResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withTask(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + // no content + return res; + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetTaskRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetTaskRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetTaskRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetTaskResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetTaskResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetTaskResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withTask); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + // no content + return CompletableFuture.completedFuture(res); + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetTasks.java b/src/main/java/studio/livepeer/livepeer/operations/GetTasks.java new file mode 100644 index 00000000..68479a9d --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetTasks.java @@ -0,0 +1,258 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Task; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetTasksResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetTasks { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getTasks", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getTasks", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getTasks", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest() throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/task"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestlessOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest() { + HttpRequest r = unchecked(() -> onBuildRequest()).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetTasksResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetTasksResponse.Builder resBuilder = + GetTasksResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetTasksResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestlessOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest() { + return unchecked(() -> onBuildRequest()).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetTasksResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetTasksResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetTasksResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetUsageMetrics.java b/src/main/java/studio/livepeer/livepeer/operations/GetUsageMetrics.java new file mode 100644 index 00000000..6fcc1991 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetUsageMetrics.java @@ -0,0 +1,263 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.UsageMetric; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetUsageMetricsRequest; +import studio.livepeer.livepeer.models.operations.GetUsageMetricsResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetUsageMetrics { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getUsageMetrics", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getUsageMetrics", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getUsageMetrics", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/data/usage/query"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + + req.addQueryParams(Utils.getQueryParams( + klass, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetUsageMetricsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetUsageMetricsRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetUsageMetricsRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetUsageMetricsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetUsageMetricsResponse.Builder resBuilder = + GetUsageMetricsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetUsageMetricsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withUsageMetric(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetUsageMetricsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetUsageMetricsRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetUsageMetricsRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetUsageMetricsResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetUsageMetricsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetUsageMetricsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withUsageMetric); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetViewershipMetrics.java b/src/main/java/studio/livepeer/livepeer/operations/GetViewershipMetrics.java new file mode 100644 index 00000000..a3dff23a --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetViewershipMetrics.java @@ -0,0 +1,264 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.ViewershipMetric; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetViewershipMetricsRequest; +import studio.livepeer.livepeer.models.operations.GetViewershipMetricsResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetViewershipMetrics { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getViewershipMetrics", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getViewershipMetrics", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getViewershipMetrics", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/data/views/query"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + + req.addQueryParams(Utils.getQueryParams( + klass, + request, + null)); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetViewershipMetricsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetViewershipMetricsRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetViewershipMetricsRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetViewershipMetricsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetViewershipMetricsResponse.Builder resBuilder = + GetViewershipMetricsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetViewershipMetricsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetViewershipMetricsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetViewershipMetricsRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetViewershipMetricsRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetViewershipMetricsResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetViewershipMetricsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetViewershipMetricsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetWebhook.java b/src/main/java/studio/livepeer/livepeer/operations/GetWebhook.java new file mode 100644 index 00000000..02287778 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetWebhook.java @@ -0,0 +1,260 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Webhook; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetWebhookRequest; +import studio.livepeer.livepeer.models.operations.GetWebhookResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetWebhook { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWebhook", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWebhook", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWebhook", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/webhook/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetWebhookRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetWebhookRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetWebhookRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetWebhookResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetWebhookResponse.Builder resBuilder = + GetWebhookResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetWebhookResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withWebhook(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetWebhookRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetWebhookRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetWebhookRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetWebhookResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetWebhookResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetWebhookResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withWebhook); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetWebhookLog.java b/src/main/java/studio/livepeer/livepeer/operations/GetWebhookLog.java new file mode 100644 index 00000000..38af5713 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetWebhookLog.java @@ -0,0 +1,260 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.WebhookLog; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetWebhookLogRequest; +import studio.livepeer.livepeer.models.operations.GetWebhookLogResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetWebhookLog { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWebhookLog", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWebhookLog", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWebhookLog", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/webhook/{id}/log/{logId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetWebhookLogRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetWebhookLogRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetWebhookLogRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetWebhookLogResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetWebhookLogResponse.Builder resBuilder = + GetWebhookLogResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetWebhookLogResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withWebhookLog(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetWebhookLogRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetWebhookLogRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetWebhookLogRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetWebhookLogResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetWebhookLogResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetWebhookLogResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withWebhookLog); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetWebhookLogs.java b/src/main/java/studio/livepeer/livepeer/operations/GetWebhookLogs.java new file mode 100644 index 00000000..b838f6d2 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetWebhookLogs.java @@ -0,0 +1,261 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.WebhookLog; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetWebhookLogsRequest; +import studio.livepeer.livepeer.models.operations.GetWebhookLogsResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetWebhookLogs { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWebhookLogs", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWebhookLogs", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWebhookLogs", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/webhook/{id}/log", + request, null); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(GetWebhookLogsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetWebhookLogsRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(GetWebhookLogsRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetWebhookLogsResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetWebhookLogsResponse.Builder resBuilder = + GetWebhookLogsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetWebhookLogsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(GetWebhookLogsRequest request) throws Exception { + HttpRequest req = buildRequest(request, GetWebhookLogsRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(GetWebhookLogsRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetWebhookLogsResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetWebhookLogsResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetWebhookLogsResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/GetWebhooks.java b/src/main/java/studio/livepeer/livepeer/operations/GetWebhooks.java new file mode 100644 index 00000000..a795b40c --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/GetWebhooks.java @@ -0,0 +1,258 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestlessOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestlessOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Webhook; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.GetWebhooksResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class GetWebhooks { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWebhooks", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWebhooks", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "getWebhooks", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest() throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/webhook"); + HTTPRequest req = new HTTPRequest(url, "GET"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestlessOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest() { + HttpRequest r = unchecked(() -> onBuildRequest()).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public GetWebhooksResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetWebhooksResponse.Builder resBuilder = + GetWebhooksResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + GetWebhooksResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference>() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestlessOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest() throws Exception { + HttpRequest req = buildRequest(); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest() { + return unchecked(() -> onBuildRequest()).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.GetWebhooksResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.GetWebhooksResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.GetWebhooksResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference>() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/Operations.java b/src/main/java/studio/livepeer/livepeer/operations/Operations.java new file mode 100644 index 00000000..a027d5dd --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/Operations.java @@ -0,0 +1,56 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import studio.livepeer.livepeer.utils.Blob; + +import java.io.InputStream; +import java.net.http.HttpResponse; +import java.util.concurrent.CompletableFuture; + +// Internal API only + +public class Operations { + /** + * Base interface for all operations + */ + public interface Operation { + ResT handleResponse(HttpResponse response); + } + + /** + * Interface for operations that require a request parameter + */ + public interface RequestOperation extends Operation { + HttpResponse doRequest(ReqT request); + } + + /** + * Interface for operations that don't require a request parameter + */ + public interface RequestlessOperation extends Operation { + HttpResponse doRequest(); + } + + /** + * Base interface for all async operations + */ + public interface AsyncOperation { + CompletableFuture handleResponse(HttpResponse response); + } + + /** + * Interface for async operations that require a request parameter + */ + public interface AsyncRequestOperation extends AsyncOperation { + CompletableFuture> doRequest(ReqT request); + } + + /** + * Interface for async operations that don't require a request parameter + */ + public interface AsyncRequestlessOperation extends AsyncOperation { + CompletableFuture> doRequest(); + } +} \ No newline at end of file diff --git a/src/main/java/studio/livepeer/livepeer/operations/RemoveMultistreamTarget.java b/src/main/java/studio/livepeer/livepeer/operations/RemoveMultistreamTarget.java new file mode 100644 index 00000000..e4cf6ec3 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/RemoveMultistreamTarget.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.RemoveMultistreamTargetRequest; +import studio.livepeer.livepeer.models.operations.RemoveMultistreamTargetResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class RemoveMultistreamTarget { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "removeMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "removeMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "removeMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/stream/{id}/multistream/{targetId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "DELETE"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(RemoveMultistreamTargetRequest request) throws Exception { + HttpRequest req = buildRequest(request, RemoveMultistreamTargetRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(RemoveMultistreamTargetRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public RemoveMultistreamTargetResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + RemoveMultistreamTargetResponse.Builder resBuilder = + RemoveMultistreamTargetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + RemoveMultistreamTargetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(RemoveMultistreamTargetRequest request) throws Exception { + HttpRequest req = buildRequest(request, RemoveMultistreamTargetRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(RemoveMultistreamTargetRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.RemoveMultistreamTargetResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.RemoveMultistreamTargetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.RemoveMultistreamTargetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/RequestUpload.java b/src/main/java/studio/livepeer/livepeer/operations/RequestUpload.java new file mode 100644 index 00000000..76ddd87c --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/RequestUpload.java @@ -0,0 +1,275 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.NewAssetPayload; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.RequestUploadData; +import studio.livepeer.livepeer.models.operations.RequestUploadResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class RequestUpload { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "requestUpload", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "requestUpload", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "requestUpload", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/asset/request-upload"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(NewAssetPayload request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(NewAssetPayload request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public RequestUploadResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + RequestUploadResponse.Builder resBuilder = + RequestUploadResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + RequestUploadResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withData(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(NewAssetPayload request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(NewAssetPayload request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.RequestUploadResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.RequestUploadResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.RequestUploadResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/ResendWebhook.java b/src/main/java/studio/livepeer/livepeer/operations/ResendWebhook.java new file mode 100644 index 00000000..36fc1339 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/ResendWebhook.java @@ -0,0 +1,260 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.WebhookLog; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.ResendWebhookRequest; +import studio.livepeer.livepeer.models.operations.ResendWebhookResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class ResendWebhook { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "resendWebhook", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "resendWebhook", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "resendWebhook", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/webhook/{id}/log/{logId}/resend", + request, null); + HTTPRequest req = new HTTPRequest(url, "POST"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(ResendWebhookRequest request) throws Exception { + HttpRequest req = buildRequest(request, ResendWebhookRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(ResendWebhookRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public ResendWebhookResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ResendWebhookResponse.Builder resBuilder = + ResendWebhookResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + ResendWebhookResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withWebhookLog(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(ResendWebhookRequest request) throws Exception { + HttpRequest req = buildRequest(request, ResendWebhookRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(ResendWebhookRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.ResendWebhookResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.ResendWebhookResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.ResendWebhookResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withWebhookLog); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/StartPullStream.java b/src/main/java/studio/livepeer/livepeer/operations/StartPullStream.java new file mode 100644 index 00000000..307c9a56 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/StartPullStream.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.StartPullStreamRequest; +import studio.livepeer.livepeer.models.operations.StartPullStreamResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class StartPullStream { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "startPullStream", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "startPullStream", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "startPullStream", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/stream/{id}/start-pull", + request, null); + HTTPRequest req = new HTTPRequest(url, "POST"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(StartPullStreamRequest request) throws Exception { + HttpRequest req = buildRequest(request, StartPullStreamRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(StartPullStreamRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public StartPullStreamResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + StartPullStreamResponse.Builder resBuilder = + StartPullStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + StartPullStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(StartPullStreamRequest request) throws Exception { + HttpRequest req = buildRequest(request, StartPullStreamRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(StartPullStreamRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.StartPullStreamResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.StartPullStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.StartPullStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/StartRoomEgress.java b/src/main/java/studio/livepeer/livepeer/operations/StartRoomEgress.java new file mode 100644 index 00000000..8ee314e8 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/StartRoomEgress.java @@ -0,0 +1,269 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.StartRoomEgressRequest; +import studio.livepeer.livepeer.models.operations.StartRoomEgressResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class StartRoomEgress { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "startRoomEgress", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "startRoomEgress", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "startRoomEgress", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/room/{id}/egress", + request, null); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "roomEgressPayload", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(StartRoomEgressRequest request) throws Exception { + HttpRequest req = buildRequest(request, StartRoomEgressRequest.class, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(StartRoomEgressRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public StartRoomEgressResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + StartRoomEgressResponse.Builder resBuilder = + StartRoomEgressResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + StartRoomEgressResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(StartRoomEgressRequest request) throws Exception { + HttpRequest req = buildRequest(request, StartRoomEgressRequest.class, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(StartRoomEgressRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.StartRoomEgressResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.StartRoomEgressResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.StartRoomEgressResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/StopRoomEgress.java b/src/main/java/studio/livepeer/livepeer/operations/StopRoomEgress.java new file mode 100644 index 00000000..632b61f0 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/StopRoomEgress.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.StopRoomEgressRequest; +import studio.livepeer.livepeer.models.operations.StopRoomEgressResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class StopRoomEgress { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "stopRoomEgress", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "stopRoomEgress", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "stopRoomEgress", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/room/{id}/egress", + request, null); + HTTPRequest req = new HTTPRequest(url, "DELETE"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(StopRoomEgressRequest request) throws Exception { + HttpRequest req = buildRequest(request, StopRoomEgressRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(StopRoomEgressRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public StopRoomEgressResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + StopRoomEgressResponse.Builder resBuilder = + StopRoomEgressResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + StopRoomEgressResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(StopRoomEgressRequest request) throws Exception { + HttpRequest req = buildRequest(request, StopRoomEgressRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(StopRoomEgressRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.StopRoomEgressResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.StopRoomEgressResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.StopRoomEgressResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/TerminateStream.java b/src/main/java/studio/livepeer/livepeer/operations/TerminateStream.java new file mode 100644 index 00000000..b640cde4 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/TerminateStream.java @@ -0,0 +1,252 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.TerminateStreamRequest; +import studio.livepeer.livepeer.models.operations.TerminateStreamResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.Utils; + + +public class TerminateStream { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "terminateStream", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "terminateStream", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "terminateStream", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/stream/{id}/terminate", + request, null); + HTTPRequest req = new HTTPRequest(url, "DELETE"); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(TerminateStreamRequest request) throws Exception { + HttpRequest req = buildRequest(request, TerminateStreamRequest.class); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(TerminateStreamRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public TerminateStreamResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + TerminateStreamResponse.Builder resBuilder = + TerminateStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + TerminateStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(TerminateStreamRequest request) throws Exception { + HttpRequest req = buildRequest(request, TerminateStreamRequest.class); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(TerminateStreamRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.TerminateStreamResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.TerminateStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.TerminateStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/TranscodeVideo.java b/src/main/java/studio/livepeer/livepeer/operations/TranscodeVideo.java new file mode 100644 index 00000000..25121a5f --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/TranscodeVideo.java @@ -0,0 +1,275 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Task; +import studio.livepeer.livepeer.models.components.TranscodePayload; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.TranscodeVideoResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class TranscodeVideo { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "transcodeVideo", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "transcodeVideo", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "transcodeVideo", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/transcode"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(TranscodePayload request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(TranscodePayload request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public TranscodeVideoResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + TranscodeVideoResponse.Builder resBuilder = + TranscodeVideoResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + TranscodeVideoResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withTask(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(TranscodePayload request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(TranscodePayload request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.TranscodeVideoResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.TranscodeVideoResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.TranscodeVideoResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withTask); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/UpdateAsset.java b/src/main/java/studio/livepeer/livepeer/operations/UpdateAsset.java new file mode 100644 index 00000000..73a9817e --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/UpdateAsset.java @@ -0,0 +1,277 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Asset; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.UpdateAssetRequest; +import studio.livepeer.livepeer.models.operations.UpdateAssetResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class UpdateAsset { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateAsset", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateAsset", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateAsset", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/asset/{assetId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "PATCH"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "assetPatchPayload", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(UpdateAssetRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateAssetRequest.class, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(UpdateAssetRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public UpdateAssetResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UpdateAssetResponse.Builder resBuilder = + UpdateAssetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UpdateAssetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withAsset(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(UpdateAssetRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateAssetRequest.class, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(UpdateAssetRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.UpdateAssetResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.UpdateAssetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.UpdateAssetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withAsset); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/UpdateMultistreamTarget.java b/src/main/java/studio/livepeer/livepeer/operations/UpdateMultistreamTarget.java new file mode 100644 index 00000000..58b9c5d0 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/UpdateMultistreamTarget.java @@ -0,0 +1,269 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.UpdateMultistreamTargetRequest; +import studio.livepeer.livepeer.models.operations.UpdateMultistreamTargetResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class UpdateMultistreamTarget { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateMultistreamTarget", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/multistream/target/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "PATCH"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "multistreamTarget", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(UpdateMultistreamTargetRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateMultistreamTargetRequest.class, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(UpdateMultistreamTargetRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public UpdateMultistreamTargetResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UpdateMultistreamTargetResponse.Builder resBuilder = + UpdateMultistreamTargetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UpdateMultistreamTargetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(UpdateMultistreamTargetRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateMultistreamTargetRequest.class, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(UpdateMultistreamTargetRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.UpdateMultistreamTargetResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.UpdateMultistreamTargetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.UpdateMultistreamTargetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/UpdateRoomUser.java b/src/main/java/studio/livepeer/livepeer/operations/UpdateRoomUser.java new file mode 100644 index 00000000..13b2dcd2 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/UpdateRoomUser.java @@ -0,0 +1,269 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.UpdateRoomUserRequest; +import studio.livepeer.livepeer.models.operations.UpdateRoomUserResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class UpdateRoomUser { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateRoomUser", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateRoomUser", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateRoomUser", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/room/{id}/user/{userId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "PUT"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "roomUserUpdatePayload", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(UpdateRoomUserRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateRoomUserRequest.class, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(UpdateRoomUserRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public UpdateRoomUserResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UpdateRoomUserResponse.Builder resBuilder = + UpdateRoomUserResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UpdateRoomUserResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(UpdateRoomUserRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateRoomUserRequest.class, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(UpdateRoomUserRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.UpdateRoomUserResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.UpdateRoomUserResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.UpdateRoomUserResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/UpdateSigningKey.java b/src/main/java/studio/livepeer/livepeer/operations/UpdateSigningKey.java new file mode 100644 index 00000000..5624eac7 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/UpdateSigningKey.java @@ -0,0 +1,269 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.UpdateSigningKeyRequest; +import studio.livepeer.livepeer.models.operations.UpdateSigningKeyResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class UpdateSigningKey { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateSigningKey", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateSigningKey", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateSigningKey", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/access-control/signing-key/{keyId}", + request, null); + HTTPRequest req = new HTTPRequest(url, "PATCH"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "requestBody", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(UpdateSigningKeyRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateSigningKeyRequest.class, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(UpdateSigningKeyRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public UpdateSigningKeyResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UpdateSigningKeyResponse.Builder resBuilder = + UpdateSigningKeyResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UpdateSigningKeyResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(UpdateSigningKeyRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateSigningKeyRequest.class, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(UpdateSigningKeyRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.UpdateSigningKeyResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.UpdateSigningKeyResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.UpdateSigningKeyResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/UpdateStream.java b/src/main/java/studio/livepeer/livepeer/operations/UpdateStream.java new file mode 100644 index 00000000..b9966f26 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/UpdateStream.java @@ -0,0 +1,269 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.UpdateStreamRequest; +import studio.livepeer.livepeer.models.operations.UpdateStreamResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class UpdateStream { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateStream", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateStream", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateStream", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/stream/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "PATCH"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "streamPatchPayload", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(UpdateStreamRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateStreamRequest.class, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(UpdateStreamRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public UpdateStreamResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UpdateStreamResponse.Builder resBuilder = + UpdateStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UpdateStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return res; + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(UpdateStreamRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateStreamRequest.class, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(UpdateStreamRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.UpdateStreamResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.UpdateStreamResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.UpdateStreamResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "204")) { + // no content + return CompletableFuture.completedFuture(res); + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/UpdateWebhook.java b/src/main/java/studio/livepeer/livepeer/operations/UpdateWebhook.java new file mode 100644 index 00000000..fd164830 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/UpdateWebhook.java @@ -0,0 +1,277 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.Webhook; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.UpdateWebhookRequest; +import studio.livepeer.livepeer.models.operations.UpdateWebhookResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class UpdateWebhook { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateWebhook", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateWebhook", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "updateWebhook", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, Class klass, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + klass, + this.baseUrl, + "/webhook/{id}", + request, null); + HTTPRequest req = new HTTPRequest(url, "PUT"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "webhook", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(UpdateWebhookRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateWebhookRequest.class, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(UpdateWebhookRequest request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public UpdateWebhookResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UpdateWebhookResponse.Builder resBuilder = + UpdateWebhookResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UpdateWebhookResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withWebhook(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(UpdateWebhookRequest request) throws Exception { + HttpRequest req = buildRequest(request, UpdateWebhookRequest.class, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(UpdateWebhookRequest request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.UpdateWebhookResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.UpdateWebhookResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.UpdateWebhookResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withWebhook); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/operations/UploadAsset.java b/src/main/java/studio/livepeer/livepeer/operations/UploadAsset.java new file mode 100644 index 00000000..b9f5eafe --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/operations/UploadAsset.java @@ -0,0 +1,291 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.operations; + +import static studio.livepeer.livepeer.operations.Operations.RequestOperation; +import static studio.livepeer.livepeer.utils.Exceptions.unchecked; +import static studio.livepeer.livepeer.operations.Operations.AsyncRequestOperation; + +import com.fasterxml.jackson.core.type.TypeReference; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.IllegalArgumentException; +import java.lang.Object; +import java.lang.String; +import java.lang.Throwable; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import studio.livepeer.livepeer.SDKConfiguration; +import studio.livepeer.livepeer.SecuritySource; +import studio.livepeer.livepeer.models.components.Error; +import studio.livepeer.livepeer.models.components.NewAssetFromUrlPayload; +import studio.livepeer.livepeer.models.errors.SDKException; +import studio.livepeer.livepeer.models.operations.UploadAssetData; +import studio.livepeer.livepeer.models.operations.UploadAssetDataOutput; +import studio.livepeer.livepeer.models.operations.UploadAssetResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.HTTPClient; +import studio.livepeer.livepeer.utils.HTTPRequest; +import studio.livepeer.livepeer.utils.Headers; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContextImpl; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContextImpl; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContextImpl; +import studio.livepeer.livepeer.utils.SerializedBody; +import studio.livepeer.livepeer.utils.Utils.JsonShape; +import studio.livepeer.livepeer.utils.Utils; + + +public class UploadAsset { + + static abstract class Base { + final SDKConfiguration sdkConfiguration; + final String baseUrl; + final SecuritySource securitySource; + final HTTPClient client; + final Headers _headers; + + public Base(SDKConfiguration sdkConfiguration, Headers _headers) { + this.sdkConfiguration = sdkConfiguration; + this._headers =_headers; + this.baseUrl = this.sdkConfiguration.serverUrl(); + this.securitySource = this.sdkConfiguration.securitySource(); + this.client = this.sdkConfiguration.client(); + } + + Optional securitySource() { + return Optional.ofNullable(this.securitySource); + } + + BeforeRequestContextImpl createBeforeRequestContext() { + return new BeforeRequestContextImpl( + this.sdkConfiguration, + this.baseUrl, + "uploadAsset", + java.util.Optional.empty(), + securitySource()); + } + + AfterSuccessContextImpl createAfterSuccessContext() { + return new AfterSuccessContextImpl( + this.sdkConfiguration, + this.baseUrl, + "uploadAsset", + java.util.Optional.empty(), + securitySource()); + } + + AfterErrorContextImpl createAfterErrorContext() { + return new AfterErrorContextImpl( + this.sdkConfiguration, + this.baseUrl, + "uploadAsset", + java.util.Optional.empty(), + securitySource()); + } + HttpRequest buildRequest(T request, TypeReference typeReference) throws Exception { + String url = Utils.generateURL( + this.baseUrl, + "/asset/upload/url"); + HTTPRequest req = new HTTPRequest(url, "POST"); + Object convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + typeReference); + SerializedBody serializedRequestBody = Utils.serializeRequestBody( + convertedRequest, + "request", + "json", + false); + if (serializedRequestBody == null) { + throw new IllegalArgumentException("Request body is required"); + } + req.setBody(Optional.ofNullable(serializedRequestBody)); + req.addHeader("Accept", "application/json") + .addHeader("user-agent", SDKConfiguration.USER_AGENT); + _headers.forEach((k, list) -> list.forEach(v -> req.addHeader(k, v))); + Utils.configureSecurity(req, this.sdkConfiguration.securitySource().getSecurity()); + + return req.build(); + } + } + + public static class Sync extends Base + implements RequestOperation { + public Sync(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private HttpRequest onBuildRequest(NewAssetFromUrlPayload request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return sdkConfiguration.hooks().beforeRequest(createBeforeRequestContext(), req); + } + + private HttpResponse onError(HttpResponse response, Exception error) throws Exception { + return sdkConfiguration.hooks().afterError( + createAfterErrorContext(), + Optional.ofNullable(response), + Optional.ofNullable(error)); + } + + private HttpResponse onSuccess(HttpResponse response) throws Exception { + return sdkConfiguration.hooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public HttpResponse doRequest(NewAssetFromUrlPayload request) { + HttpRequest r = unchecked(() -> onBuildRequest(request)).get(); + HttpResponse httpRes; + try { + httpRes = client.send(r); + if (Utils.statusCodeMatches(httpRes.statusCode(), "4XX", "5XX")) { + httpRes = onError(httpRes, null); + } else { + httpRes = onSuccess(httpRes); + } + } catch (Exception e) { + httpRes = unchecked(() -> onError(null, e)).get(); + } + + return httpRes; + } + + + @Override + public UploadAssetResponse handleResponse(HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UploadAssetResponse.Builder resBuilder = + UploadAssetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + UploadAssetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withTwoHundredApplicationJsonData(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "201")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withTwoHundredAndOneApplicationJsonData(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + throw SDKException.from("API error occurred", response); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return res.withError(Utils.unmarshal(response, new TypeReference() {})); + } else { + throw SDKException.from("Unexpected content-type received: " + contentType, response); + } + } + throw SDKException.from("Unexpected status code received: " + response.statusCode(), response); + } + } + public static class Async extends Base + implements AsyncRequestOperation { + + public Async(SDKConfiguration sdkConfiguration, Headers _headers) { + super(sdkConfiguration, _headers); + } + + private CompletableFuture onBuildRequest(NewAssetFromUrlPayload request) throws Exception { + HttpRequest req = buildRequest(request, new TypeReference() {}); + return this.sdkConfiguration.asyncHooks().beforeRequest(createBeforeRequestContext(), req); + } + + private CompletableFuture> onError(HttpResponse response, Throwable error) { + return this.sdkConfiguration.asyncHooks().afterError(createAfterErrorContext(), response, error); + } + + private CompletableFuture> onSuccess(HttpResponse response) { + return this.sdkConfiguration.asyncHooks().afterSuccess(createAfterSuccessContext(), response); + } + + @Override + public CompletableFuture> doRequest(NewAssetFromUrlPayload request) { + return unchecked(() -> onBuildRequest(request)).get().thenCompose(client::sendAsync) + .handle((resp, err) -> { + if (err != null) { + return onError(null, err); + } + if (Utils.statusCodeMatches(resp.statusCode(), "4XX", "5XX")) { + return onError(resp, null); + } + return CompletableFuture.completedFuture(resp); + }) + .thenCompose(Function.identity()) + .thenCompose(this::onSuccess); + } + + @Override + public CompletableFuture handleResponse( + HttpResponse response) { + String contentType = response + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + studio.livepeer.livepeer.models.operations.async.UploadAssetResponse.Builder resBuilder = + studio.livepeer.livepeer.models.operations.async.UploadAssetResponse + .builder() + .contentType(contentType) + .statusCode(response.statusCode()) + .rawResponse(response); + + studio.livepeer.livepeer.models.operations.async.UploadAssetResponse res = resBuilder.build(); + + if (Utils.statusCodeMatches(response.statusCode(), "200")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withTwoHundredApplicationJsonData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "201")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withTwoHundredAndOneApplicationJsonData); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + if (Utils.statusCodeMatches(response.statusCode(), "4XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "5XX")) { + // no content + return Utils.createAsyncApiError(response, "API error occurred"); + } + if (Utils.statusCodeMatches(response.statusCode(), "default")) { + if (Utils.contentTypeMatches(contentType, "application/json")) { + return Utils.unmarshalAsync(response, new TypeReference() {}) + .thenApply(res::withError); + } else { + return Utils.createAsyncApiError(response, "Unexpected content-type received: " + contentType); + } + } + return Utils.createAsyncApiError(response, "Unexpected status code received: " + response.statusCode()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/AsyncHook.java b/src/main/java/studio/livepeer/livepeer/utils/AsyncHook.java new file mode 100644 index 00000000..9755a37f --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/AsyncHook.java @@ -0,0 +1,100 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + + +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.concurrent.CompletableFuture; +import java.util.Optional; +import java.util.UUID; + +/** + * Utility class for defining async hook interfaces. + */ +public final class AsyncHook { + + private AsyncHook() { + // prevent instantiation + } + + /** + * Specifies how a request is transformed before sending. + */ + @FunctionalInterface + public interface BeforeRequest { + + /** + * Transforms the given {@link HttpRequest} before sending. + * + *

Note that {@link HttpRequest} is immutable. To modify the request you can use + * {@code HttpRequest#newBuilder(HttpRequest, BiPredicate)} with + * JDK 16 and later (which will copy the request for modification in a builder). + * If that method is not available then use {@link Helpers#copy} (which also returns + * a builder). + * + * @param context context for the hook call + * @param request request to be transformed + * @return transformed request + */ + CompletableFuture beforeRequest(Hook.BeforeRequestContext context, HttpRequest request); + + BeforeRequest DEFAULT = (context, request) -> CompletableFuture.completedFuture(request); + } + + /** + * Specifies how a response is transformed before response processing. + */ + @FunctionalInterface + public interface AfterSuccess { + + /** + * Transforms the given response before response processing occurs. + * + * @param context context for the hook call + * @param response response to be transformed + * @return transformed response + */ + CompletableFuture> afterSuccess(Hook.AfterSuccessContext context, HttpResponse response); + + AfterSuccess DEFAULT = (context, response) -> CompletableFuture.completedFuture(response); + } + + /** + * Specifies what happens if a request action throws an Exception. + */ + @FunctionalInterface + public interface AfterError { + + /** + * Either returns an HttpResponse or throws an Exception. Must be passed either + * a response or an error (both can't be absent). + * + * @param context context for the error + * @param response response information if available. + * @param error the optional exception. If response present then the error is for-info + * only, it was the last error in the chain of AfterError hook + * calls leading to this one + * @return HTTP response if method decides that an exception is not to be thrown + */ + CompletableFuture> afterError( + Hook.AfterErrorContext context, + HttpResponse response, + Throwable error); + + AfterError DEFAULT = (context, response, error) -> Optional.ofNullable(response) + .map(CompletableFuture::completedFuture) + .orElse(CompletableFuture.failedFuture(error)); + } + + public static final class IdempotencyHook implements BeforeRequest { + + @Override + public CompletableFuture beforeRequest(Hook.BeforeRequestContext context, HttpRequest request) { + HttpRequest.Builder b = Helpers.copy(request); + b.header("Idempotency-Key", UUID.randomUUID().toString()); + return CompletableFuture.completedFuture(b.build()); + } + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/AsyncHooks.java b/src/main/java/studio/livepeer/livepeer/utils/AsyncHooks.java new file mode 100644 index 00000000..13de5c7c --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/AsyncHooks.java @@ -0,0 +1,166 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import java.net.http.HttpResponse; +import java.net.http.HttpRequest; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicBoolean; + +import studio.livepeer.livepeer.utils.AsyncHook.AfterError; +import studio.livepeer.livepeer.utils.AsyncHook.AfterSuccess; +import studio.livepeer.livepeer.utils.AsyncHook.BeforeRequest; +import studio.livepeer.livepeer.utils.Hook.AfterErrorContext; +import studio.livepeer.livepeer.utils.Hook.AfterSuccessContext; +import studio.livepeer.livepeer.utils.Hook.BeforeRequestContext; +import studio.livepeer.livepeer.utils.Hooks.FailEarlyException; +import studio.livepeer.livepeer.utils.Blob; + +/** + * Async hook registry for runtime request/response processing. + * + *

Example usage: + *

+ * asyncHooks.registerBeforeRequest((context, request) ->
+ *     CompletableFuture.completedFuture(
+ *         Helpers.copy(request)
+ *             .header("transaction-id", UUID.randomUUID().toString())
+ *             .build()));
+ * 
+ */ +// ThreadSafe +public class AsyncHooks implements BeforeRequest, AfterSuccess, AfterError { + + // we use CopyOnWriteArrayList for thread safety + private final List beforeRequestHooks = new CopyOnWriteArrayList<>(); + private final List afterSuccessHooks = new CopyOnWriteArrayList<>(); + private final List afterErrorHooks = new CopyOnWriteArrayList<>(); + + public AsyncHooks() { + } + + /** + * Registers an async before-request hook. Hooks are chained in registration order. + * + * @param beforeRequest async hook returning {@code CompletableFuture} + * @return this + */ + public AsyncHooks registerBeforeRequest(BeforeRequest beforeRequest) { + Utils.checkNotNull(beforeRequest, "beforeRequest"); + this.beforeRequestHooks.add(beforeRequest); + return this; + } + + /** + * Registers an async after-success hook. Hooks are chained in registration order. + * + * @param afterSuccess async hook returning {@code CompletableFuture} + * @return this + */ + public AsyncHooks registerAfterSuccess(AfterSuccess afterSuccess) { + Utils.checkNotNull(afterSuccess, "afterSuccess"); + this.afterSuccessHooks.add(afterSuccess); + return this; + } + + /** + * Registers an async after-error hook. Hooks are chained in registration order. + * + * @param afterError async hook for error handling + * @return this + */ + public AsyncHooks registerAfterError(AfterError afterError) { + Utils.checkNotNull(afterError, "afterError"); + this.afterErrorHooks.add(afterError); + return this; + } + + @Override + public CompletableFuture beforeRequest(BeforeRequestContext context, HttpRequest request) { + Utils.checkNotNull(context, "context"); + Utils.checkNotNull(request, "request"); + + CompletableFuture result = CompletableFuture.completedFuture(request); + + for (BeforeRequest hook : beforeRequestHooks) { + result = result.thenCompose(req -> hook.beforeRequest(context, req)); + } + + return result; + } + + @Override + public CompletableFuture> afterSuccess( + AfterSuccessContext context, + HttpResponse response) { + Utils.checkNotNull(context, "context"); + Utils.checkNotNull(response, "response"); + + CompletableFuture> result = CompletableFuture.completedFuture(response); + + for (AfterSuccess hook : afterSuccessHooks) { + result = result.handle((resp, ex) -> + hook.afterSuccess(context, resp) + .thenApply(hookResp -> { + if (hookResp == null) { + throw new IllegalStateException( + "afterSuccess must return a non-null response"); + } + return hookResp; + }) + ).thenCompose(future -> future); + } + + return result; + } + + @Override + public CompletableFuture> afterError( + AfterErrorContext context, + HttpResponse response, + Throwable error) { + Utils.checkNotNull(context, "context"); + Utils.checkArgument( + (response != null) ^ (error != null), + "one and only one of response or error must be present"); + + CompletableFuture> result; + if (response != null) { + result = CompletableFuture.completedFuture(response); + } else { + result = CompletableFuture.failedFuture(error); + } + + AtomicBoolean failedEarly = new AtomicBoolean(false); + for (AfterError hook : afterErrorHooks) { + result = result.handle((resp, ex) -> { + if (failedEarly.get()) { + throw (FailEarlyException) ex; + } + return hook.afterError(context, resp, ex) + .handle((hookResp, hookErr) -> { + if (hookErr != null) { + if (hookErr instanceof FailEarlyException) { + failedEarly.set(true); + throw (FailEarlyException) hookErr; + } + throw Exceptions.unchecked(hookErr); + } + if (hookResp == null) { + throw new IllegalStateException( + "afterError must either throw an exception or return a non-null response"); + } + + return hookResp; + }); + } + ).thenCompose(future -> future); + } + + return result; + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/AsyncResponse.java b/src/main/java/studio/livepeer/livepeer/utils/AsyncResponse.java new file mode 100644 index 00000000..16b64603 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/AsyncResponse.java @@ -0,0 +1,24 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; +import studio.livepeer.livepeer.utils.Blob; +import java.net.http.HttpResponse; + +public interface AsyncResponse { + + /** + * Returns the value of the Content-Type header. + **/ + String contentType(); + + /** + * Returns the HTTP status code. + **/ + int statusCode(); + + /** + * Returns the raw response. + **/ + HttpResponse rawResponse(); +} \ No newline at end of file diff --git a/src/main/java/studio/livepeer/livepeer/utils/AsyncRetries.java b/src/main/java/studio/livepeer/livepeer/utils/AsyncRetries.java new file mode 100644 index 00000000..3844cd62 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/AsyncRetries.java @@ -0,0 +1,204 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import java.io.IOException; +import java.net.ConnectException; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.time.Instant; +import java.util.List; +import java.util.concurrent.*; +import java.util.function.Supplier; +import studio.livepeer.livepeer.utils.Blob; + +public class AsyncRetries { + + private final RetryConfig retryConfig; + private final List retriableStatusCodes; + private final ScheduledExecutorService scheduler; + + private AsyncRetries(RetryConfig retryConfig, + List retriableStatusCodes, + ScheduledExecutorService scheduler) { + Utils.checkNotNull(retryConfig, "retryConfig"); + Utils.checkNotNull(retriableStatusCodes, "statusCodes"); + if (retriableStatusCodes.isEmpty()) { + throw new IllegalArgumentException("statusCodes list cannot be empty"); + } + this.retryConfig = retryConfig; + this.retriableStatusCodes = retriableStatusCodes; + this.scheduler = scheduler; + } + + public CompletableFuture> retry( + Supplier>> task + ) { + switch (retryConfig.strategy()) { + case BACKOFF: + CompletableFuture> future = new CompletableFuture<>(); + BackoffStrategy backoff = retryConfig.backoff() + // We want to fail fast during misconfigurations. + .orElseThrow(() -> new IllegalArgumentException("Backoff strategy is not defined")); + attempt(task, future, backoff, new State(0, Instant.now())); + return future; + case NONE: + return task.get(); + default: + throw new IllegalArgumentException("Unsupported retry strategy: " + retryConfig.strategy()); + } + } + + private void attempt(Supplier>> task, + CompletableFuture> result, + BackoffStrategy backoff, + State state) { + task.get().whenComplete((response, throwable) -> { + if (throwable == null) { + boolean matched = retriableStatusCodes.stream() + .anyMatch(pattern -> Utils.statusCodeMatches(response.statusCode(), pattern)); + if (matched) { + maybeRetry(task, result, backoff, state, new AsyncRetryableException(response)); + return; + } + result.complete(response); + return; + } + // Unwrap + Throwable e = (throwable instanceof CompletionException) ? throwable.getCause() : throwable; + if (e instanceof AsyncRetryableException) { + maybeRetry(task, result, backoff, state, e); + return; + } + if (e instanceof IOException) { + if (shouldRetryIOException(e, backoff)) { + maybeRetry(task, result, backoff, state, e); + return; + } + } + result.completeExceptionally(new NonRetryableException(e)); + }); + } + + private boolean shouldRetryIOException(Throwable e, BackoffStrategy backoff) { + if (e instanceof ConnectException && backoff.retryConnectError()) return true; + String message = e.getMessage(); + if (message == null) return false; + return (message.contains("Connect timed out") && backoff.retryConnectError()) + || (message.contains("Read timed out") && backoff.retryReadTimeoutError()); + } + + private void maybeRetry(Supplier>> task, + CompletableFuture> result, + BackoffStrategy backoff, + State state, + Throwable e) { + Duration timeSinceStart = Duration.between(state.startedAt(), Instant.now()); + if (timeSinceStart.toMillis() > backoff.maxElapsedTimeMs()) { + // retry exhausted + if (e instanceof AsyncRetryableException) { + result.complete(((AsyncRetryableException) e).response()); + return; + } + result.completeExceptionally(e); + return; + } + + double intervalMs = backoff.initialIntervalMs() * Math.pow(backoff.baseFactor(), state.count()); + double jitterMs = backoff.jitterFactor() * intervalMs; + intervalMs = intervalMs - jitterMs + Math.random() * (2 * jitterMs + 1); + intervalMs = Math.min(intervalMs, backoff.maxIntervalMs()); + + scheduler.schedule( + () -> attempt(task, result, backoff, state.countAttempt()), + (long) intervalMs, + TimeUnit.MILLISECONDS); + } + + public void shutdown() { + scheduler.shutdown(); + } + + public static Builder builder() { + return new Builder(); + } + + public final static class Builder { + + private RetryConfig retryConfig; + private List statusCodes; + private ScheduledExecutorService scheduler; + + private Builder() { + } + + /** + * Defines the retry configuration. + * + * @param retryConfig The retry configuration to use. + * @return The builder instance. + */ + public Builder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + /** + * Defines the status codes that should be considered as errors. + * + * @param statusCodes The list of status codes to treat as errors. + * @return The builder instance. + */ + public Builder statusCodes(List statusCodes) { + Utils.checkNotNull(statusCodes, "statusCodes"); + if (statusCodes.isEmpty()) { + throw new IllegalArgumentException("statusCodes list cannot be empty"); + } + this.statusCodes = statusCodes; + return this; + } + + /** + * Defines the scheduler that will be used to schedule and execute retry attempts. + * Recommend using a globally shared executor for this. + * + * @param scheduler An instance of {@link ScheduledExecutorService} + * @return The builder instance. + */ + public Builder scheduler(ScheduledExecutorService scheduler) { + Utils.checkNotNull(scheduler, "scheduler"); + this.scheduler = scheduler; + return this; + } + + public AsyncRetries build() { + return new AsyncRetries(retryConfig, statusCodes, scheduler); + } + } + + private static class State { + private long attempt; + private final Instant startedAt; + + public State(long attempt, Instant startedAt) { + this.attempt = attempt; + this.startedAt = startedAt; + } + + public long count() { + return attempt; + } + + public Instant startedAt() { + return startedAt; + } + + public State countAttempt() { + attempt++; + return this; + } + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/AsyncRetryableException.java b/src/main/java/studio/livepeer/livepeer/utils/AsyncRetryableException.java new file mode 100644 index 00000000..d090131d --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/AsyncRetryableException.java @@ -0,0 +1,20 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import studio.livepeer.livepeer.utils.Blob; + +import java.net.http.HttpResponse; + +public final class AsyncRetryableException extends Exception { + private final HttpResponse response; + + public AsyncRetryableException(HttpResponse response) { + this.response = response; + } + + public HttpResponse response() { + return response; + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/BackoffStrategy.java b/src/main/java/studio/livepeer/livepeer/utils/BackoffStrategy.java index 428b34a8..7a59bd5d 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/BackoffStrategy.java +++ b/src/main/java/studio/livepeer/livepeer/utils/BackoffStrategy.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/studio/livepeer/livepeer/utils/BigDecimalString.java b/src/main/java/studio/livepeer/livepeer/utils/BigDecimalString.java index e84308cf..cb7a3054 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/BigDecimalString.java +++ b/src/main/java/studio/livepeer/livepeer/utils/BigDecimalString.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.io.IOException; @@ -24,8 +23,8 @@ // Note that Jackson 2.16.1 does not support @JsonValue and @JsonFormat combined so we must use // a custom serializer/deserializer -@JsonSerialize(using = BigDecimalString.BigDecimalStringSerializer.class) -@JsonDeserialize(using = BigDecimalString.BigDecimalStringDeserializer.class) +@JsonSerialize(using = BigDecimalString.Serializer.class) +@JsonDeserialize(using = BigDecimalString.Deserializer.class) public class BigDecimalString { private final BigDecimal value; @@ -64,16 +63,11 @@ public boolean equals(Object obj) { return Objects.equals(value, other.value); } - public static final class BigDecimalStringSerializer extends StdSerializer { - - private static final long serialVersionUID = -3828937716095008071L; - - public BigDecimalStringSerializer() { - this(null); - } + @SuppressWarnings("serial") + public static final class Serializer extends StdSerializer { - public BigDecimalStringSerializer(Class t) { - super(t); + protected Serializer() { + super(BigDecimalString.class); } @Override @@ -83,16 +77,11 @@ public void serialize(BigDecimalString value, JsonGenerator g, SerializerProvide } } - public static final class BigDecimalStringDeserializer extends StdDeserializer { - - private static final long serialVersionUID = -2474225842945673085L; - - public BigDecimalStringDeserializer() { - this(null); - } + @SuppressWarnings("serial") + public static final class Deserializer extends StdDeserializer { - public BigDecimalStringDeserializer(Class t) { - super(t); + protected Deserializer() { + super(BigDecimalString.class); } @Override diff --git a/src/main/java/studio/livepeer/livepeer/utils/BigIntegerString.java b/src/main/java/studio/livepeer/livepeer/utils/BigIntegerString.java index e608e26b..6ddf5fb6 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/BigIntegerString.java +++ b/src/main/java/studio/livepeer/livepeer/utils/BigIntegerString.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.io.IOException; @@ -24,8 +23,8 @@ // Note that Jackson 2.16.1 does not support @JsonValue and @JsonFormat combined so we must use // a custom serializer/deserializer -@JsonSerialize(using = BigIntegerString.BigIntegerStringSerializer.class) -@JsonDeserialize(using = BigIntegerString.BigIntegerStringDeserializer.class) +@JsonSerialize(using = BigIntegerString.Serializer.class) +@JsonDeserialize(using = BigIntegerString.Deserializer.class) public class BigIntegerString { private final BigInteger value; @@ -64,16 +63,11 @@ public boolean equals(Object obj) { return Objects.equals(value, other.value); } - public static final class BigIntegerStringSerializer extends StdSerializer { - - private static final long serialVersionUID = -2474225842945673085L; - - public BigIntegerStringSerializer() { - this(null); - } + @SuppressWarnings("serial") + public static final class Serializer extends StdSerializer { - public BigIntegerStringSerializer(Class t) { - super(t); + protected Serializer() { + super(BigIntegerString.class); } @Override @@ -83,16 +77,11 @@ public void serialize(BigIntegerString value, JsonGenerator g, SerializerProvide } } - public static final class BigIntegerStringDeserializer extends StdDeserializer { - - private static final long serialVersionUID = -2474225842945673085L; - - public BigIntegerStringDeserializer() { - this(null); - } + @SuppressWarnings("serial") + public static final class Deserializer extends StdDeserializer { - public BigIntegerStringDeserializer(Class t) { - super(t); + protected Deserializer() { + super(BigIntegerString.class); } @Override diff --git a/src/main/java/studio/livepeer/livepeer/utils/Blob.java b/src/main/java/studio/livepeer/livepeer/utils/Blob.java new file mode 100644 index 00000000..e53de18e --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/Blob.java @@ -0,0 +1,299 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Flow; +import java.util.concurrent.SubmissionPublisher; +import java.util.concurrent.atomic.AtomicBoolean; +import studio.livepeer.livepeer.utils.reactive.ReactiveUtils; + +/** + * A utility class for creating data blobs from various input sources that implements {@code HttpRequest.BodyPublisher}. + *

+ * This class provides convenient factory methods to create blobs from: + *

    + *
  • File paths ({@link #from(Path)})
  • + *
  • InputStreams ({@link #from(InputStream)})
  • + *
  • Strings ({@link #from(String)})
  • + *
  • Byte arrays ({@link #from(byte[])})
  • + *
  • ByteBuffers ({@link #from(ByteBuffer)})
  • + *
  • Lists of ByteBuffers ({@link #from(List)})
  • + *
  • Reactive publishers ({@link #from(Flow.Publisher)})
  • + *
+ *

+ * Each blob can be used directly as a {@code HttpRequest.BodyPublisher} since this class implements that interface. + *

+ * Additionally, this class provides consumption methods for reactive data processing: + *

    + *
  • Get the stream as a {@code Flow.Publisher} ({@link #asPublisher()})
  • + *
  • Collect the entire stream into a byte array ({@link #toByteArray()})
  • + *
  • Write the stream directly to a file ({@link #toFile(Path)})
  • + *
+ *

+ * Single-use consumption: When using consumption methods ({@code asPublisher()}, {@code toByteArray()}, + * {@code toFile()}), each {@code Blob} instance can only be consumed once. After any consumption method + * is called, the instance is considered consumed and cannot be reused. Any further attempt to use a consumption method + * will result in an {@code IllegalStateException}. + *

+ * Retry compatibility: Most blob types support HTTP request retries effectively. However, InputStream-backed + * blobs ({@link #from(InputStream)}) do not support retries as the stream gets consumed during the first attempt. + * For retry-compatible scenarios, prefer file-based ({@link #from(Path)}) or in-memory ({@link #from(byte[])}) alternatives. + */ +public class Blob implements HttpRequest.BodyPublisher { + private final Flow.Publisher publisher; + private final long contentLength; + private final AtomicBoolean consumed = new AtomicBoolean(false); // Flag for single-use consumption + + /** + * Private constructor that takes a publisher and content length. + * + * @param publisher the underlying publisher + * @param contentLength the content length, or -1 if unknown + */ + private Blob(Flow.Publisher publisher, long contentLength) { + this.publisher = Objects.requireNonNull(publisher, "Publisher cannot be null"); + this.contentLength = contentLength; + } + + /** + * Creates a {@code Blob} from a file path. + *

+ * This method uses the Java HTTP client's {@code HttpRequest.BodyPublishers.ofFile()} to create + * a reactive publisher from the file content. + * + * @param path the path to the file to read + * @return a new {@code Blob} instance + * @throws FileNotFoundException if the file does not exist or cannot be read + * @throws NullPointerException if {@code path} is {@code null} + */ + public static Blob from(Path path) throws FileNotFoundException { + Objects.requireNonNull(path, "Path cannot be null"); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.ofFile(path); + return new Blob(bodyPublisher, bodyPublisher.contentLength()); + } + + /** + * Creates a {@code Blob} from an {@code InputStream}. + *

+ * This method uses {@code HttpRequest.BodyPublishers.ofInputStream()} to create a reactive + * publisher that reads from the InputStream lazily, avoiding blocking I/O operations. + *

+ * Important: InputStream-backed blobs do not support retries effectively. If the HTTP request + * fails and is retried, the InputStream will have already been consumed during the first attempt, + * causing subsequent retry attempts to send empty request bodies. For retry-compatible scenarios, + * consider using {@link #from(Path)} for file-based data or {@link #from(byte[])} for in-memory data. + * + * @param inputStream the InputStream to read from + * @return a new {@code Blob} instance + * @throws NullPointerException if {@code inputStream} is {@code null} + */ + public static Blob from(InputStream inputStream) { + Objects.requireNonNull(inputStream, "InputStream cannot be null"); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.ofInputStream(() -> inputStream); + return new Blob(bodyPublisher, -1); // Unknown length for InputStream + } + + /** + * Creates a {@code Blob} from a String using UTF-8 encoding. + * + * @param string the string to convert to a Blob + * @return a new {@code Blob} instance + * @throws NullPointerException if {@code string} is {@code null} + */ + public static Blob from(String string) { + Objects.requireNonNull(string, "String cannot be null"); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.ofString(string, StandardCharsets.UTF_8); + return new Blob(bodyPublisher, bodyPublisher.contentLength()); + } + + /** + * Creates a {@code Blob} from a byte array. + *

+ * This method uses HttpRequest.BodyPublishers.ofByteArray(). + * + * @param data the byte array to wrap as a Blob + * @return a new {@code Blob} instance + * @throws NullPointerException if {@code data} is {@code null} + */ + public static Blob from(byte[] data) { + Objects.requireNonNull(data, "Data cannot be null"); + HttpRequest.BodyPublisher bodyPublisher = HttpRequest.BodyPublishers.ofByteArray(data); + return new Blob(bodyPublisher, data.length); // Known length for byte array + } + + /** + * Creates a {@code Blob} from a single {@code ByteBuffer}. + * + * @param buffer the ByteBuffer to wrap as a Blob + * @return a new {@code Blob} instance + * @throws NullPointerException if {@code buffer} is {@code null} + */ + public static Blob from(ByteBuffer buffer) { + Objects.requireNonNull(buffer, "ByteBuffer cannot be null"); + SubmissionPublisher publisher = new SubmissionPublisher<>(); + publisher.submit(buffer.duplicate()); // Use duplicate to avoid modifying original + publisher.close(); + return new Blob(publisher, buffer.remaining()); // Known length from buffer + } + + /** + * Creates a {@code Blob} from a list of {@code ByteBuffer}s. + * + * @param buffers the list of ByteBuffers to wrap as a Blob + * @return a new {@code Blob} instance + * @throws NullPointerException if {@code buffers} is {@code null} + */ + public static Blob from(List buffers) { + Objects.requireNonNull(buffers, "ByteBuffer list cannot be null"); + SubmissionPublisher publisher = new SubmissionPublisher<>(); + + long totalLength = 0; + for (ByteBuffer buffer : buffers) { + publisher.submit(buffer.duplicate()); // Use duplicate to avoid modifying original + totalLength += buffer.remaining(); + } + publisher.close(); + + return new Blob(publisher, totalLength); // Known length from sum of buffer remainings + } + + /** + * Creates a {@code Blob} from a {@code Flow.Publisher>}. + *

+ * This method uses {@code ReactiveUtils.flatten()} to convert the publisher of lists + * into a publisher of individual ByteBuffers. + * + * @param sourcePublisher the publisher that provides data as lists of ByteBuffers + * @return a new {@code Blob} instance + * @throws NullPointerException if {@code sourcePublisher} is {@code null} + */ + public static Blob from(Flow.Publisher> sourcePublisher) { + Objects.requireNonNull(sourcePublisher, "Source publisher cannot be null"); + Flow.Publisher flattenedPublisher = ReactiveUtils.flatten(sourcePublisher); + return new Blob(flattenedPublisher, -1); // Unknown length for reactive publisher + } + + // Consumption methods (single-use) + + /** + * Returns a {@code Flow.Publisher} that emits individual {@code ByteBuffer} + * from the underlying stream. + *

+ * Consumes this instance: After calling this method, this {@code Blob} cannot be used again. + * + * @return a publisher of individual {@code ByteBuffer} items. + * @throws IllegalStateException if this instance has already been consumed. + */ + public Flow.Publisher asPublisher() { + return ensureNotConsumedAndMark(); + } + + /** + * Collects the entire stream into a single byte array. + *

+ * Consumes this instance: After calling this method, this {@code Blob} cannot be used again. + *

+ * The returned {@code CompletableFuture} completes when all data has been received and assembled into the byte array, + * or completes exceptionally if an error occurs. + * + * @return a {@code CompletableFuture} containing the complete byte array. + * @throws IllegalStateException if this instance has already been consumed. + */ + public CompletableFuture toByteArray() { + Flow.Publisher currentPublisher = ensureNotConsumedAndMark(); + + // Convert Flow.Publisher to Flow.Publisher> for BodySubscriber + Flow.Publisher> listPublisher = ReactiveUtils.wrapped(currentPublisher); + + HttpResponse.BodySubscriber bodySubscriber = HttpResponse.BodySubscribers.ofByteArray(); + listPublisher.subscribe(bodySubscriber); + + return bodySubscriber.getBody().toCompletableFuture(); + } + + /** + * Writes the entire stream to the specified file path. + *

+ * Consumes this instance: After calling this method, this {@code Blob} cannot be used again. + *

+ * The returned {@code CompletableFuture} completes with the {@code Path} to the written file when all data + * has been successfully written, or completes exceptionally if an error occurs. + * + * @param destinationPath the path where the stream data will be written. If the file exists, it will be truncated. + * @return a {@code CompletableFuture} containing the {@code Path} to the written file. + * @throws NullPointerException if {@code destinationPath} is {@code null}. + * @throws IllegalStateException if this instance has already been consumed. + */ + public CompletableFuture toFile(Path destinationPath) { + Objects.requireNonNull(destinationPath, "Destination path cannot be null"); + Flow.Publisher currentPublisher = ensureNotConsumedAndMark(); + + // Convert Flow.Publisher to Flow.Publisher> for BodySubscriber + Flow.Publisher> listPublisher = ReactiveUtils.wrapped(currentPublisher); + + HttpResponse.BodySubscriber bodySubscriber = HttpResponse.BodySubscribers.ofFile(destinationPath); + listPublisher.subscribe(bodySubscriber); + + return bodySubscriber.getBody().toCompletableFuture(); + } + + /** + * Converts the entire stream into an {@code InputStream} for traditional I/O operations. + *

+ * Consumes this instance: After calling this method, this {@code Blob} cannot be used again. + *

+ * The returned {@code CompletableFuture} completes with an {@code InputStream} containing all the data + * from the stream when ready, or completes exceptionally if an error occurs. The resulting InputStream + * can be used with traditional Java I/O APIs. + * + * @return a {@code CompletableFuture} containing an {@code InputStream} with the stream data. + * @throws IllegalStateException if this instance has already been consumed. + */ + public CompletableFuture toInputStream() { + Flow.Publisher currentPublisher = ensureNotConsumedAndMark(); + + // Convert Flow.Publisher to Flow.Publisher> for BodySubscriber + Flow.Publisher> listPublisher = ReactiveUtils.wrapped(currentPublisher); + + HttpResponse.BodySubscriber bodySubscriber = HttpResponse.BodySubscribers.ofInputStream(); + listPublisher.subscribe(bodySubscriber); + + return bodySubscriber.getBody().toCompletableFuture(); + } + + /** + * Ensures this instance has not already been consumed, marks it as consumed, and returns the publisher. + * + * @return the {@code Flow.Publisher} to be consumed. + * @throws IllegalStateException if this instance has already been consumed. + */ + private Flow.Publisher ensureNotConsumedAndMark() { + if (!consumed.compareAndSet(false, true)) { + throw new IllegalStateException("This Blob instance has already been consumed and cannot be reused."); + } + return this.publisher; + } + + // HttpRequest.BodyPublisher implementation + + @Override + public long contentLength() { + return contentLength; + } + + @Override + public void subscribe(Flow.Subscriber subscriber) { + publisher.subscribe(subscriber); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/BlockingParser.java b/src/main/java/studio/livepeer/livepeer/utils/BlockingParser.java new file mode 100644 index 00000000..4907fa30 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/BlockingParser.java @@ -0,0 +1,85 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import java.io.IOException; +import java.io.Reader; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.Optional; + +/** + * Blocking parser that reads from a Reader and delegates to a StreamingParser. + */ +public final class BlockingParser { + private final Reader reader; + private final StreamingParser parser; + private final char[] readBuffer = new char[8192]; + private boolean readerExhausted = false; + + public BlockingParser(Reader reader, StreamingParser parser) { + this.reader = reader; + this.parser = parser; + } + + /** + * Read the next parsed result from the Reader. + * + * @return next complete parsed result, or empty if no more data + * @throws IOException if reading fails + */ + public Optional next() throws IOException { + // First check if we already have a complete result buffered + Optional result = parser.next(); + if (result.isPresent()) { + return result; + } + // If reader is exhausted, try to get any remaining partial data + if (readerExhausted) { + return parser.finish(); + } + // Read more data until we have a complete result or EOF + int bytesRead; + while ((bytesRead = reader.read(readBuffer)) != -1) { + ByteBuffer chunk = ByteBuffer.wrap(new String(readBuffer, 0, bytesRead).getBytes(StandardCharsets.UTF_8)); + result = parser.add(chunk); + if (result.isPresent()) { + return result; + } + } + // Reader is now exhausted + readerExhausted = true; + return parser.finish(); + } + + /** + * Check if there are more results available (either buffered or from reader) + */ + public boolean hasNext() throws IOException { + return parser.hasBufferedData() || !readerExhausted; + } + + /** + * Close the underlying reader + */ + public void close() throws IOException { + reader.close(); + } + + // ===== Factory Methods ===== + + /** + * Create a blocking parser for JSON Lines format + */ + public static BlockingParser forJsonLines(Reader reader) { + return new BlockingParser<>(reader, StreamingParser.forJsonLines()); + } + + /** + * Create a blocking parser for SSE format + */ + public static BlockingParser forSSE(Reader reader) { + return new BlockingParser<>(reader, StreamingParser.forSSE()); + } +} \ No newline at end of file diff --git a/src/main/java/studio/livepeer/livepeer/utils/Constants.java b/src/main/java/studio/livepeer/livepeer/utils/Constants.java new file mode 100644 index 00000000..6059ab37 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/Constants.java @@ -0,0 +1,10 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +public final class Constants { + + public static final boolean HAS_CLIENT_CREDENTIALS_BASIC = false; + +} \ No newline at end of file diff --git a/src/main/java/studio/livepeer/livepeer/utils/CopiableInputStream.java b/src/main/java/studio/livepeer/livepeer/utils/CopiableInputStream.java new file mode 100644 index 00000000..36c549e7 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/CopiableInputStream.java @@ -0,0 +1,26 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import org.apache.commons.io.IOUtils; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; + +public class CopiableInputStream { + private final byte[] bytes; + + public CopiableInputStream(InputStream original) { + try (InputStream stream = original) { + this.bytes = IOUtils.toByteArray(stream); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public InputStream copy() { + return new ByteArrayInputStream(bytes); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/Deserializers.java b/src/main/java/studio/livepeer/livepeer/utils/Deserializers.java index a1b7b76e..a4970eb8 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/Deserializers.java +++ b/src/main/java/studio/livepeer/livepeer/utils/Deserializers.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.io.IOException; diff --git a/src/main/java/studio/livepeer/livepeer/utils/EventStream.java b/src/main/java/studio/livepeer/livepeer/utils/EventStream.java index dd68b0ee..e8b3b06d 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/EventStream.java +++ b/src/main/java/studio/livepeer/livepeer/utils/EventStream.java @@ -1,44 +1,84 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; -import java.io.IOException; -import java.io.InputStream; -import java.io.UncheckedIOException; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.Spliterator; -import java.util.Spliterators; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.stream.StreamSupport; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - /** - * Manages the parsing of an InputStream in SSE (Server Sent Events) format. + * Provides a convenient way to consume Server-Sent Events (SSE) from a stream. + *

+ * Each SSE message's {@code data} field is deserialized into the type {@code T}, + * allowing for easy processing of events as domain objects. + *

+ * + *

Event Consumption

+ *

Events can be consumed in multiple ways:

* - * @param the type that the SSE {@code data} field is deserialized into - */ -/** - * @param + *
    + *
  • Iteration: Use a for-each loop to process each event:
  • + *
+ *
{@code
+ * try (EventStream eventStream = new EventStream<>(...)) {
+ *     for (MyEvent event : eventStream) {
+ *         handleEvent(event);
+ *     }
+ * }
+ * }
+ * + *
    + *
  • Stream API: Consume events as a Java Stream (must be closed after use):
  • + *
+ *
{@code
+ * try (EventStream eventStream = new EventStream<>(...);
+ *      Stream stream = eventStream.stream()) {
+ *     stream.forEach(this::handleEvent);
+ * }
+ * }
+ * + *
    + *
  • Collect to List: Read all remaining events into a list:
  • + *
+ *
{@code
+ * try (EventStream eventStream = new EventStream<>(...)) {
+ *     List events = eventStream.toList();
+ * }
+ * }
+ * + *

+ * Events are lazily loaded from the underlying SSE stream. Consumption stops either + * when the stream ends or when an optional terminal message is encountered. + *

+ * + *

+ * Important: This class implements {@link AutoCloseable} and must be used + * within a try-with-resources block to ensure that underlying streams are + * properly closed after consumption, preventing resource leaks. + *

+ * + * @param the type that SSE {@code data} fields will be deserialized into */ -public final class EventStream implements AutoCloseable { - - private final EventStreamReader reader; +public final class EventStream implements Iterable, AutoCloseable { + private final BlockingParser parser; private final TypeReference typeReference; private final ObjectMapper mapper; + private final Optional terminalMessage; // Internal use only - public EventStream(InputStream in, TypeReference typeReference, ObjectMapper mapper) { - this.reader = new EventStreamReader(in); + public EventStream(InputStream in, TypeReference typeReference, ObjectMapper mapper, Optional terminalMessage) { + BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8), 8192); + this.parser = BlockingParser.forSSE(reader); this.typeReference = typeReference; this.mapper = mapper; + this.terminalMessage = terminalMessage; } /** @@ -46,17 +86,19 @@ public EventStream(InputStream in, TypeReference typeReference, ObjectMapper * {@code Optional.empty()}. * * @return the next message or {@code Optional.empty()} if no more messages - * @throws IOException + * @throws IOException when parsing the next message. */ public Optional next() throws IOException { - return reader.readMessage() // + return parser.next() // + .filter(x -> + terminalMessage.map(sentinel -> !sentinel.equals(x.data())).orElse(true)) .map(x -> Utils.asType(x, mapper, typeReference)); } /** * Reads all events and returns them as a {@code List}. This method calls * {@code close()}. - * + * * @return list of events */ public List toList() { @@ -73,54 +115,73 @@ public List toList() { } } + /** + * Returns an {@link Iterator} of {@link T} events, enabling iteration via for-each loops. + * + * @return events iterator. + */ + @Override + public Iterator iterator() { + return new EventIterator<>(this); + } + /** * Returns a {@link Stream} of events. Must be closed after use! - * + * * @return streamed events */ public Stream stream() { - return StreamSupport.stream(Spliterators.spliteratorUnknownSize(new Iterator() { - Optional next = null; - - public T next() { - load(); - if (!next.isPresent()) { - throw new NoSuchElementException(); - } - T v = next.get(); - next = null; - return v; - } - - public boolean hasNext() { - load(); - return next.isPresent(); - } - - private void load() { - if (next == null) { + return StreamSupport.stream( + Spliterators.spliteratorUnknownSize( + iterator(), + Spliterator.ORDERED), false) + .onClose(() -> { try { - next = EventStream.this.next(); + EventStream.this.close(); } catch (IOException e) { throw new UncheckedIOException(e); + } catch (Exception e) { + throw new RuntimeException(e); } - } - } - - }, Spliterator.ORDERED), false).onClose(() -> { - try { - EventStream.this.close(); - } catch (IOException e) { - throw new UncheckedIOException(e); - } catch (Exception e) { - throw new RuntimeException(e); - } - }); + }); } @Override - public void close() throws Exception { - reader.close(); + public void close() throws IOException { + parser.close(); } + static class EventIterator implements Iterator { + private final EventStream stream; + private Optional next = Optional.empty(); + + EventIterator(EventStream stream) { + this.stream = stream; + } + + public T next() { + load(); + if (next.isEmpty()) { + throw new NoSuchElementException(); + } + T v = next.get(); + next = Optional.empty(); + return v; + } + + public boolean hasNext() { + load(); + return next.isPresent(); + } + + private void load() { + if (next.isEmpty()) { + try { + next = stream.next(); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + } + } } diff --git a/src/main/java/studio/livepeer/livepeer/utils/EventStreamLineReader.java b/src/main/java/studio/livepeer/livepeer/utils/EventStreamLineReader.java deleted file mode 100644 index bec5001e..00000000 --- a/src/main/java/studio/livepeer/livepeer/utils/EventStreamLineReader.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -package studio.livepeer.livepeer.utils; - -import java.io.IOException; -import java.io.Reader; - -/** - * Converts CR-LF, LF, CR to LF - */ -public class EventStreamLineReader extends Reader { - - private final Reader reader; - private int lastCh = -1; // not LF nor CR - - public EventStreamLineReader(Reader reader) { - this.reader = reader; - } - - @Override - public int read() throws IOException { - if (lastCh == -1) { - // load first character of stream - lastCh = reader.read(); - if (lastCh == -1 || lastCh == '\n') { - // force reload of buffered last ch - int v = lastCh; - lastCh = -1; - return v; - } - } - int ch = reader.read(); - if (ch == -1) { - if (lastCh == '\r') { - lastCh = -1; - return '\n'; - } else { - int v = lastCh; - lastCh = -1; - return v; - } - } else if (lastCh == '\n') { - lastCh = ch; - return '\n'; - } else if (lastCh == '\r' && ch == '\n') { - // force reload of buffered last ch - lastCh = -1; - return '\n'; - } else if (lastCh == '\r') { - lastCh = ch; - return '\n'; - } else { - int v = lastCh; - lastCh = ch; - return v; - } - } - - @Override - public int read(char[] cbuf, int off, int len) throws IOException { - throw new UnsupportedOperationException(); - } - - @Override - public void close() throws IOException { - reader.close(); - } - -} diff --git a/src/main/java/studio/livepeer/livepeer/utils/EventStreamMessage.java b/src/main/java/studio/livepeer/livepeer/utils/EventStreamMessage.java index d41339c2..d3afe3d6 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/EventStreamMessage.java +++ b/src/main/java/studio/livepeer/livepeer/utils/EventStreamMessage.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.util.Optional; diff --git a/src/main/java/studio/livepeer/livepeer/utils/EventStreamReader.java b/src/main/java/studio/livepeer/livepeer/utils/EventStreamReader.java deleted file mode 100644 index 4f946507..00000000 --- a/src/main/java/studio/livepeer/livepeer/utils/EventStreamReader.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -package studio.livepeer.livepeer.utils; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.nio.charset.StandardCharsets; -import java.util.Optional; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public final class EventStreamReader implements AutoCloseable { - - private static final int BUFFER_SIZE = 8192; - - private static final String BYTE_ORDER_MARK = "\uFEFF"; - - private final Reader reader; - - private boolean first = true; - - public EventStreamReader(InputStream in) { - reader = new EventStreamLineReader( - new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8), BUFFER_SIZE)); - } - - /** - * Returns the event message (lines separated by \n) without the terminating - * \n\n. Returns null when end of stream reached (and may occur with a partially - * read event message that has not yet been terminated). Characters in comment - * lines are discarded as read (they are not buffered). - * - * @return the event message - * @throws IOException - */ - // VisibleForTesting - public String readRawMessage() throws IOException { - StringBuilder line = new StringBuilder(); - StringBuilder b = new StringBuilder(); - - char previousCh = 0; - boolean previousAvailable = false; - boolean isComment = false; - char ch; - while (true) { - int v = reader.read(); - if (v == -1) { - return null; - } - ch = (char) v; - if (previousAvailable) { - // note that incoming input stream converts sequences of \r and/or \n to \n - // characters so we only concern ourselves with \n (divide and conquer) - if (previousCh == '\n' && ch == '\n') { - b.append(line); - line.setLength(0); - isComment = false; - trimTrailingNewLines(b); - String msg = b.toString(); - if (first) { - // skip BOM if present in the first message only - if (msg.startsWith(BYTE_ORDER_MARK)) { - msg = msg.substring(BYTE_ORDER_MARK.length()); - } - first = false; - } - return msg; - } else { - if (line.length() == 0 && previousCh == ':') { - isComment = true; - } - if (!isComment) { - line.append(previousCh); - if (previousCh == '\n') { - b.append(line); - // reset line - line.setLength(0); - } - } else if (previousCh == '\n') { - isComment = false; - } - } - } else { - previousAvailable = true; - } - previousCh = ch; - } - } - - public Optional readMessage() throws IOException { - String m = readRawMessage(); - if (m == null) { - return Optional.empty(); - } else { - return Optional.of(parseMessage(m)); - } - } - - private static final Pattern LINE_PATTERN = Pattern.compile("^([a-zA-Z]+): ?(.*)$"); - private static final char LINEFEED = '\n'; - - // VisibleForTesting - public static EventStreamMessage parseMessage(String text) { - String[] lines = text.split("\n"); - Optional event = Optional.empty(); - Optional id = Optional.empty(); - Optional retryMs = Optional.empty(); - StringBuilder data = new StringBuilder(); - boolean firstData = true; - for (String line : lines) { - Matcher m = LINE_PATTERN.matcher(line); - if (m.find()) { - String key = m.group(1).toLowerCase(); - String value = m.group(2); - if ("event".equals(key)) { - event = Optional.of(value); - } else if ("id".equals(key)) { - id = Optional.of(value); - } else if ("retry".equals(key)) { - try { - retryMs = Optional.of(Integer.parseInt(value)); - } catch (NumberFormatException e) { - // ignore - } - } else if ("data".equals(key)) { - if (!firstData) { - data.append(LINEFEED); - } - firstData = false; - data.append(value); - } // else ignore the line - } - } - return new EventStreamMessage(event, id, retryMs, data.toString()); - } - - private static StringBuilder trimTrailingNewLines(StringBuilder b) { - int i = 0; - while (b.length() > i && b.charAt(b.length() - i - 1) == '\n') { - i++; - } - b.setLength(b.length() - i); - return b; - } - - @Override - public void close() throws Exception { - reader.close(); - } - -} diff --git a/src/main/java/studio/livepeer/livepeer/utils/Exceptions.java b/src/main/java/studio/livepeer/livepeer/utils/Exceptions.java new file mode 100644 index 00000000..352479a1 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/Exceptions.java @@ -0,0 +1,95 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Supplier; +import java.io.IOException; +import java.io.UncheckedIOException; + +public class Exceptions { + public static Exception coerceException(Throwable throwable) { + if (throwable instanceof Exception) { + return (Exception) throwable; + } + + return new Exception(throwable); + } + + public static RuntimeException unchecked(Throwable t) { + if (t instanceof RuntimeException) { + return (RuntimeException) t; + } else if (t instanceof Error) { + throw (Error) t; // propagate JVM-level errors properly + } else if (t instanceof IOException) { + throw new UncheckedIOException((IOException) t); + } else { + throw new RuntimeException(t); + } + } + + public static T rethrow(Throwable e) { + throw unchecked(e); + } + + @FunctionalInterface + public interface CheckedFunction { + R apply(T t) throws Exception; + } + + @FunctionalInterface + public interface CheckedSupplier { + T get() throws Exception; + } + + @FunctionalInterface + public interface CheckedConsumer { + void accept(T t) throws Exception; + } + + @FunctionalInterface + public interface CheckedRunnable { + void run() throws Exception; + } + + public static Function unchecked(CheckedFunction fn) { + return t -> { + try { + return fn.apply(t); + } catch (Exception e) { + throw unchecked(e); + } + }; + } + + public static Supplier unchecked(CheckedSupplier supplier) { + return () -> { + try { + return supplier.get(); + } catch (Exception e) { + throw unchecked(e); + } + }; + } + + public static Consumer unchecked(CheckedConsumer consumer) { + return t -> { + try { + consumer.accept(t); + } catch (Exception e) { + throw unchecked(e); + } + }; + } + + public static Runnable unchecked(CheckedRunnable runnable) { + return () -> { + try { + runnable.run(); + } catch (Exception e) { + throw unchecked(e); + } + }; + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/FormMetadata.java b/src/main/java/studio/livepeer/livepeer/utils/FormMetadata.java index 8e338146..55e43354 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/FormMetadata.java +++ b/src/main/java/studio/livepeer/livepeer/utils/FormMetadata.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.lang.reflect.Field; diff --git a/src/main/java/studio/livepeer/livepeer/utils/Globals.java b/src/main/java/studio/livepeer/livepeer/utils/Globals.java new file mode 100644 index 00000000..c3262c3c --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/Globals.java @@ -0,0 +1,89 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; +import java.util.stream.Stream; + +public final class Globals { + + private final Map queryParams = new HashMap<>(); + private final Map pathParams = new HashMap<>(); + private final Map headerParams = new HashMap<>(); + + + public Globals() { + } + + // internal use only + public void putParam(String type, String name, Object value) { + if ("pathParam".equals(type)) { + putPathParam(name, value); + } else if ("queryParam".equals(type)) { + putQueryParam(name, value); + } else if ("header".equals(type)) { + putHeader(name, value); + } else { + throw new IllegalArgumentException("Unknown parameter type: " + type); + } + } + + // internal use only + public Optional getParam(String type, String name) { + if ("pathParam".equals(type)){ + return getPathParam(name); + } else if ("queryParam".equals(type)) { + return getQueryParam(name); + } else if ("header".equals(type)) { + return getHeader(name); + } else { + throw new IllegalArgumentException("Unknown parameter type: " + type); + } + } + + public void putQueryParam(String name, Object value) { + if (value != null) { + queryParams.put(name, Utils.valToString(value)); + } + } + + public void putPathParam(String name, Object value) { + if (value != null) { + pathParams.put(name, Utils.valToString(value)); + } + } + + public void putHeader(String name, Object value) { + if (value != null) { + headerParams.put(name, Utils.valToString(value)); + } + } + + public Optional getQueryParam(String name) { + return Optional.ofNullable(queryParams.get(name)); + } + + public Optional getPathParam(String name) { + return Optional.ofNullable(pathParams.get(name)); + } + + public Optional getHeader(String name) { + return Optional.ofNullable(headerParams.get(name)); + } + + public Stream> queryParamsAsStream() { + return queryParams.entrySet().stream(); + } + + public Stream> pathParamsAsStream() { + return pathParams.entrySet().stream(); + } + + public Stream> headerParamsAsStream() { + return headerParams.entrySet().stream(); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/HTTPClient.java b/src/main/java/studio/livepeer/livepeer/utils/HTTPClient.java index 9519f0a0..e8ef2ee9 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/HTTPClient.java +++ b/src/main/java/studio/livepeer/livepeer/utils/HTTPClient.java @@ -1,32 +1,86 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; +import studio.livepeer.livepeer.utils.Blob; + import java.io.IOException; import java.io.InputStream; import java.net.URISyntaxException; -import java.net.http.HttpResponse; +import java.net.http.HttpClient; import java.net.http.HttpRequest; +import java.net.http.HttpResponse; + +import java.util.concurrent.CompletableFuture; public interface HTTPClient { + HttpClient client = HttpClient.newHttpClient(); /** * Sends an HTTP request and returns the response. - * - *

Note that {@link HttpRequest} is immutable. To modify the request you can use - * {@link HttpRequest#newBuilder(HttpRequest, BiPredicate)} with - * JDK 16 and later (which will copy the request for modification in a builder). - * If that method is not available then use {@link Helpers#copy} (which also returns - * a builder). - * + * + *

+ * Note that {@link HttpRequest} is immutable. To modify the request you can + * use + * {@code HttpRequest#newBuilder(HttpRequest, BiPredicate)} + * with JDK 16 and later (which will copy the request for modification in a + * builder). If that method is not available then use {@link Helpers#copy} + * (which also returns a builder). + * * @param request HTTP request * @return HTTP response * @throws IOException * @throws InterruptedException * @throws URISyntaxException - */ - HttpResponse send(HttpRequest request) - throws IOException, InterruptedException, URISyntaxException; + */ + default HttpResponse send(HttpRequest request) + throws IOException, InterruptedException, URISyntaxException { + return client.send(request, HttpResponse.BodyHandlers.ofInputStream()); + } + + /** + * Sends an HTTP request asynchronously and returns a response whose body is + * exposed as a {@link Blob}. + *

+ * This method uses the {@code HttpResponse.BodyHandlers.ofPublisher()} to + * obtain the response body as a {@code Flow.Publisher>}, + * which is then wrapped in a {@code Blob} for non-blocking, + * reactive consumption of the response data. + *

+ * The returned {@code CompletableFuture} completes when the response is + * received, or completes exceptionally if an error occurs during the + * request or response processing. + * + * @param request the HTTP request to send + * @return a {@code CompletableFuture} containing the HTTP response with a + * {@code Blob} body + */ + default CompletableFuture> sendAsync( + HttpRequest request) { + return client.sendAsync(request, HttpResponse.BodyHandlers.ofPublisher()) + .thenApply(resp -> + new ResponseWithBody<>(resp, Blob::from)); + } + + /** + * Controls the debug flag that can be used by clients to perform conditional + * debugging actions like logging HTTP requests and responses. + * This is currently implemented in SpeakeasyHTTPClient but custom client + * implementations are free to use this method similarly if they wish. + * + * @param enabled Whether to enable debug flag + */ + default void enableDebugLogging(boolean enabled) { + // do nothing + } + + /** + * Returns whether debug logging is enabled. + * + * @return Whether debug logging is enabled + */ + default boolean isDebugLoggingEnabled() { + return false; + } } diff --git a/src/main/java/studio/livepeer/livepeer/utils/HTTPRequest.java b/src/main/java/studio/livepeer/livepeer/utils/HTTPRequest.java index fbb8a4f9..d1afcbad 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/HTTPRequest.java +++ b/src/main/java/studio/livepeer/livepeer/utils/HTTPRequest.java @@ -1,9 +1,9 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; +import java.net.URI; import java.net.URISyntaxException; import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublisher; @@ -15,15 +15,15 @@ import java.util.Map; import java.util.Optional; -import org.apache.http.NameValuePair; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.message.BasicNameValuePair; - public class HTTPRequest { + private static final String FRAGMENT_SEGMENT_START = "#"; + private static final String QUERY_NAME_VALUE_DELIMITER = "="; + private static final String QUERY_PARAMETER_DELIMITER = "&"; + private static final String QUERY_SEGMENT_START = "?"; private final String baseURL; private final String method; - private final List queryParams = new ArrayList<>(); + private final List queryParams = new ArrayList<>(); private final Map> headers = new HashMap<>(); private Optional body = Optional.empty(); // mutable @@ -45,7 +45,9 @@ public HTTPRequest addHeader(String key, String value) { headerValues = new ArrayList<>(); headers.put(key, headerValues); } - headerValues.add(value); + if (!headerValues.contains(value)) { + headerValues.add(value); + } return this; } @@ -54,21 +56,21 @@ public HTTPRequest addHeaders(Map> map) { return this; } - public HTTPRequest addQueryParam(String name, String value) { - addQueryParam(new BasicNameValuePair(name, value)); + public HTTPRequest addQueryParam(QueryParameter param) { + this.queryParams.add(param); return this; } - - public HTTPRequest addQueryParam(NameValuePair param) { - this.queryParams.add(param); + + public HTTPRequest addQueryParam(String key, String value, boolean allowReserved) { + this.queryParams.add(QueryParameter.of(key, value, allowReserved)); return this; } - public HTTPRequest addQueryParams(Collection params) { + public HTTPRequest addQueryParams(Collection params) { params.forEach(p -> addQueryParam(p)); return this; } - + public HttpRequest build() { HttpRequest.Builder requestBuilder = HttpRequest.newBuilder(); @@ -81,14 +83,49 @@ public HttpRequest build() { } requestBuilder.method(method, bodyPublisher); try { - URIBuilder b = new URIBuilder(this.baseURL); - queryParams.forEach(pair -> b.addParameter(pair.getName(), pair.getValue())); - requestBuilder.uri(b.build()); + requestBuilder.uri(new URI(buildUrl(baseURL, queryParams))); } catch (URISyntaxException e) { throw new RuntimeException(e); } headers.forEach((k, list) -> list.forEach(v -> requestBuilder.header(k, v))); return requestBuilder.build(); } - + + // VisibleForTesting + public static String buildUrl(String baseURL, Collection queryParams) { + if (queryParams.isEmpty()) { + return baseURL; + } else { + final String base; + final String fragment; + int i = baseURL.indexOf(FRAGMENT_SEGMENT_START); + if (i == -1) { + base = baseURL; + fragment = ""; + } else { + base = baseURL.substring(0, i); + fragment = baseURL.substring(i); + } + StringBuilder b = new StringBuilder(base); + if (!base.contains(QUERY_SEGMENT_START)) { + b.append(QUERY_SEGMENT_START); + } else { + b.append(QUERY_PARAMETER_DELIMITER); + } + boolean first = true; + for (QueryParameter p : queryParams) { + if (!first) { + b.append(QUERY_PARAMETER_DELIMITER); + } + first = false; + // don't allow reserved characters to be unencoded in key (??) + b.append(Utf8UrlEncoder.DEFAULT.encode(p.name())); + b.append(QUERY_NAME_VALUE_DELIMITER); + b.append(Utf8UrlEncoder.allowReserved(p.allowReserved()).encode(p.value())); + } + b.append(fragment); + return b.toString(); + } + } + } \ No newline at end of file diff --git a/src/main/java/studio/livepeer/livepeer/utils/HasSecurity.java b/src/main/java/studio/livepeer/livepeer/utils/HasSecurity.java new file mode 100644 index 00000000..5d44e567 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/HasSecurity.java @@ -0,0 +1,10 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +/** + * Implemented by classes that have security annotations on fields. + **/ +public interface HasSecurity { +} \ No newline at end of file diff --git a/src/main/java/studio/livepeer/livepeer/utils/HeaderMetadata.java b/src/main/java/studio/livepeer/livepeer/utils/HeaderMetadata.java index 86533683..9c621df5 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/HeaderMetadata.java +++ b/src/main/java/studio/livepeer/livepeer/utils/HeaderMetadata.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.lang.reflect.Field; diff --git a/src/main/java/studio/livepeer/livepeer/utils/Headers.java b/src/main/java/studio/livepeer/livepeer/utils/Headers.java new file mode 100644 index 00000000..69d8d2bf --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/Headers.java @@ -0,0 +1,123 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.Locale; +import java.util.function.BiConsumer; + +// Internal API only + +/** + * Encapsulates HTTP headers. Header names are case-insensitive. + */ +public final class Headers { + + public static final Headers EMPTY = new Headers(Collections.emptyMap()); + + // keys are lowercased + private final Map> map; + + // Internal use only + public Headers(Map> headers) { + Utils.checkNotNull(headers, "headers"); + this.map = headers // + .entrySet() // + .stream() // + .map(entry -> Map.entry(entry.getKey().toLowerCase(Locale.ENGLISH), entry.getValue())) // + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + } + + // Internal use only + public Headers() { + this(new HashMap<>()); + } + + /** + * Returns all values for a header name. Header name is case-insensitive. + * + * @param name header name + * @return all values for the header name + */ + public List get(String name) { + Utils.checkNotNull(name, "name"); + return Collections.unmodifiableList(values(name)); + } + + /** + * Returns the first value for a header name. Header name is case-insensitive. + * + * @param name header name + * @return the first value for the header name + */ + public Optional first(String name) { + Utils.checkNotNull(name, "name"); + return values(name).stream().findFirst(); + } + + /** + * Appends a header value. Header name is case-insensitive. + * + * @param name header name + * @param value header value + * @return this + */ + public Headers add(String name, String value) { + Utils.checkNotNull(name, "name"); + Utils.checkNotNull(value, "value"); + List values = values(name); + if (values.isEmpty()) { + List list = new ArrayList<>(); + list.add(value); + map.put(name.toLowerCase(Locale.ENGLISH), list); + } else { + values.add(value); + } + return this; + } + + public Headers add(Headers headers) { + Utils.checkNotNull(headers, "headers"); + headers + .forEach((key, values) -> values.forEach(value -> add(key, value))); + return this; + } + + public void forEach(BiConsumer> consumer) { + Utils.checkNotNull(consumer, "consumer"); + map.forEach(consumer); + } + + /** + * Returns a copy of the headers as a map. Header names are lowercase. + * + * @return headers as a map + */ + public Map> map() { + return map // + .entrySet() // + .stream() // + .collect(Collectors.toMap(Map.Entry::getKey, entry -> new ArrayList<>(entry.getValue()))); + } + + private List values(String name) { + return map.getOrDefault(name.toLowerCase(Locale.ENGLISH), List.of()); + } + + @Override + public String toString() { + return "Headers[ " // + + map.entrySet() // + .stream() // + .map(entry -> entry.getKey() + "=" + entry.getValue()) // + .collect(Collectors.joining(", ")) // + + "]"; + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/Helpers.java b/src/main/java/studio/livepeer/livepeer/utils/Helpers.java index eed73a45..2996bf2c 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/Helpers.java +++ b/src/main/java/studio/livepeer/livepeer/utils/Helpers.java @@ -1,10 +1,16 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.net.http.HttpRequest; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.Flow; +import java.util.concurrent.TimeUnit; import java.util.function.BiPredicate; /** @@ -45,4 +51,77 @@ public static HttpRequest.Builder copy(HttpRequest request) { public static HttpRequest.Builder copy(HttpRequest request, BiPredicate filter) { return Utils.copy(request, filter); } + + + /** + * Returns the request body as a byte array. + * + * @param request http request to extract from + * @return byte array + */ + public static byte[] bodyBytes(HttpRequest request) { + return request.bodyPublisher() // + .map(p -> { + ByteBufferSubscriber sub = new ByteBufferSubscriber(); + p.subscribe(sub); + return sub.bytes(); + }).orElse(new byte[] {}); + } + + /** + * Returns the request body as a String assuming that the bytes of the request + * body are encoded with UTF-8. + * + * @param request http request to extract from + * @return request body as a String + */ + public static String bodyUtf8(HttpRequest request) { + return new String(bodyBytes(request), StandardCharsets.UTF_8); + } + + private static final class ByteBufferSubscriber implements Flow.Subscriber { + + private final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + private final CountDownLatch latch = new CountDownLatch(1); + + @Override + public void onSubscribe(Flow.Subscription subscription) { + // Retrieve all parts + subscription.request(Long.MAX_VALUE); + } + + @Override + public void onNext(ByteBuffer bb) { + byte[] buffer = new byte[bb.remaining()]; + bb.get(buffer); + try { + bytes.write(buffer); + } catch (IOException e) { + onError(e); + } + } + + @Override + public void onError(Throwable throwable) { + latch.countDown(); + Exceptions.rethrow(throwable); + } + + @Override + public void onComplete() { + latch.countDown(); + } + + public byte[] bytes() { + try { + if (!latch.await(30, TimeUnit.SECONDS)) { + throw new RuntimeException("timed out waiting for next byte array"); + } + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + return bytes.toByteArray(); + } + } + } diff --git a/src/main/java/studio/livepeer/livepeer/utils/Hook.java b/src/main/java/studio/livepeer/livepeer/utils/Hook.java index 40de3cac..738083c2 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/Hook.java +++ b/src/main/java/studio/livepeer/livepeer/utils/Hook.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.io.InputStream; @@ -11,6 +10,7 @@ import java.util.Optional; import java.util.UUID; +import studio.livepeer.livepeer.SDKConfiguration; import studio.livepeer.livepeer.SecuritySource; /** @@ -27,6 +27,8 @@ private Hook() { * Context for a hook call. */ public interface HookContext { + SDKConfiguration sdkConfiguration(); + String baseUrl(); String operationId(); Optional> oauthScopes(); Optional securitySource(); @@ -40,16 +42,30 @@ public interface BeforeRequestContext extends HookContext { public static final class BeforeRequestContextImpl implements BeforeRequestContext { + private final SDKConfiguration sdkConfiguration; + private final String baseUrl; private final String operationId; private final Optional> oauthScopes; private final Optional securitySource; - public BeforeRequestContextImpl(String operationId, Optional> oauthScopes, Optional securitySource) { + public BeforeRequestContextImpl(SDKConfiguration sdkConfiguration, String baseUrl, String operationId, Optional> oauthScopes, Optional securitySource) { + this.sdkConfiguration = sdkConfiguration; + this.baseUrl = baseUrl; this.operationId = operationId; this.oauthScopes = oauthScopes; this.securitySource = securitySource; } + @Override + public SDKConfiguration sdkConfiguration() { + return sdkConfiguration; + } + + @Override + public String baseUrl() { + return baseUrl; + } + @Override public String operationId() { return operationId; @@ -74,17 +90,31 @@ public interface AfterSuccessContext extends HookContext { public static final class AfterSuccessContextImpl implements AfterSuccessContext { + private final SDKConfiguration sdkConfiguration; + private final String baseUrl; private final String operationId; private final Optional> oauthScopes; private final Optional securitySource; - public AfterSuccessContextImpl(String operationId, Optional> oauthScopes, Optional securitySource) { + public AfterSuccessContextImpl(SDKConfiguration sdkConfiguration, String baseUrl, String operationId, Optional> oauthScopes, Optional securitySource) { Utils.checkNotNull(securitySource, "securitySource"); + this.sdkConfiguration = sdkConfiguration; + this.baseUrl = baseUrl; this.operationId = operationId; this.oauthScopes = oauthScopes; this.securitySource = securitySource; } + @Override + public SDKConfiguration sdkConfiguration() { + return sdkConfiguration; + } + + @Override + public String baseUrl() { + return baseUrl; + } + @Override public String operationId() { return operationId; @@ -109,16 +139,30 @@ public interface AfterErrorContext extends HookContext { public static final class AfterErrorContextImpl implements AfterErrorContext { + private final SDKConfiguration sdkConfiguration; + private final String baseUrl; private final String operationId; private final Optional> oauthScopes; private final Optional securitySource; - public AfterErrorContextImpl(String operationId, Optional> oauthScopes, Optional securitySource) { + public AfterErrorContextImpl(SDKConfiguration sdkConfiguration, String baseUrl, String operationId, Optional> oauthScopes, Optional securitySource) { Utils.checkNotNull(securitySource, "securitySource"); + this.sdkConfiguration = sdkConfiguration; + this.baseUrl = baseUrl; this.operationId = operationId; this.oauthScopes = oauthScopes; this.securitySource = securitySource; } + + @Override + public SDKConfiguration sdkConfiguration() { + return sdkConfiguration; + } + + @Override + public String baseUrl() { + return baseUrl; + } @Override public String operationId() { @@ -145,7 +189,7 @@ public interface BeforeRequest { * Transforms the given {@link HttpRequest} before sending. * *

Note that {@link HttpRequest} is immutable. To modify the request you can use - * {@link HttpRequest#newBuilder(HttpRequest, BiPredicate)} with + * {@code HttpRequest#newBuilder(HttpRequest, BiPredicate)} with * JDK 16 and later (which will copy the request for modification in a builder). * If that method is not available then use {@link Helpers#copy} (which also returns * a builder). @@ -221,7 +265,7 @@ HttpResponse afterError( } }; } - + public static final class SdkInitData { private final String baseUrl; private final HTTPClient client; @@ -239,12 +283,12 @@ public HTTPClient client() { return client; } } - + /** * Transforms the HTTPClient before use. */ public interface SdkInit { - + /** * Returns a transformed {@link HTTPClient} and {@code baseUrl} for use in requests. * @@ -257,6 +301,7 @@ public interface SdkInit { * The default action is to return the client untouched. */ static SdkInit DEFAULT = data -> data; + } diff --git a/src/main/java/studio/livepeer/livepeer/utils/HookAdapters.java b/src/main/java/studio/livepeer/livepeer/utils/HookAdapters.java new file mode 100644 index 00000000..a3b09029 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/HookAdapters.java @@ -0,0 +1,181 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import java.io.InputStream; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; + +/** + * Utility class for adapting synchronous hooks to asynchronous hooks. + *

+ * This class provides adapter methods that convert synchronous hook implementations + * ({@link Hook.BeforeRequest}, {@link Hook.AfterSuccess}, {@link Hook.AfterError}) + * to their asynchronous counterparts ({@link AsyncHook.BeforeRequest}, + * {@link AsyncHook.AfterSuccess}, {@link AsyncHook.AfterError}). + *

+ * Performance Note: The execution of synchronous hooks is offloaded to the + * global {@link java.util.concurrent.ForkJoinPool#commonPool() ForkJoinPool}. + * For better performance in high-throughput scenarios, consider re-implementing + * hooks using non-blocking I/O (NIO) patterns instead of relying on these adapters. + *

+ * Thread Safety: All adapter methods are thread-safe and can be called + * concurrently from multiple threads. + * + * @see Hook + * @see AsyncHook + * @see java.util.concurrent.ForkJoinPool#commonPool() + */ +public final class HookAdapters { + + private HookAdapters() { + // prevent instantiation + } + + /** + * Adapts a synchronous {@link Hook.BeforeRequest} to an asynchronous + * {@link AsyncHook.BeforeRequest}. + *

+ * The synchronous hook execution is offloaded to the global + * {@link java.util.concurrent.ForkJoinPool#commonPool() ForkJoinPool}. + * Any exceptions thrown by the synchronous hook are wrapped as unchecked + * exceptions and propagated through the returned {@link CompletableFuture}. + *

+ * Performance Consideration: For high-throughput applications, + * consider implementing the hook directly using NIO patterns rather than + * using this adapter, as it avoids thread pool overhead and blocking operations. + * + * @param beforeRequestHook the synchronous before-request hook to adapt + * @return an asynchronous before-request hook that executes the synchronous hook + * in the global ForkJoinPool + * @throws NullPointerException if {@code beforeRequestHook} is {@code null} + */ + public static AsyncHook.BeforeRequest toAsync(Hook.BeforeRequest beforeRequestHook) { + return ((context, request) -> CompletableFuture.supplyAsync( + () -> Exceptions.unchecked(() -> beforeRequestHook.beforeRequest(context, request)).get())); + } + + /** + * Adapts a synchronous {@link Hook.AfterError} to an asynchronous + * {@link AsyncHook.AfterError}. + *

+ * This method handles the conversion between different response body types: + *

    + *
  • Converts {@link HttpResponse}<{@link Blob}> to + * {@link HttpResponse}<{@link InputStream}> for the synchronous hook
  • + *
  • Converts the result back to {@link HttpResponse}<{@link Blob}> + * for the asynchronous interface
  • + *
+ *

+ * The synchronous hook execution is offloaded to the global + * {@link java.util.concurrent.ForkJoinPool#commonPool() ForkJoinPool}. + * Any exceptions thrown by the synchronous hook are wrapped as unchecked + * exceptions and propagated through the returned {@link CompletableFuture}. + *

+ * Performance Consideration: For high-throughput applications, + * consider implementing the hook directly using NIO patterns rather than + * using this adapter, as it avoids thread pool overhead and blocking I/O operations. + * + * @param afterErrorHook the synchronous after-error hook to adapt + * @return an asynchronous after-error hook that executes the synchronous hook + * in the global ForkJoinPool + * @throws NullPointerException if {@code afterErrorHook} is {@code null} + */ + public static AsyncHook.AfterError toAsync(Hook.AfterError afterErrorHook) { + return (context, response, error) -> toStreamResponse(response) + .thenCompose(backCompatResp -> { + CompletableFuture> processedResp = CompletableFuture.supplyAsync(() -> + Exceptions.unchecked(() -> + afterErrorHook.afterError( + context, + Optional.of(backCompatResp), + Optional.of(Exceptions.coerceException(error)))).get()); + + return processedResp + .thenApply(HookAdapters::toBlobResponse); + }); + + } + + /** + * Adapts a synchronous {@link Hook.AfterSuccess} to an asynchronous + * {@link AsyncHook.AfterSuccess}. + *

+ * This method handles the conversion between different response body types: + *

    + *
  • Converts {@link HttpResponse}<{@link Blob}> to + * {@link HttpResponse}<{@link InputStream}> for the synchronous hook
  • + *
  • Converts the result back to {@link HttpResponse}<{@link Blob}> + * for the asynchronous interface
  • + *
+ *

+ * The synchronous hook execution is offloaded to the global + * {@link java.util.concurrent.ForkJoinPool#commonPool() ForkJoinPool}. + * Any exceptions thrown by the synchronous hook are wrapped as unchecked + * exceptions and propagated through the returned {@link CompletableFuture}. + *

+ * Performance Consideration: For high-throughput applications, + * consider implementing the hook directly using NIO patterns rather than + * using this adapter, as it avoids thread pool overhead and blocking I/O operations. + * + * @param afterSuccessHook the synchronous after-success hook to adapt + * @return an asynchronous after-success hook that executes the synchronous hook + * in the global ForkJoinPool + * @throws NullPointerException if {@code afterSuccessHook} is {@code null} + */ + public static AsyncHook.AfterSuccess toAsync(Hook.AfterSuccess afterSuccessHook) { + return (context, response) -> toStreamResponse(response) + .thenCompose(backCompatResp -> { + CompletableFuture> processedResp = CompletableFuture.supplyAsync(() -> + Exceptions.unchecked(() -> + afterSuccessHook.afterSuccess( + context, + backCompatResp)).get()); + + return processedResp + .thenApply(HookAdapters::toBlobResponse); + }); + + } + + /** + * Converts an {@link HttpResponse}<{@link InputStream}> to an + * {@link HttpResponse}<{@link Blob}>. + *

+ * This method wraps the InputStream response body in a {@link Blob} while + * preserving all other response metadata (status code, headers, etc.). + *

+ * Note: The resulting {@link Blob} is created from the InputStream, + * which means it may not support retries effectively if the InputStream + * gets consumed during the first attempt. + * + * @param response the response with InputStream body to convert + * @return a new response with the same metadata but with a Blob body + * @throws NullPointerException if {@code response} is {@code null} + */ + private static HttpResponse toBlobResponse(HttpResponse response) { + return new ResponseWithBody<>(response, Blob.from(response.body())); + } + + /** + * Converts an {@link HttpResponse}<{@link Blob}> to an + * {@link HttpResponse}<{@link InputStream}>. + *

+ * This method asynchronously converts the Blob response body to an InputStream + * while preserving all other response metadata (status code, headers, etc.). + * The conversion is performed using {@link Blob#toInputStream()}. + *

+ * Note: This operation consumes the {@link Blob}, making it unavailable + * for further use after this conversion. + * + * @param response the response with Blob body to convert + * @return a CompletableFuture containing a new response with the same metadata + * but with an InputStream body + * @throws NullPointerException if {@code response} is {@code null} + */ + private static CompletableFuture> toStreamResponse(HttpResponse response) { + return response.body().toInputStream().thenApply(body -> new ResponseWithBody<>(response, body)); + } +} \ No newline at end of file diff --git a/src/main/java/studio/livepeer/livepeer/utils/Hooks.java b/src/main/java/studio/livepeer/livepeer/utils/Hooks.java index 90102616..2c99e42e 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/Hooks.java +++ b/src/main/java/studio/livepeer/livepeer/utils/Hooks.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.io.InputStream; @@ -28,7 +27,7 @@ * For example, this code will add a transaction id header to every request: * *

- * hooks.registerBeforeRequest((context, request) -> {
+ * hooks.registerBeforeRequest((context, request) -> {
  *     request.headers().map().put("acme-transaction-id", nextTransactionId());
  *     return request;
  * });
diff --git a/src/main/java/studio/livepeer/livepeer/utils/JSON.java b/src/main/java/studio/livepeer/livepeer/utils/JSON.java
index 6d297cf3..b28c35d9 100644
--- a/src/main/java/studio/livepeer/livepeer/utils/JSON.java
+++ b/src/main/java/studio/livepeer/livepeer/utils/JSON.java
@@ -1,7 +1,6 @@
 /* 
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
  */
-
 package studio.livepeer.livepeer.utils;
 
 import org.openapitools.jackson.nullable.JsonNullableModule;
@@ -13,8 +12,7 @@
 import com.fasterxml.jackson.databind.ObjectMapper;
 
 public class JSON {
-    public static ObjectMapper getMapper() {
-        return new ObjectMapper()
+    private static final ObjectMapper MAPPER = new ObjectMapper()
             .registerModule(new JavaTimeModule())
             .registerModule(new Jdk8Module())
             .registerModule(new JsonNullableModule())
@@ -23,5 +21,8 @@ public static ObjectMapper getMapper() {
             .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
             .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
             .enable(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES);
+
+    public static ObjectMapper getMapper() {
+        return MAPPER;
     }
 }
\ No newline at end of file
diff --git a/src/main/java/studio/livepeer/livepeer/utils/LazySingletonValue.java b/src/main/java/studio/livepeer/livepeer/utils/LazySingletonValue.java
index 81a09d21..cabc4ae0 100644
--- a/src/main/java/studio/livepeer/livepeer/utils/LazySingletonValue.java
+++ b/src/main/java/studio/livepeer/livepeer/utils/LazySingletonValue.java
@@ -1,7 +1,6 @@
 /* 
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
  */
-
 package studio.livepeer.livepeer.utils;
 
 import com.fasterxml.jackson.core.type.TypeReference;
diff --git a/src/main/java/studio/livepeer/livepeer/utils/Metadata.java b/src/main/java/studio/livepeer/livepeer/utils/Metadata.java
index 2d16cbb4..cd0eb961 100644
--- a/src/main/java/studio/livepeer/livepeer/utils/Metadata.java
+++ b/src/main/java/studio/livepeer/livepeer/utils/Metadata.java
@@ -1,7 +1,6 @@
 /* 
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
  */
-
 package studio.livepeer.livepeer.utils;
 
 import java.lang.reflect.Field;
diff --git a/src/main/java/studio/livepeer/livepeer/utils/Multipart.java b/src/main/java/studio/livepeer/livepeer/utils/Multipart.java
new file mode 100644
index 00000000..0ebf3bdf
--- /dev/null
+++ b/src/main/java/studio/livepeer/livepeer/utils/Multipart.java
@@ -0,0 +1,225 @@
+/* 
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package studio.livepeer.livepeer.utils;
+
+import studio.livepeer.livepeer.utils.reactive.ReactiveUtils;
+
+import java.net.URLEncoder;
+import java.net.http.HttpRequest.BodyPublisher;
+import java.net.http.HttpRequest.BodyPublishers;
+import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+import java.util.concurrent.Flow;
+
+public final class Multipart {
+
+    private static final String CRLF = "\r\n";
+    private static final String DASHES = "--";
+    private static final Charset HDR_CS = StandardCharsets.ISO_8859_1; // headers
+    private static final Charset TXT_CS = StandardCharsets.UTF_8;      // text fields
+    private static final String DEFAULT_FILE_CT = "application/octet-stream";
+    public static final String DEFAULT_TEXT_CT = "text/plain; charset=UTF-8";
+
+    private final BodyPublisher bodyPublisher;
+    private final String boundary;
+
+    private Multipart(BodyPublisher bodyPublisher, String boundary) {
+        this.bodyPublisher = bodyPublisher;
+        this.boundary = boundary;
+    }
+
+    public BodyPublisher bodyPublisher() {
+        return bodyPublisher;
+    }
+
+    /**
+     * Visible for tests.
+     */
+    public String boundary() {
+        return boundary;
+    }
+
+    /**
+     * RFC 7578: no charset parameter at the multipart level.
+     */
+    public String contentType() {
+        return "multipart/form-data; boundary=" + boundary;
+    }
+
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    // -------------------------------------------------------
+    // Builder
+    // -------------------------------------------------------
+    public static final class Builder {
+        private final List parts = new ArrayList<>();
+        private final String boundary = UUID.randomUUID().toString();
+
+        public Builder addPart(String name, String value) {
+            Utils.checkNotNull(name, "name");
+            Utils.checkNotNull(value, "value");
+            parts.add(new FormField(name, value, DEFAULT_TEXT_CT));
+            return this;
+        }
+
+        public Builder addPart(String name, String value, String contentType) {
+            Utils.checkNotNull(name, "name");
+            Utils.checkNotNull(value, "value");
+            Utils.checkNotNull(contentType, "contentType");
+            parts.add(new FormField(name, value, contentType));
+            return this;
+        }
+
+        public Builder addPart(String name, byte[] bytes, String filename, String contentType) {
+            return addPart(name, Blob.from(bytes), filename, contentType);
+        }
+
+        public Builder addPart(String name, Blob blob, String filename, String contentType) {
+            Utils.checkNotNull(name, "name");
+            Utils.checkNotNull(blob, "blob");
+            Utils.checkNotNull(filename, "filename");
+            parts.add(new FilePart(name, blob, filename,
+                    Optional.ofNullable(contentType).orElse(DEFAULT_FILE_CT)));
+            return this;
+        }
+
+        public Multipart build() {
+            if (parts.isEmpty()) {
+                throw new IllegalStateException("Must have at least one part to build multipart message.");
+            }
+
+            // Build publishers for each part plus the closing boundary.
+            List pubs = new ArrayList<>(parts.size() + 1);
+            for (Part p : parts) {
+                pubs.add(p.toPublisher(boundary));
+            }
+            pubs.add(BodyPublishers.ofString(DASHES + boundary + DASHES + CRLF, HDR_CS));
+
+            BodyPublisher multipart = concat(pubs);
+            return new Multipart(multipart, boundary);
+        }
+    }
+
+    // -------------------------------------------------------
+    // Part model
+    // -------------------------------------------------------
+    interface Part {
+        BodyPublisher toPublisher(String boundary);
+    }
+
+    /**
+     * Text form field.
+     */
+    static final class FormField implements Part {
+        private final String name;
+        private final String value;
+        private final String contentType;
+
+        FormField(String name, String value, String contentType) {
+            this.name = name;
+            this.value = value;
+            this.contentType = contentType != null ? contentType : "text/plain; charset=UTF-8";
+        }
+
+        @Override
+        public BodyPublisher toPublisher(String boundary) {
+            String header = DASHES + boundary + CRLF +
+                    "Content-Disposition: form-data; name=\"" + escapeQuoted(name) + "\"" + CRLF +
+                    "Content-Type: " + contentType + CRLF +
+                    CRLF;
+
+            BodyPublisher h = BodyPublishers.ofString(header, HDR_CS);
+            BodyPublisher b = BodyPublishers.ofString(value, TXT_CS);
+            BodyPublisher t = BodyPublishers.ofString(CRLF, HDR_CS);
+
+            return concat(h, b, t);
+        }
+    }
+
+    /**
+     * File / blob upload.
+     */
+    static final class FilePart implements Part {
+        private final String name;
+        private final String filename;
+        private final String contentType;
+        private final Blob blob;
+
+        FilePart(String name, Blob blob, String filename, String contentType) {
+            this.name = name;
+            this.filename = filename;
+            this.contentType = contentType != null ? contentType : DEFAULT_FILE_CT;
+            this.blob = blob;
+        }
+
+        @Override
+        public BodyPublisher toPublisher(String boundary) {
+            String cd = contentDispositionWithFilename(name, filename);
+            String header = DASHES + boundary + CRLF +
+                    "Content-Disposition: " + cd + CRLF +
+                    "Content-Type: " + contentType + CRLF +
+                    CRLF;
+
+            BodyPublisher h = BodyPublishers.ofString(header, HDR_CS);
+            BodyPublisher c = BodyPublishers.fromPublisher(blob.asPublisher()); // streaming
+            BodyPublisher t = BodyPublishers.ofString(CRLF, HDR_CS);
+
+            return concat(h, c, t);
+        }
+    }
+
+    // -------------------------------------------------------
+    // Helpers
+    // -------------------------------------------------------
+    private static String escapeQuoted(String s) {
+        Objects.requireNonNull(s, "quoted string");
+        StringBuilder out = new StringBuilder(s.length());
+        for (int i = 0; i < s.length(); i++) {
+            char c = s.charAt(i);
+            if (c == '"' || c == '\\') out.append('\\').append(c);
+            else if (c == '\r' || c == '\n') out.append(' ');
+            else out.append(c);
+        }
+        return out.toString();
+    }
+
+    /**
+     * RFC 5987 filename* with ASCII fallback.
+     */
+    private static String contentDispositionWithFilename(String name, String filename) {
+        String safeName = escapeQuoted(name);
+        String fallback = escapeQuoted(asAsciiFilenameFallback(filename));
+        String encoded;
+        try {
+            encoded = URLEncoder.encode(filename, TXT_CS).replace("+", "%20");
+        } catch (Exception e) {
+            encoded = fallback;
+        }
+        return "form-data; name=\"" + safeName + "\"; filename=\"" + fallback + "\"; filename*=UTF-8''" + encoded;
+    }
+
+    private static String asAsciiFilenameFallback(String filename) {
+        StringBuilder sb = new StringBuilder(filename.length());
+        for (int i = 0; i < filename.length(); i++) {
+            char c = filename.charAt(i);
+            if (c >= 0x20 && c <= 0x7E && c != '"' && c != '\\') sb.append(c);
+            else sb.append('_');
+        }
+        return sb.toString();
+    }
+
+    private static BodyPublisher concat(BodyPublisher... publishers) {
+        return BodyPublishers.fromPublisher(ReactiveUtils.concat(List.of(publishers)));
+    }
+
+    private static BodyPublisher concat(List publishers) {
+        List> bufferPublishers = List.copyOf(publishers);
+        return BodyPublishers.fromPublisher(ReactiveUtils.concat(bufferPublishers));
+    }
+
+}
diff --git a/src/main/java/studio/livepeer/livepeer/utils/MultipartFormMetadata.java b/src/main/java/studio/livepeer/livepeer/utils/MultipartFormMetadata.java
index 3af23dbd..d6d2f3ca 100644
--- a/src/main/java/studio/livepeer/livepeer/utils/MultipartFormMetadata.java
+++ b/src/main/java/studio/livepeer/livepeer/utils/MultipartFormMetadata.java
@@ -1,7 +1,6 @@
 /* 
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
  */
-
 package studio.livepeer.livepeer.utils;
 
 import java.lang.reflect.Field;
diff --git a/src/main/java/studio/livepeer/livepeer/utils/NameValue.java b/src/main/java/studio/livepeer/livepeer/utils/NameValue.java
new file mode 100644
index 00000000..989bb87a
--- /dev/null
+++ b/src/main/java/studio/livepeer/livepeer/utils/NameValue.java
@@ -0,0 +1,22 @@
+/* 
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package studio.livepeer.livepeer.utils;
+
+final class NameValue {
+    private final String name;
+    private final String value;
+
+    NameValue(String name, String value) {
+        this.name = name;
+        this.value = value;
+    }
+
+    String name() {
+        return name;
+    }
+
+    String value() {
+        return value;
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/studio/livepeer/livepeer/utils/NonRetryableException.java b/src/main/java/studio/livepeer/livepeer/utils/NonRetryableException.java
new file mode 100644
index 00000000..ff993510
--- /dev/null
+++ b/src/main/java/studio/livepeer/livepeer/utils/NonRetryableException.java
@@ -0,0 +1,17 @@
+/* 
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package studio.livepeer.livepeer.utils;
+
+public final class NonRetryableException extends Exception {
+    private final Throwable throwable;
+
+    public NonRetryableException(Throwable throwable) {
+        super(throwable);
+        this.throwable = throwable;
+    }
+
+    public Throwable exception() {
+        return throwable;
+    }
+}
diff --git a/src/main/java/studio/livepeer/livepeer/utils/OneOfDeserializer.java b/src/main/java/studio/livepeer/livepeer/utils/OneOfDeserializer.java
index 9b6ab687..4b1da6c2 100644
--- a/src/main/java/studio/livepeer/livepeer/utils/OneOfDeserializer.java
+++ b/src/main/java/studio/livepeer/livepeer/utils/OneOfDeserializer.java
@@ -1,7 +1,6 @@
 /* 
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
  */
-
 package studio.livepeer.livepeer.utils;
 
 import java.io.IOException;
@@ -35,7 +34,7 @@ public class OneOfDeserializer extends StdDeserializer {
 
     private static final long serialVersionUID = -1;
 
-    private final List typeReferences; // oneOf subschemas 
+    private final transient List typeReferences; // oneOf subschemas 
     private final Class cls;
     private final boolean strict;
     private final ObjectMapper mapper;
diff --git a/src/main/java/studio/livepeer/livepeer/utils/Options.java b/src/main/java/studio/livepeer/livepeer/utils/Options.java
index 5cf3cc8d..099dafe5 100644
--- a/src/main/java/studio/livepeer/livepeer/utils/Options.java
+++ b/src/main/java/studio/livepeer/livepeer/utils/Options.java
@@ -1,7 +1,6 @@
 /* 
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
  */
-
 package studio.livepeer.livepeer.utils;
 
 import java.util.Optional;
@@ -13,14 +12,14 @@ public enum Option {
         RETRY_CONFIG;
     }
 
-    private Optional retryConfig = Optional.empty();
+    private Optional retryConfig = Optional.empty();
 
-    private Options(Optional retryConfig) {
+    private Options(Optional retryConfig) {
         Utils.checkNotNull(retryConfig, "retryConfig");
         this.retryConfig = retryConfig;
     }
 
-    public Optional retryConfig() {
+    public Optional retryConfig() {
         return retryConfig;
     }
 
@@ -36,17 +35,17 @@ public final static Builder builder() {
 
     public final static class Builder {
 
-        private Optional retryConfig = Optional.empty();
+        private Optional retryConfig = Optional.empty();
 
         private Builder() {}
 
-        public Builder retryConfig(studio.livepeer.livepeer.utils.RetryConfig retryConfig) throws IllegalArgumentException {
+        public Builder retryConfig(RetryConfig retryConfig) throws IllegalArgumentException {
             Utils.checkNotNull(retryConfig, "retryConfig");
             this.retryConfig = Optional.of(retryConfig);
             return this;
         }
 
-        public Builder retryConfig(Optional retryConfig) throws IllegalArgumentException {
+        public Builder retryConfig(Optional retryConfig) throws IllegalArgumentException {
             Utils.checkNotNull(retryConfig, "retryConfig");
             this.retryConfig = retryConfig;
             return this;
diff --git a/src/main/java/studio/livepeer/livepeer/utils/PathParamsMetadata.java b/src/main/java/studio/livepeer/livepeer/utils/PathParamsMetadata.java
index 909a1a75..8da51454 100644
--- a/src/main/java/studio/livepeer/livepeer/utils/PathParamsMetadata.java
+++ b/src/main/java/studio/livepeer/livepeer/utils/PathParamsMetadata.java
@@ -1,22 +1,23 @@
 /* 
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
  */
-
 package studio.livepeer.livepeer.utils;
 
 import java.lang.reflect.Field;
 
 class PathParamsMetadata {
 
+    // these fields set via reflection
+    
     String style = "simple";
     boolean explode;
     String name;
     String serialization;
+    boolean allowReserved;
 
     private PathParamsMetadata() {
     }
 
-    // pathParam:style=simple,explode=false,name=apiID
     static PathParamsMetadata parse(Field field) throws IllegalArgumentException, IllegalAccessException {
         return Metadata.parse("pathParam", new PathParamsMetadata(), field);
     }
diff --git a/src/main/java/studio/livepeer/livepeer/utils/QueryEncoding.java b/src/main/java/studio/livepeer/livepeer/utils/QueryEncoding.java
new file mode 100644
index 00000000..8f670e3c
--- /dev/null
+++ b/src/main/java/studio/livepeer/livepeer/utils/QueryEncoding.java
@@ -0,0 +1,95 @@
+/* 
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package studio.livepeer.livepeer.utils;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.BitSet;
+
+final class QueryEncoding {
+    
+    private static final int RADIX = 16;
+    private static final char QUERY_PARAM_SEPARATOR = '&';
+    private static final char PARAM_VALUE_SEPARATOR = '=';
+    
+    
+    /////////////////////////////////
+    // Query Encoding
+    /////////////////////////////////
+
+    private static final BitSet UNRESERVED = new BitSet(256);
+
+    static {
+        for (int i = 'a'; i <= 'z'; i++) {
+            UNRESERVED.set(i);
+        }
+        for (int i = 'A'; i <= 'Z'; i++) {
+            UNRESERVED.set(i);
+        }
+        // numeric characters
+        for (int i = '0'; i <= '9'; i++) {
+            UNRESERVED.set(i);
+        }
+        UNRESERVED.set('-');
+        UNRESERVED.set('.');
+        UNRESERVED.set('_');
+        UNRESERVED.set('~');
+    }
+    
+    /**
+     * Returns the encoded query string from the given parameters.
+     * 
+     * @param parameters query parameters
+     * @param charset charset to apply for percent encoding
+     * @param blankAsPlus set to true to encode a blank as a plus character
+     * @return encoded query string
+     */
+    static String formatQuery(final Iterable parameters,
+            final Charset charset, final boolean blankAsPlus) {
+        StringBuilder buf = new StringBuilder();
+        int i = 0;
+        for (final NameValue parameter : parameters) {
+            if (i > 0) {
+                buf.append(QUERY_PARAM_SEPARATOR);
+            }
+            percentEncode(buf, parameter.name(), charset, blankAsPlus);
+            if (parameter.value() != null) {
+                buf.append(PARAM_VALUE_SEPARATOR);
+                percentEncode(buf, parameter.value(), charset, blankAsPlus);
+            }
+            i++;
+        }
+        return buf.toString();
+    }
+
+    private static void percentEncode(final StringBuilder buf, final CharSequence content, final Charset charset,
+            final boolean blankAsPlus) {
+        percentEncode(buf, content, charset, UNRESERVED, blankAsPlus);
+    }
+
+    private static void percentEncode(final StringBuilder buf, final CharSequence content, final Charset charset,
+            final BitSet safechars, final boolean blankAsPlus) {
+        if (content == null) {
+            return;
+        }
+        final CharBuffer cb = CharBuffer.wrap(content);
+        final ByteBuffer bb = (charset != null ? charset : StandardCharsets.UTF_8).encode(cb);
+        while (bb.hasRemaining()) {
+            final int b = bb.get() & 0xff;
+            if (safechars.get(b)) {
+                buf.append((char) b);
+            } else if (blankAsPlus && b == ' ') {
+                buf.append("+");
+            } else {
+                buf.append("%");
+                final char hex1 = Character.toUpperCase(Character.forDigit((b >> 4) & 0xF, RADIX));
+                final char hex2 = Character.toUpperCase(Character.forDigit(b & 0xF, RADIX));
+                buf.append(hex1);
+                buf.append(hex2);
+            }
+        }
+    }
+}
diff --git a/src/main/java/studio/livepeer/livepeer/utils/QueryParameter.java b/src/main/java/studio/livepeer/livepeer/utils/QueryParameter.java
new file mode 100644
index 00000000..01dfe7bb
--- /dev/null
+++ b/src/main/java/studio/livepeer/livepeer/utils/QueryParameter.java
@@ -0,0 +1,61 @@
+/* 
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package studio.livepeer.livepeer.utils;
+
+import java.util.Objects;
+
+// internal class, not for public use
+// TODO move to internal package
+public final class QueryParameter {
+    
+    private final String name;
+    private final String value;
+    private final boolean allowReserved;
+    
+    private QueryParameter(String name, String value, boolean allowReserved) {
+        this.name = name;
+        this.value = value;
+        this.allowReserved = allowReserved;
+    }
+    
+    public static QueryParameter of(String name, String value, boolean allowReserved) {
+        return new QueryParameter(name, value, allowReserved);
+    }
+    
+    public String name() {
+        return name;
+    }
+    
+    public String value() {
+        return value;
+    }
+    
+    public boolean allowReserved() {
+        return allowReserved;
+    }
+
+    @Override
+    public String toString() {
+        return "QueryParameter [name=" + name + ", value=" + value + ", allowReserved=" + allowReserved + "]";
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(allowReserved, name, value);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        QueryParameter other = (QueryParameter) obj;
+        return allowReserved == other.allowReserved && Objects.equals(name, other.name)
+                && Objects.equals(value, other.value);
+    }
+
+}
diff --git a/src/main/java/studio/livepeer/livepeer/utils/QueryParameters.java b/src/main/java/studio/livepeer/livepeer/utils/QueryParameters.java
index 0f617bc1..00fefef5 100644
--- a/src/main/java/studio/livepeer/livepeer/utils/QueryParameters.java
+++ b/src/main/java/studio/livepeer/livepeer/utils/QueryParameters.java
@@ -1,26 +1,20 @@
 /* 
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
  */
-
 package studio.livepeer.livepeer.utils;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
-import org.apache.http.NameValuePair;
-import org.apache.http.message.BasicNameValuePair;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
 public class QueryParameters {
-    public static  List parseQueryParams(Class type, T queryParams,
-            Map>> globals) throws Exception {
-        List allParams = new ArrayList<>();
+    public static  List parseQueryParams(Class type, T queryParams,
+            Globals globals) throws Exception {
+        List allParams = new ArrayList<>();
 
         Field[] fields = type.getDeclaredFields();
 
@@ -45,48 +39,61 @@ public static  List parseQueryParams(Class t
             }
 
             if (queryParamsMetadata.serialization != null && !queryParamsMetadata.serialization.isBlank()) {
-                List params = parseSerializedParams(queryParamsMetadata, value);
+                List params = parseSerializedParams(queryParamsMetadata, value);
                 allParams.addAll(params);
             } else {
                 switch (queryParamsMetadata.style) {
                     case "form":
-                        List formParams = parseDelimitedParams(queryParamsMetadata, value, ",");
+                        List formParams = parseDelimitedParams(queryParamsMetadata, value, ",");
                         allParams.addAll(formParams);
                         break;
                     case "deepObject":
-                        List deepObjectParams = parseDeepObjectParams(queryParamsMetadata, value);
+                        List deepObjectParams = parseDeepObjectParams(queryParamsMetadata, value);
                         allParams.addAll(deepObjectParams);
                         break;
                     case "pipeDelimited":
-                        List pipeDelimitedParams = parseDelimitedParams(queryParamsMetadata, value, "|");
+                        List pipeDelimitedParams = parseDelimitedParams(queryParamsMetadata, value, "|");
                         allParams.addAll(pipeDelimitedParams);
                         break;
+                    default:
+                        break;
                 }
             }
         }
 
+        // include all global params in pathParams if not already present
+        if (globals != null) {
+            Set allParamNames = allParams.stream()
+                .map(QueryParameter::name)
+                .collect(Collectors.toSet());
+            globals.queryParamsAsStream()
+                .filter(entry -> !allParamNames.contains(entry.getKey()))
+                .forEach(entry ->      
+                        allParams.add(QueryParameter.of(entry.getKey(), 
+                            entry.getValue(), false)));
+        }
+        
         return allParams;
     }
 
-    private static List parseSerializedParams(QueryParamsMetadata queryParamsMetadata, Object value)
+    private static List parseSerializedParams(QueryParamsMetadata queryParamsMetadata, Object value)
             throws JsonProcessingException {
-        List params = new ArrayList<>();
-
+        List params = new ArrayList<>();
         switch (queryParamsMetadata.serialization) {
             case "json":
                 ObjectMapper mapper = JSON.getMapper();
                 String json = mapper.writeValueAsString(value);
-
-                params.add(new BasicNameValuePair(queryParamsMetadata.name, json));
+                params.add(QueryParameter.of(queryParamsMetadata.name, json, queryParamsMetadata.allowReserved));
+                break;
+            default:
                 break;
         }
-
         return params;
     }
 
-    private static List parseDelimitedParams(QueryParamsMetadata queryParamsMetadata, Object value, String delimiter)
+    private static List parseDelimitedParams(QueryParamsMetadata queryParamsMetadata, Object value, String delimiter)
             throws IllegalArgumentException, IllegalAccessException {
-        List params = new ArrayList<>();
+        List params = new ArrayList<>();
 
         switch (Types.getType(value.getClass())) {
             case ARRAY: {
@@ -106,7 +113,7 @@ private static List parseDelimitedParams(QueryParamsMetadata quer
                     values.add(String.join(delimiter, items));
                 }
 
-                params.addAll(values.stream().map(v -> new BasicNameValuePair(queryParamsMetadata.name, v))
+                params.addAll(values.stream().map(v -> QueryParameter.of(queryParamsMetadata.name, v, queryParamsMetadata.allowReserved))
                         .collect(Collectors.toList()));
                 break;
             }
@@ -120,20 +127,25 @@ private static List parseDelimitedParams(QueryParamsMetadata quer
                     String val = Utils.valToString(entry.getValue());
 
                     if (queryParamsMetadata.explode) {
-                        params.add(new BasicNameValuePair(key, val));
+                        params.add(QueryParameter.of(key, val, queryParamsMetadata.allowReserved));
                     } else {
                         items.add(String.format("%s%s%s", key, delimiter, val));
                     }
                 }
 
                 if (items.size() > 0) {
-                    params.add(new BasicNameValuePair(queryParamsMetadata.name, String.join(delimiter, items)));
+                    params.add(QueryParameter.of(queryParamsMetadata.name, String.join(delimiter, items), queryParamsMetadata.allowReserved));
                 }
                 break;
             }
             case OBJECT: {
                 if (!Utils.allowIntrospection(value.getClass())) {
-                    params.add(new BasicNameValuePair(queryParamsMetadata.name, Utils.valToString(value)));
+                    params.add(QueryParameter.of(queryParamsMetadata.name, Utils.valToString(value), queryParamsMetadata.allowReserved));
+                    break;
+                }
+                Optional openEnumValue = Reflections.getOpenEnumValue(value.getClass(), value);
+                if (openEnumValue.isPresent()) {
+                    params.add(QueryParameter.of(queryParamsMetadata.name, Utils.valToString(openEnumValue.get()), queryParamsMetadata.allowReserved));
                     break;
                 }
                 Field[] fields = value.getClass().getDeclaredFields();
@@ -154,29 +166,29 @@ private static List parseDelimitedParams(QueryParamsMetadata quer
                     }
 
                     if (queryParamsMetadata.explode) {
-                        params.add(new BasicNameValuePair(metadata.name, Utils.valToString(val)));
+                        params.add(QueryParameter.of(metadata.name, Utils.valToString(val), metadata.allowReserved));
                     } else {
                         items.add(String.format("%s%s%s", metadata.name, delimiter, Utils.valToString(val)));
                     }
                 }
 
                 if (items.size() > 0) {
-                    params.add(new BasicNameValuePair(queryParamsMetadata.name, String.join(delimiter, items)));
+                    params.add(QueryParameter.of(queryParamsMetadata.name, String.join(delimiter, items), queryParamsMetadata.allowReserved));
                 }
                 break;
             }
             default:
-                params.add(new BasicNameValuePair(queryParamsMetadata.name, Utils.valToString(value)));
+                params.add(QueryParameter.of(queryParamsMetadata.name, Utils.valToString(value), queryParamsMetadata.allowReserved));
                 break;
         }
 
         return params;
     }
 
-    private static List parseDeepObjectParams(QueryParamsMetadata queryParamsMetadata, Object value) 
+    private static List parseDeepObjectParams(QueryParamsMetadata queryParamsMetadata, Object value) 
         throws Exception {
         
-        List params = new ArrayList<>();
+        List params = new ArrayList<>();
 
         switch (Types.getType(value.getClass())) {
             case MAP: {
@@ -188,12 +200,12 @@ private static List parseDeepObjectParams(QueryParamsMetadata que
 
                     if (val instanceof List || val.getClass().isArray()) {
                         for (Object v : Utils.toList(val)) {
-                            params.add(new BasicNameValuePair(String.format("%s[%s]", queryParamsMetadata.name, key),
-                                    Utils.valToString(v)));
+                            params.add(QueryParameter.of(String.format("%s[%s]", queryParamsMetadata.name, key),
+                                    Utils.valToString(v), queryParamsMetadata.allowReserved));
                         }
                     } else {
-                        params.add(new BasicNameValuePair(String.format("%s[%s]", queryParamsMetadata.name, key),
-                                Utils.valToString(val)));
+                        params.add(QueryParameter.of(String.format("%s[%s]", queryParamsMetadata.name, key),
+                                Utils.valToString(val), queryParamsMetadata.allowReserved));
                     }
                 }
 
@@ -203,6 +215,7 @@ private static List parseDeepObjectParams(QueryParamsMetadata que
                 if (!Utils.allowIntrospection(value.getClass())) {
                     throw new RuntimeException("DeepObject style only supports Map and Object types, not " + value.getClass());
                 }
+
                 Field[] fields = value.getClass().getDeclaredFields();
 
                 for (Field field : fields) {
@@ -220,14 +233,14 @@ private static List parseDeepObjectParams(QueryParamsMetadata que
 
                     if (val instanceof List || val.getClass().isArray()) {
                         for (Object v : Utils.toList(val)) {
-                            params.add(new BasicNameValuePair(
+                            params.add(QueryParameter.of(
                                     String.format("%s[%s]", queryParamsMetadata.name, metadata.name),
-                                    Utils.valToString(v)));
+                                    Utils.valToString(v), metadata.allowReserved));
                         }
                     } else {
                         params.add(
-                                new BasicNameValuePair(String.format("%s[%s]", queryParamsMetadata.name, metadata.name),
-                                        Utils.valToString(val)));
+                                QueryParameter.of(String.format("%s[%s]", queryParamsMetadata.name, metadata.name),
+                                        Utils.valToString(val), metadata.allowReserved));
                     }
                 }
 
diff --git a/src/main/java/studio/livepeer/livepeer/utils/QueryParamsMetadata.java b/src/main/java/studio/livepeer/livepeer/utils/QueryParamsMetadata.java
index 43c33f95..c49c95fa 100644
--- a/src/main/java/studio/livepeer/livepeer/utils/QueryParamsMetadata.java
+++ b/src/main/java/studio/livepeer/livepeer/utils/QueryParamsMetadata.java
@@ -1,19 +1,20 @@
 /* 
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
  */
-
 package studio.livepeer.livepeer.utils;
 
 import java.lang.reflect.Field;
 
 class QueryParamsMetadata {
 
+    // these parameters set via reflection
+
     String style = "form";
     boolean explode = true;
     String name;
     String serialization;
+    boolean allowReserved;
 
-    // queryParam:style=simple,explode=false,name=apiID
     static QueryParamsMetadata parse(Field field) throws IllegalArgumentException, IllegalAccessException {
         return Metadata.parse("queryParam", new QueryParamsMetadata(), field);
     }
diff --git a/src/main/java/studio/livepeer/livepeer/utils/RecordingClient.java b/src/main/java/studio/livepeer/livepeer/utils/RecordingClient.java
new file mode 100644
index 00000000..98531d28
--- /dev/null
+++ b/src/main/java/studio/livepeer/livepeer/utils/RecordingClient.java
@@ -0,0 +1,60 @@
+/* 
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package studio.livepeer.livepeer.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.function.UnaryOperator;
+
+// internal testing use
+public final class RecordingClient implements HTTPClient {
+
+    private final List requests = new CopyOnWriteArrayList<>();
+    private final HTTPClient client;
+    private final List> beforeRequestHooks = new ArrayList<>();
+    private final List>> afterResponseHooks = new ArrayList<>();
+
+    public RecordingClient() {
+        this.client = new SpeakeasyHTTPClient();
+    }
+
+    @Override
+    public HttpResponse send(HttpRequest request)
+            throws IOException, InterruptedException, URISyntaxException {
+        for (var hook : beforeRequestHooks) {
+            request = hook.apply(request);
+        }
+        requests.add(request);
+        var response = client.send(request);
+        for (var hook: afterResponseHooks) {
+            response = hook.apply(response);
+        }
+        return response;
+    }
+
+    public List requests() {
+        return requests;
+    }
+
+    public RecordingClient beforeRequest(UnaryOperator hook) {
+        beforeRequestHooks.add(hook);
+        return this;
+    }
+    
+    public RecordingClient afterResponse(UnaryOperator> hook) {
+        afterResponseHooks.add(hook);
+        return this;
+    }
+
+    public void reset() {
+        requests.clear();
+    }
+
+}
\ No newline at end of file
diff --git a/src/main/java/studio/livepeer/livepeer/utils/Reflections.java b/src/main/java/studio/livepeer/livepeer/utils/Reflections.java
new file mode 100644
index 00000000..c1c61539
--- /dev/null
+++ b/src/main/java/studio/livepeer/livepeer/utils/Reflections.java
@@ -0,0 +1,138 @@
+/* 
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
+ */
+package studio.livepeer.livepeer.utils;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
+// INTERNAL API ONLY
+
+public class Reflections {
+
+    /**
+     * Extracts the underlying value from an open enum instance if the class follows the open enum pattern.
+     *
+     * 

An open enum is a class that emulates enum behavior but can handle unknown values + * without runtime errors. This pattern is commonly used for API responses where new + * enum values might be added over time. + * + *

The method validates that the class follows the open enum pattern by checking for: + *

    + *
  • A static factory method {@code of(String)} or {@code of(Integer)} that returns the class type
  • + *
  • An instance method {@code value()} returning String or Integer
  • + *
  • At least one public static final field of the same class type (predefined constants)
  • + *
+ * + *

If all validation passes, the method invokes the {@code value()} method on the provided instance + * and returns the result. + * + * @param clazz the class to examine for open enum pattern + * @param instance the instance of the open enum class from which to extract the value + * @return {@code Optional} containing the extracted value (String or Integer) if the class + * follows the open enum pattern and the value extraction succeeds, {@code Optional.empty()} otherwise + */ + public static Optional getOpenEnumValue(Class clazz, Object instance) { + Objects.requireNonNull(clazz, "Class cannot be null"); + + try { + // Check for factory method of(String) or of(Integer) + boolean hasFactoryMethod = Arrays.stream(clazz.getDeclaredMethods()) + .anyMatch(method -> isValidFactoryMethod(method, clazz)); + if (!hasFactoryMethod) { + return Optional.empty(); + } + + // Check for at least one static constant of same type + if (!hasStaticConstants(clazz)) { + return Optional.empty(); + } + + // Check for value() method returning String or Integer + Method valueMethod = clazz.getMethod("value"); + if (!isValidValueMethod(valueMethod)) { + return Optional.empty(); + } + + valueMethod.setAccessible(true); + return Optional.of(valueMethod.invoke(instance)); + } catch (Exception e) { + return Optional.empty(); + } + } + + private static boolean isNumericType(Class type) { + // Primitive numeric types + if (type.isPrimitive()) { + return type == byte.class || type == short.class || + type == int.class || type == long.class || + type == float.class || type == double.class; + } + + // Number subclasses (Integer, Long, Double, BigDecimal, etc.) + if (Number.class.isAssignableFrom(type)) { + return true; + } + + // Atomic numeric types + return type == AtomicInteger.class || type == AtomicLong.class; + } + + /** + * Checks if the given method is a valid factory method for an open enum. + * + * @param method the method to check + * @param clazz the class that should be returned by the factory method + * @return true if valid factory method + */ + private static boolean isValidFactoryMethod(Method method, Class clazz) { + // Must be named "of" + if (!"of".equals(method.getName())) { + return false; + } + + // Must be static and return the enum class + if (!Modifier.isStatic(method.getModifiers()) || !method.getReturnType().equals(clazz)) { + return false; + } + + // Must have exactly one parameter of String or Integer type + Class[] parameterTypes = method.getParameterTypes(); + return parameterTypes.length == 1 && + (String.class.equals(parameterTypes[0]) || isNumericType(parameterTypes[0])); + } + + /** + * Checks if the given method is a valid value() method for an open enum. + * + * @param method the value() method to validate + * @return true if valid value method + */ + private static boolean isValidValueMethod(Method method) { + // Must not be static and return String or Integer + return !Modifier.isStatic(method.getModifiers()) && + (String.class.equals(method.getReturnType()) || isNumericType(method.getReturnType())); + } + + /** + * Checks if the class has at least one public static final field of the same class type. + * + * @param clazz the class to check for static constants + * @return true if has static constants + */ + private static boolean hasStaticConstants(Class clazz) { + return Arrays.stream(clazz.getDeclaredFields()) + .anyMatch(field -> { + int modifiers = field.getModifiers(); + return Modifier.isStatic(modifiers) && + Modifier.isFinal(modifiers) && + Modifier.isPublic(modifiers) && + clazz.equals(field.getType()); + }); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/RequestBody.java b/src/main/java/studio/livepeer/livepeer/utils/RequestBody.java index b80dc5cf..3677027d 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/RequestBody.java +++ b/src/main/java/studio/livepeer/livepeer/utils/RequestBody.java @@ -1,51 +1,43 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; +import java.io.ByteArrayInputStream; import java.io.IOException; -import java.io.UncheckedIOException; import java.lang.reflect.Field; import java.lang.reflect.Modifier; +import java.net.http.HttpRequest; import java.net.http.HttpRequest.BodyPublishers; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.regex.Pattern; import java.util.Optional; - -import org.apache.http.HttpEntity; -import org.apache.http.NameValuePair; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.mime.HttpMultipartMode; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.message.BasicNameValuePair; +import java.util.regex.Pattern; import org.openapitools.jackson.nullable.JsonNullable; import com.fasterxml.jackson.databind.ObjectMapper; public final class RequestBody { - private static final Map SERIALIZATION_METHOD_TO_CONTENT_TYPE = Map.of( - "json", "application/json", - "form", "application/x-www-form-urlencoded", - "multipart", "multipart/form-data", - "raw", "application/octet-stream", - "string", "text/plain"); + private static final Map SERIALIZATION_METHOD_TO_CONTENT_TYPE = Map.of("json", "application/json", + "form", "application/x-www-form-urlencoded", "multipart", "multipart/form-data", "raw", + "application/octet-stream", "string", "text/plain"); private RequestBody() { // prevent instantiation } - public static SerializedBody serialize(Object request, String requestField, String serializationMethod, boolean nullable) - throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, + public static SerializedBody serialize(Object request, String requestField, String serializationMethod, + boolean nullable) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException, UnsupportedOperationException, IOException { if (request == null) { return null; } - + if (!nullable && (request instanceof Optional) && ((Optional) request).isEmpty()) { request = JsonNullable.undefined(); } @@ -98,8 +90,7 @@ private static SerializedBody serializeContentType(String fieldName, String cont if (value instanceof JsonNullable && !((JsonNullable) value).isPresent()) { body = new SerializedBody(contentType, BodyPublishers.noBody()); } else { - body = new SerializedBody(contentType, - BodyPublishers.ofString(mapper.writeValueAsString(value))); + body = new SerializedBody(contentType, BodyPublishers.ofString(mapper.writeValueAsString(value))); } } else if (multipartPattern.matcher(contentType).matches()) { body = serializeMultipart(value); @@ -110,6 +101,8 @@ private static SerializedBody serializeContentType(String fieldName, String cont body = new SerializedBody(contentType, BodyPublishers.ofString((String) value)); } else if (value instanceof byte[]) { body = new SerializedBody(contentType, BodyPublishers.ofByteArray((byte[]) value)); + } else if (value instanceof HttpRequest.BodyPublisher) { + body = new SerializedBody(contentType, (HttpRequest.BodyPublisher) value); } else { throw new RuntimeException("Unsupported content type " + contentType + " for field " + fieldName); } @@ -119,10 +112,7 @@ private static SerializedBody serializeContentType(String fieldName, String cont private static SerializedBody serializeMultipart(Object value) throws IllegalArgumentException, IllegalAccessException, UnsupportedOperationException, IOException { - MultipartEntityBuilder builder = MultipartEntityBuilder.create(); - builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); - String boundary = "-------------" + System.currentTimeMillis(); - builder.setBoundary(boundary); + Multipart.Builder builder = Multipart.builder(); Field[] fields = value.getClass().getDeclaredFields(); @@ -132,7 +122,7 @@ private static SerializedBody serializeMultipart(Object value) continue; } Object val = Utils.resolveOptionals(field.get(value)); - + if (val == null) { continue; } @@ -143,43 +133,44 @@ private static SerializedBody serializeMultipart(Object value) } if (metadata.file) { - serializeMultipartFile(builder, val); + if (val instanceof List || val.getClass().isArray()) { + // Handle file arrays + List arr = Utils.toList(val); + for (Object item : arr) { + serializeMultipartFile(metadata.name + "[]", builder, item); + } + } else { + // Handle single file + serializeMultipartFile(metadata.name, builder, val); + } } else if (metadata.json) { ObjectMapper mapper = JSON.getMapper(); String json = mapper.writeValueAsString(val); - builder.addTextBody(metadata.name, json, ContentType.APPLICATION_JSON); + builder.addPart(metadata.name, json, "application/json"); } else { if (val instanceof List || val.getClass().isArray()) { List arr = Utils.toList(val); for (Object item : arr) { - builder.addTextBody(metadata.name + "[]", Utils.valToString(item)); + builder.addPart(metadata.name + "[]", Utils.valToString(item)); } } else { - builder.addTextBody(metadata.name, Utils.valToString(val)); + builder.addPart(metadata.name, Utils.valToString(val)); } } } - HttpEntity entity = builder.build(); - String ct = builder.build().getContentType().getValue(); - return new SerializedBody(ct, BodyPublishers.ofInputStream(() -> { - try { - return entity.getContent(); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - })); + Multipart m = builder.build(); + return new SerializedBody(m.contentType(), m.bodyPublisher()); } - private static void serializeMultipartFile(MultipartEntityBuilder builder, Object file) + private static void serializeMultipartFile(String fieldName, Multipart.Builder builder, Object file) throws IllegalArgumentException, IllegalAccessException { if (Types.getType(file.getClass()) != Types.OBJECT) { throw new RuntimeException("Invalid type for multipart file"); } - String fieldName = ""; String fileName = ""; - byte[] content = null; + Object content = null; Field[] fields = file.getClass().getDeclaredFields(); @@ -197,155 +188,162 @@ private static void serializeMultipartFile(MultipartEntityBuilder builder, Objec } if (metadata.content) { - content = (byte[]) val; + content = val; } else { - fieldName = metadata.name; fileName = Utils.valToString(val); } } - if (fieldName.isBlank() || fileName.isBlank() || content == null) { + if (fileName.isBlank() || content == null) { throw new RuntimeException("Invalid multipart file"); } - - builder.addBinaryBody(fieldName, content, ContentType.APPLICATION_OCTET_STREAM, fileName); + + // Detect content type based on file extension + String contentType = "application/octet-stream"; // default fallback + try { + String detectedType = Files.probeContentType(Path.of(fileName)); + if (detectedType != null && !detectedType.isEmpty()) { + contentType = detectedType; + } + } catch (Exception e) { + // If detection fails, use the default fallback + } + if (content instanceof byte[]) { + builder.addPart(fieldName, (byte[]) content, fileName, contentType); + } else { + builder.addPart(fieldName, (Blob) content, fileName, contentType); + } } public static SerializedBody serializeFormData(Object value) throws IOException, IllegalArgumentException, IllegalAccessException { - List params = new ArrayList<>(); + List params = new ArrayList<>(); switch (Types.getType(value.getClass())) { - case MAP: - Map map = (Map) value; + case MAP: + Map map = (Map) value; + + for (Map.Entry entry : map.entrySet()) { + params.add( + new NameValue(Utils.valToString(entry.getKey()), Utils.valToString(entry.getValue()))); + } + break; + case OBJECT: + if (!Utils.allowIntrospection(value.getClass())) { + throw new RuntimeException("Invalid type for form data"); + } + Field[] fields = value.getClass().getDeclaredFields(); + + for (Field field : fields) { + field.setAccessible(true); + Object val = Utils.resolveOptionals(field.get(value)); - for (Map.Entry entry : map.entrySet()) { - params.add( - new BasicNameValuePair(Utils.valToString(entry.getKey()), - Utils.valToString(entry.getValue()))); + if (val == null) { + continue; } - break; - case OBJECT: - if (!Utils.allowIntrospection(value.getClass())) { - throw new RuntimeException("Invalid type for form data"); + + FormMetadata metadata = FormMetadata.parse(field); + if (metadata == null) { + continue; } - Field[] fields = value.getClass().getDeclaredFields(); - - for (Field field : fields) { - field.setAccessible(true); - Object val = Utils.resolveOptionals(field.get(value)); - - if (val == null) { - continue; - } - FormMetadata metadata = FormMetadata.parse(field); - if (metadata == null) { - continue; - } + if (metadata.json) { + ObjectMapper mapper = JSON.getMapper(); + String json = mapper.writeValueAsString(val); + params.add(new NameValue(metadata.name, json)); + } else { + switch (Types.getType(val.getClass())) { + case OBJECT: { + if (!Utils.allowIntrospection(val.getClass())) { + params.add(new NameValue(metadata.name, String.valueOf(val))); + } else { - if (metadata.json) { - ObjectMapper mapper = JSON.getMapper(); - String json = mapper.writeValueAsString(val); - params.add(new BasicNameValuePair(metadata.name, json)); - } else { - switch (Types.getType(val.getClass())) { - case OBJECT: { - if (!Utils.allowIntrospection(val.getClass())) { - params.add(new BasicNameValuePair(metadata.name, String.valueOf(val))); - } else { + Field[] valFields = val.getClass().getDeclaredFields(); + + List items = new ArrayList<>(); - Field[] valFields = val.getClass().getDeclaredFields(); - - List items = new ArrayList<>(); - - for (Field valField : valFields) { - valField.setAccessible(true); - Object v = Utils.resolveOptionals(valField.get(val)); - if (v == null) { - continue; - } - - FormMetadata valMetadata = FormMetadata.parse(valField); - if (valMetadata == null) { - continue; - } - - if (metadata.explode) { - params.add(new BasicNameValuePair(valMetadata.name, - Utils.valToString(v))); - } else { - items.add(String.format("%s,%s", valMetadata.name, - Utils.valToString(v))); - } - } - - if (items.size() > 0) { - params.add(new BasicNameValuePair(metadata.name, String.join(",", items))); - } + for (Field valField : valFields) { + valField.setAccessible(true); + Object v = Utils.resolveOptionals(valField.get(val)); + if (v == null) { + continue; } - break; - } - case MAP: { - Map valMap = (Map) val; - - List items = new ArrayList<>(); - - for (Map.Entry entry : valMap.entrySet()) { - if (metadata.explode) { - params.add(new BasicNameValuePair(Utils.valToString(entry.getKey()), - Utils.valToString(entry.getValue()))); - } else { - items.add(String.format("%s,%s", entry.getKey(), entry.getValue())); - } + + FormMetadata valMetadata = FormMetadata.parse(valField); + if (valMetadata == null) { + continue; } - if (items.size() > 0) { - params.add(new BasicNameValuePair(metadata.name, String.join(",", items))); + if (metadata.explode) { + params.add(new NameValue(valMetadata.name, Utils.valToString(v))); + } else { + items.add(String.format("%s,%s", valMetadata.name, Utils.valToString(v))); } + } - break; + if (items.size() > 0) { + params.add(new NameValue(metadata.name, String.join(",", items))); } - case ARRAY: { - final List array = Utils.toList(val); + } + break; + } + case MAP: { + Map valMap = (Map) val; - List items = new ArrayList<>(); + List items = new ArrayList<>(); - for (Object item : array) { - if (metadata.explode) { - params.add(new BasicNameValuePair(metadata.name, Utils.valToString(item))); - } else { - items.add(Utils.valToString(item)); - } - } + for (Map.Entry entry : valMap.entrySet()) { + if (metadata.explode) { + params.add(new NameValue(Utils.valToString(entry.getKey()), + Utils.valToString(entry.getValue()))); + } else { + items.add(String.format("%s,%s", entry.getKey(), entry.getValue())); + } + } - if (items.size() > 0) { - params.add(new BasicNameValuePair(metadata.name, String.join(",", items))); - } + if (items.size() > 0) { + params.add(new NameValue(metadata.name, String.join(",", items))); + } - break; + break; + } + case ARRAY: { + final List array = Utils.toList(val); + + List items = new ArrayList<>(); + + for (Object item : array) { + if (metadata.explode) { + params.add(new NameValue(metadata.name, Utils.valToString(item))); + } else { + items.add(Utils.valToString(item)); } - default: - params.add(new BasicNameValuePair(metadata.name, Utils.valToString(val))); - break; } + + if (items.size() > 0) { + params.add(new NameValue(metadata.name, String.join(",", items))); + } + + break; + } + default: + params.add(new NameValue(metadata.name, Utils.valToString(val))); + break; } } - break; - default: - throw new RuntimeException("Invalid type for form data"); + } + break; + default: + throw new RuntimeException("Invalid type for form data"); } - UrlEncodedFormEntity entity = new UrlEncodedFormEntity(params); - String ct = entity.getContentType().getValue(); // ensure that a fresh open input stream is provided every time - // by the BodyPublisher - return new SerializedBody(ct, BodyPublishers.ofInputStream(() -> { - try { - return entity.getContent(); - } catch (IOException e) { - throw new UncheckedIOException(e); - } + // by the BodyPublisher + String contentType = "application/x-www-form-urlencoded; charset=ISO-8859-1"; + return new SerializedBody(contentType, BodyPublishers.ofInputStream(() -> { + String query = QueryEncoding.formatQuery(params, StandardCharsets.ISO_8859_1, true); + return new ByteArrayInputStream(query.getBytes(StandardCharsets.ISO_8859_1)); })); } -} \ No newline at end of file + +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/RequestMetadata.java b/src/main/java/studio/livepeer/livepeer/utils/RequestMetadata.java index b2ff2961..8c1eb03c 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/RequestMetadata.java +++ b/src/main/java/studio/livepeer/livepeer/utils/RequestMetadata.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.lang.reflect.Field; diff --git a/src/main/java/studio/livepeer/livepeer/utils/Response.java b/src/main/java/studio/livepeer/livepeer/utils/Response.java index e7aa9ade..f4fa6a4e 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/Response.java +++ b/src/main/java/studio/livepeer/livepeer/utils/Response.java @@ -1,9 +1,7 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; - import java.io.InputStream; import java.net.http.HttpResponse; diff --git a/src/main/java/studio/livepeer/livepeer/utils/ResponseWithBody.java b/src/main/java/studio/livepeer/livepeer/utils/ResponseWithBody.java new file mode 100644 index 00000000..00c0dfaf --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/ResponseWithBody.java @@ -0,0 +1,95 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import javax.net.ssl.SSLSession; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpHeaders; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.Optional; +import java.util.function.Function; + +/** + * A wrapper for {@link HttpResponse} that allows mappi ng the response body from type {@code R} to type {@code B}. + *

+ * This class delegates all methods to the original response, except for {@link #body()}, which returns the mapped body. + * The mapping is performed using the provided {@code bodyMapper} function at construction time. + * + * @param the type of the original response body + * @param the type of the mapped response body + */ +public class ResponseWithBody implements HttpResponse { + private final HttpResponse original; + private final Function bodyMapper; + private final B body; + + /** + * Constructs a new {@code ResponseWithBody} by wrapping an existing {@link HttpResponse} and applying + * a mapping function to its body. + * + * @param original the original response to wrap + * @param bodyMapper a function to map the original body to the new body type + */ + public ResponseWithBody(HttpResponse original, Function bodyMapper) { + this.original = original; + this.bodyMapper = bodyMapper; + this.body = bodyMapper.apply(original.body()); + } + + /** + * Constructs a new {@code ResponseWithBody} by wrapping an existing {@link HttpResponse} with + * a pre-computed body value. + * + * @param original the original response to wrap + * @param body the pre-computed body value + */ + public ResponseWithBody(HttpResponse original, B body) { + this.original = original; + this.body = body; + this.bodyMapper = null; + } + + @Override + public int statusCode() { + return original.statusCode(); + } + + @Override + public HttpRequest request() { + return original.request(); + } + + @Override + public Optional> previousResponse() { + return original.previousResponse() + .map(prev -> new ResponseWithBody<>(prev, bodyMapper)); + } + + @Override + public HttpHeaders headers() { + return original.headers(); + } + + @Override + public B body() { + return body; + } + + @Override + public Optional sslSession() { + return original.sslSession(); + } + + @Override + public URI uri() { + return original.uri(); + } + + @Override + public HttpClient.Version version() { + return original.version(); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/Retries.java b/src/main/java/studio/livepeer/livepeer/utils/Retries.java index a62808ec..3c9d8cf9 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/Retries.java +++ b/src/main/java/studio/livepeer/livepeer/utils/Retries.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.io.IOException; @@ -32,33 +31,7 @@ private Retries( this.retryConfig = retryConfig; this.statusCodes = statusCodes; } - - @SuppressWarnings("serial") - public static final class NonRetryableException extends Exception { - private final Exception exception; - - public NonRetryableException(Exception exception) { - super(exception); - this.exception = exception; - } - - public Exception exception() { - return exception; - } - } - - @SuppressWarnings("serial") - public static final class RetryableException extends Exception { - private final HttpResponse response; - - public RetryableException(HttpResponse response) { - this.response = response; - } - - public HttpResponse response() { - return response; - } - } + public HttpResponse run() throws Exception { @@ -131,7 +104,7 @@ private HttpResponse retryWithBackoff(boolean retryConnectError, bo try { return getResponse(retryConnectError, retryReadTimeoutError); } catch(NonRetryableException e) { - throw e.exception(); + throw Exceptions.coerceException(e.exception()); } catch(IOException | RetryableException e) { long nowMs = System.currentTimeMillis(); if (nowMs - startMs > backoff.maxElapsedTimeMs()) { diff --git a/src/main/java/studio/livepeer/livepeer/utils/RetryConfig.java b/src/main/java/studio/livepeer/livepeer/utils/RetryConfig.java index c04f43ed..c720c8ce 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/RetryConfig.java +++ b/src/main/java/studio/livepeer/livepeer/utils/RetryConfig.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.util.Optional; diff --git a/src/main/java/studio/livepeer/livepeer/utils/RetryableException.java b/src/main/java/studio/livepeer/livepeer/utils/RetryableException.java new file mode 100644 index 00000000..4cf6e88b --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/RetryableException.java @@ -0,0 +1,19 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import java.io.InputStream; +import java.net.http.HttpResponse; + +public final class RetryableException extends Exception { + private final HttpResponse response; + + public RetryableException(HttpResponse response) { + this.response = response; + } + + public HttpResponse response() { + return response; + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/Security.java b/src/main/java/studio/livepeer/livepeer/utils/Security.java index d0e314de..b4432342 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/Security.java +++ b/src/main/java/studio/livepeer/livepeer/utils/Security.java @@ -1,11 +1,21 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.lang.reflect.Field; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; import java.util.Base64; +import java.util.Deque; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; public final class Security { @@ -107,7 +117,7 @@ private static void parseSecuritySchemeValue(HTTPRequest request, SecurityMetada break; case "query": request.addQueryParam( - securityMetadata.name, Utils.valToString(value)); + securityMetadata.name, Utils.valToString(value), false); break; case "cookie": request.addHeader("Cookie", @@ -115,26 +125,32 @@ private static void parseSecuritySchemeValue(HTTPRequest request, SecurityMetada break; default: throw new RuntimeException( - "Unsupported security scheme subtype for apiKey: " + securityMetadata.subtype); + "Unsupported apiKey security scheme subtype: " + securityMetadata.subtype); } break; case "openIdConnect": request.addHeader(securityMetadata.name, Utils.prefixBearer(Utils.valToString(value))); break; case "oauth2": - request.addHeader(securityMetadata.name, Utils.prefixBearer(Utils.valToString(value))); + if (!"client_credentials".equals(schemeMetadata.subtype)) { + request.addHeader(securityMetadata.name, Utils.prefixBearer(Utils.valToString(value))); + } break; case "http": switch (schemeMetadata.subtype) { case "bearer": request.addHeader(securityMetadata.name, Utils.prefixBearer(Utils.valToString(value))); break; + case "custom": + // customers are expected to consume the security object and transform requests + // in their own BeforeRequest hook. + break; default: - throw new RuntimeException("Unsupported security scheme subtype for bearer"); + throw new RuntimeException("Unsupported http security scheme subtype: " + schemeMetadata.subtype); } break; default: - throw new RuntimeException("Unsupported security scheme type"); + throw new RuntimeException("Unsupported security scheme type: " + schemeMetadata.subtype); } } @@ -171,6 +187,117 @@ private static void parseBasicAuthScheme(HTTPRequest requestBuilder, Object sche } requestBuilder.addHeader("Authorization", - "Basic " + Base64.getEncoder().encodeToString(String.format("%s:%s", username, password).getBytes())); + "Basic " + + Base64.getEncoder() + .encodeToString(String.format("%s:%s", username, password) + .getBytes(StandardCharsets.UTF_8))); + } + + public static Optional findComplexObjectWithNonEmptyAnnotatedField(Object object, String... regexes) { + if (object == null || object instanceof String) { + return Optional.empty(); + } + Deque stack = new LinkedList<>(); + // be defensive about circular references (not expected) + Set processed = new HashSet<>(); + stack.push(object); + processed.add(object); + while (!stack.isEmpty()) { + Object o = stack.pop(); + Field[] fields = o.getClass().getDeclaredFields(); + List annotatedFields = Arrays.stream(fields) // + .filter(f -> { + SpeakeasyMetadata[] anns = f.getDeclaredAnnotationsByType(SpeakeasyMetadata.class); + return anns != null && anns.length > 0; + }) // + .collect(Collectors.toList()); + for (Field f : annotatedFields) { + SpeakeasyMetadata[] anns = f.getDeclaredAnnotationsByType(SpeakeasyMetadata.class); + Object value = getUnwrappedFieldValue(o, f); + if (value != null && !(value instanceof String)) { + // we are looking for a complex object (so can't be a String) + boolean regexMatches = Arrays // + .stream(regexes) // + .allMatch(regex -> matches(anns, regex)); + if (regexMatches) { + return Optional.of(value); + } else if (!processed.contains(value)) { + stack.push(value); + processed.add(value); + } + } + } + } + return Optional.empty(); + } + + private static Object getUnwrappedFieldValue(Object o, Field f) { + try { + f.setAccessible(true); + Object value = f.get(o); + if (value != null && value instanceof Optional) { + return ((Optional) value).orElse(null); + } else { + return value; + } + } catch (IllegalArgumentException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + public static Stream findFieldsWhereMetadataContainsRegexes(Object o, String... regexes) { + Field[] fields = o.getClass().getDeclaredFields(); + return Arrays.stream(fields) // + .filter(f -> { + SpeakeasyMetadata[] anns = f.getDeclaredAnnotationsByType(SpeakeasyMetadata.class); + if (anns == null) { + return false; + } + return Arrays // + .stream(regexes) // + .allMatch(regex -> matches(anns, regex)); + }); + } + + public static Optional findStringValueWhereMetadataContainsRegexes(Object o, String... regexes) { + return findValueWhereMetadataContainsRegexes(o, regexes).map(x -> (String) x); + } + + public static Optional findStringValueWhereMetadataNameIs(Object o, String name) { + return Security.findStringValueWhereMetadataContainsRegexes(o, "\\bname=" + name + "\\b"); + } + + public static Optional findValueWhereMetadataContainsRegexes(Object o, String... regexes) { + return findFieldsWhereMetadataContainsRegexes(o, regexes) + .flatMap(f -> { + f.setAccessible(true); + Object result; + try { + result = f.get(o); + } catch (IllegalArgumentException | IllegalAccessException e) { + throw new RuntimeException(e); + } + if (result instanceof Optional) { + @SuppressWarnings("unchecked") + Optional r = (Optional) result; + if (r.isEmpty()) { + return Stream.empty(); + } else { + return Stream.of(r.get()); + } + } else { + return Stream.of(result); + } + }).findAny(); + } + + private static boolean matches(SpeakeasyMetadata[] anns, String regex) { + Pattern pattern = Pattern.compile(regex); + for (SpeakeasyMetadata ann : anns) { + if (pattern.matcher(ann.value()).find()) { + return true; + } + } + return false; } -} \ No newline at end of file +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/SecurityMetadata.java b/src/main/java/studio/livepeer/livepeer/utils/SecurityMetadata.java index 9c878ae5..ca306173 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/SecurityMetadata.java +++ b/src/main/java/studio/livepeer/livepeer/utils/SecurityMetadata.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.lang.reflect.Field; diff --git a/src/main/java/studio/livepeer/livepeer/utils/SerializedBody.java b/src/main/java/studio/livepeer/livepeer/utils/SerializedBody.java index 976837da..d6a5eb3f 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/SerializedBody.java +++ b/src/main/java/studio/livepeer/livepeer/utils/SerializedBody.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.net.http.HttpRequest.BodyPublisher; diff --git a/src/main/java/studio/livepeer/livepeer/utils/SessionManager.java b/src/main/java/studio/livepeer/livepeer/utils/SessionManager.java new file mode 100644 index 00000000..2d988560 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/SessionManager.java @@ -0,0 +1,213 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; + +import studio.livepeer.livepeer.models.errors.AuthException; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public final class SessionManager { + + // VisibleForTesting + public static final int REFRESH_BEFORE_EXPIRY_SECONDS = 60; + + private final Map>> sessions = new HashMap<>(); + + public interface HasSessionKey { + String sessionKey(); + } + + public final static class Session { + private final T credentials; + private final Optional token; + private final List scopes; + private final Optional expiresAt; + + public Session(T credentials, Optional token, List scopes, Optional expiresAt) { + this.credentials = credentials; + this.token = token; + this.scopes = scopes; + this.expiresAt = expiresAt; + } + + public T credentials() { + return credentials; + } + + public Optional token() { + return token; + } + + public List scopes() { + return scopes; + } + + public Optional expiresAt() { + return expiresAt; + } + + } + + public Session getSession(T credentials, List scopes, Function, Session> tokenProvider ) { + final String sessionKey = credentials.sessionKey(); + final String scopeKey = getScopeKey(scopes); + + Optional> existingSession = getExistingSession(sessionKey, scopes); + final Session session; + if (!existingSession.isPresent()) { + session = tokenProvider.apply(scopes); + sessions.computeIfAbsent(sessionKey, k -> new HashMap<>()).put(scopeKey, session); + } else { + session = existingSession.get(); + } + return session; + } + + private Optional> getExistingSession(String sessionKey, List requiredScopes) { + Map> clientSessions = sessions.get(sessionKey); + if (clientSessions == null) { + return Optional.empty(); + } + + String scopeKey = getScopeKey(requiredScopes); + + // First look for an exact match + Session exactSession = clientSessions.get(scopeKey); + if (exactSession != null) { + if (hasTokenExpired(exactSession.expiresAt, OffsetDateTime.now())) { + removeSession(sessionKey, scopeKey); + } else { + return Optional.of(exactSession); + } + } + + // If no exact match was found, look for a superset match + List expiredSessionKeys = new ArrayList<>(); + Session validSession = null; + for (Map.Entry> entry : clientSessions.entrySet()) { + Session session = entry.getValue(); + if (hasTokenExpired(session.expiresAt, OffsetDateTime.now())) { + expiredSessionKeys.add(entry.getKey()); + } else if (hasRequiredScopes(session.scopes, requiredScopes)) { + validSession = session; + } + } + + for (String key : expiredSessionKeys) { + removeSession(sessionKey, key); + } + + return Optional.ofNullable(validSession); + } + + private static String getScopeKey(List scopes) { + if (scopes == null || scopes.isEmpty()) { + return ""; + } + + List sortedScopes = new ArrayList<>(scopes); + sortedScopes.sort(String::compareTo); + return String.join("&", sortedScopes); + } + + /** + * Checks if the token has expired. + * If no expires_in field was returned by the authorization server, the token is considered to never expire. + * A buffer (REFRESH_BEFORE_EXPIRY_SECONDS) is applied to refresh tokens before they actually expire. + */ + // VisibleForTesting + public static boolean hasTokenExpired(Optional expiresAt, OffsetDateTime now) { + return !expiresAt.isEmpty() && now.plusSeconds(REFRESH_BEFORE_EXPIRY_SECONDS).isAfter(expiresAt.get()); + } + + // VisibleForTesting + public static boolean hasRequiredScopes(List sessionScopes, List requiredScopes) { + return sessionScopes.containsAll(requiredScopes); + } + + public void remove(String sessionKey) { + sessions.remove(sessionKey); + } + + public void removeSession(String sessionKey, String scopeKey) { + Map> clientSessions = sessions.get(sessionKey); + if (clientSessions != null) { + clientSessions.remove(scopeKey); + // Clean up empty client sessions + if (clientSessions.isEmpty()) { + sessions.remove(sessionKey); + } + } + } + + public static Session requestOAuth2Token(HTTPClient client, T credentials, List scopes, + Map body, Map headers, URI tokenUri) { + try { + HttpRequest.Builder requestBuilder = HttpRequest // + .newBuilder(tokenUri) // + .header("Content-Type", "application/x-www-form-urlencoded") // + .POST(RequestBody.serializeFormData(body).body()); // + + for (Map.Entry header : headers.entrySet()) { + requestBuilder.header(header.getKey(), header.getValue()); + } + + HttpRequest request = requestBuilder.build(); + HttpResponse response = client.send(request); + if (response.statusCode() != HttpURLConnection.HTTP_OK) { + String responseBody = Utils.toUtf8AndClose(response.body()); + throw new AuthException( + "Unexpected status code " + response.statusCode() + ": " + responseBody, + response.statusCode(), + responseBody.getBytes(StandardCharsets.UTF_8), + response); + } + TokenResponse t = Utils.mapper().readValue(response.body(), TokenResponse.class); + if (!t.tokenType.orElse("").toLowerCase().equals("bearer")) { + throw new AuthException( + "Expected 'Bearer' token type but was '" + t.tokenType.orElse("") + "'", + response.statusCode(), + Utils.readBytesAndClose(response.body()), + response); + } + final Optional expiresAt = t.expiresInSeconds + .map(x -> OffsetDateTime.now().plus(x, ChronoUnit.SECONDS)); + return new Session(credentials, t.accessToken, scopes, expiresAt); + } catch (IOException | IllegalArgumentException | IllegalAccessException | InterruptedException | URISyntaxException e) { + throw new RuntimeException(e); + } + } + + final static class TokenResponse { + + @JsonProperty("access_token") + Optional accessToken; + + @JsonProperty("token_type") + Optional tokenType; + + @JsonProperty("expires_in") + Optional expiresInSeconds;; + + } + +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/SpeakeasyHTTPClient.java b/src/main/java/studio/livepeer/livepeer/utils/SpeakeasyHTTPClient.java index 3ff3030a..f73c2941 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/SpeakeasyHTTPClient.java +++ b/src/main/java/studio/livepeer/livepeer/utils/SpeakeasyHTTPClient.java @@ -1,22 +1,177 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; +import studio.livepeer.livepeer.utils.Blob; + import java.io.IOException; +import java.io.InputStream; import java.net.URISyntaxException; import java.net.http.HttpClient; +import java.net.http.HttpHeaders; import java.net.http.HttpRequest; +import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; -import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Collection; +import java.util.Locale; +import java.util.Optional; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.concurrent.CompletableFuture; public class SpeakeasyHTTPClient implements HTTPClient { + // global debug flag. Retained for backwards compatibility. + private static boolean debugEnabled = false; + + // Instance-level debug flag. Can be set by clients to enable debug logging for a + // single SDK instance. + private Boolean localDebugEnabled; + + // uppercase + private static Set redactedHeaders = Set.of("AUTHORIZATION", "X-API-KEY"); + + private static Consumer logger = System.out::println; + + private final HttpClient client = HttpClient.newHttpClient(); + + /** + * Experimental, may be changed anytime. Sets debug logging on or off for + * requests and responses including bodies for JSON content. WARNING: this + * setting may expose sensitive information in logs (like Authorization + * headers), and should only be enabled temporarily for local debugging + * purposes. By default, Authorization headers are redacted in the logs + * ( printed with a value of {@code [*******]}). Header suppression is controlled + * with the {@link #setRedactedHeaders(Collection)} method. + * + * @param enabled true to enable debug logging, false to disable it + */ + public static void setDebugLogging(boolean enabled) { + debugEnabled = enabled; + } + + public static boolean getDebugLoggingEnabled() { + return debugEnabled; + } + + @Override + public boolean isDebugLoggingEnabled() { + return Optional.ofNullable(localDebugEnabled).orElse(debugEnabled); + } + + @Override + public void enableDebugLogging(boolean enabled) { + localDebugEnabled = enabled; + } + + /** + * Experimental, may be changed anytime. When debug logging is enabled this + * method controls the suppression of header values in the logs. By default, + * Authorization headers are redacted in the logs (printed with a value + * of {@code [*******]}). Header suppression is controlled with the + * {@link #setRedactedHeaders(Collection)} method. + * + * @param headerNames the names (case-insensitive) of the headers whose values + * will be redacted in the logs + */ + public static void setRedactedHeaders(Collection headerNames) { + redactedHeaders = headerNames.stream() // + .map(x -> x.toUpperCase(Locale.ENGLISH)) // + .collect(Collectors.toSet()); + } + + public static void setLogger(Consumer logger) { + SpeakeasyHTTPClient.logger = logger; + } + @Override public HttpResponse send(HttpRequest request) throws IOException, InterruptedException, URISyntaxException { - HttpClient client = HttpClient.newHttpClient(); - return client.send(request, HttpResponse.BodyHandlers.ofInputStream()); + if (isDebugLoggingEnabled()) { + request = logRequest(request); + } + var response = client.send(request, HttpResponse.BodyHandlers.ofInputStream()); + if (isDebugLoggingEnabled()) { + response = logResponse(response); + } + return response; + } + + @Override + public CompletableFuture> sendAsync(HttpRequest request) { + if (isDebugLoggingEnabled()) { + request = logRequest(request); + } + return client.sendAsync(request, HttpResponse.BodyHandlers.ofPublisher()) + .thenApply(response -> + // TODO: log responses when helper for Blob is setup + new ResponseWithBody<>(response, Blob::from)); + } + + private HttpRequest logRequest(HttpRequest request) { + log("Sending request: " + request); + log("Request headers: " + redactHeaders(request.headers())); + // only log the body if it is present and the content type is JSON + if (request.bodyPublisher().isPresent() && request.headers() // + .firstValue("Content-Type") // + .filter(x -> x.equals("application/json") || x.equals("text/plain")).isPresent()) { + // we read the body and ensure that the BodyPublisher is rebuilt to pass to the + // http client + byte[] body = Helpers.bodyBytes(request); + request = Helpers // + .copy(request) // + .method(request.method(), BodyPublishers.ofByteArray(body)) // + .build(); + // note that in the case of text/plain a different encoding from UTF-8 + // may be in use but we just log the bytes as UTF-8. Unexpected encodings + // do not throw (substitution happens). + log("Request body:\n" + new String(body, StandardCharsets.UTF_8)); + } + return request; + } + + private static HttpResponse logResponse(HttpResponse response) throws IOException { + // make the response re-readable by loading the response body into a byte array + // and allowing the InputStream to be read many times + response = Utils.cache(response); + log("Received response: " + response); + log("Response headers: " + redactHeaders(response.headers())); + // only log the response body if it is present and the content type is JSON or plain text + if (response.headers() // + .firstValue("Content-Type") // + .filter(x -> x.equals("application/json") || x.equals("text/plain")) // + .isPresent()) { + // the response is re-readable so we can read and close it without + // affecting later processing of the response. + + // note that in the case of text/plain a different encoding from UTF-8 + // may be in use but we just log the bytes as UTF-8. Unexpected encodings + // do not throw (substitution happens). + log("Response body:\n" + Utils.toUtf8AndClose(response.body())); + } + return response; + } + + private static String redactHeaders(HttpHeaders headers) { + return "{" + headers.map() // + .entrySet() // + .stream() // + .map(entry -> { + final String value; + if (redactedHeaders.contains(entry.getKey().toUpperCase(Locale.ENGLISH))) { + value = "[******]"; + } else { + value = String.valueOf(entry.getValue()); + } + return entry.getKey() + "=" + value; + }) // + .collect(Collectors.joining(", ")) + "}"; + } + + private static void log(String message) { + logger.accept(message); } } diff --git a/src/main/java/studio/livepeer/livepeer/utils/SpeakeasyMetadata.java b/src/main/java/studio/livepeer/livepeer/utils/SpeakeasyMetadata.java index a0bd63a4..3539c1a6 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/SpeakeasyMetadata.java +++ b/src/main/java/studio/livepeer/livepeer/utils/SpeakeasyMetadata.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.lang.annotation.ElementType; diff --git a/src/main/java/studio/livepeer/livepeer/utils/StreamingParser.java b/src/main/java/studio/livepeer/livepeer/utils/StreamingParser.java new file mode 100644 index 00000000..4313a503 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/StreamingParser.java @@ -0,0 +1,322 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.Optional; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Generic streaming parser that handles byte buffer management and delegates + * format-specific logic to a StreamContentProcessor. + */ +public final class StreamingParser { + + /** + * Information about a found boundary in byte data + */ + static class BoundaryInfo { + public final int position; + public final int delimiterLength; + + public BoundaryInfo(int position, int delimiterLength) { + this.position = position; + this.delimiterLength = delimiterLength; + } + } + + /** + * Interface for format-specific parsing logic + */ + interface StreamContentProcessor { + /** + * Find the next boundary in the byte buffer + * @return boundary info, or position -1 if no boundary found + */ + BoundaryInfo findBoundary(byte[] data, int limit); + + /** + * Process extracted content and return the parsed result + * @param content the extracted content (without boundary delimiters) + * @return parsed result, or empty if content should be skipped + */ + Optional processContent(String content); + + /** + * Sanitize content text (e.g., handle line endings, BOM, etc.) + * @param rawContent the raw extracted content + * @param isFirst whether this is the first content processed + * @return sanitized content + */ + default String sanitizeContent(String rawContent, boolean isFirst) { + return rawContent.replace("\r\n", "\n").replace("\r", "\n"); + } + } + + private final StreamContentProcessor processor; + private ByteBuffer byteBuffer = ByteBuffer.allocate(8192); + private boolean first = true; + + StreamingParser(StreamContentProcessor processor) { + this.processor = processor; + } + + /** + * Add ByteBuffer data to the parser buffer and extract any complete items. + * + * @param inputBuffer byte data to add (will not be modified) + * @return next complete parsed result if one becomes available + */ + public Optional add(ByteBuffer inputBuffer) { + if (inputBuffer == null || !inputBuffer.hasRemaining()) { + return extractNextFromBytes(); + } + // Ensure we have enough capacity + if (byteBuffer.remaining() < inputBuffer.remaining()) { + byteBuffer = expandByteBuffer(byteBuffer.position() + inputBuffer.remaining()); + } + // Append new data + byteBuffer.put(inputBuffer.slice()); + return extractNextFromBytes(); + } + + /** + * Extract any remaining partial content when stream ends. + * + * @return final parsed result if there was incomplete data in the buffer + */ + public Optional finish() { + if (byteBuffer.position() > 0) { + byte[] remainingBytes = new byte[byteBuffer.position()]; + byteBuffer.flip(); + byteBuffer.get(remainingBytes); + byteBuffer.clear(); + String content = processor.sanitizeContent(new String(remainingBytes, StandardCharsets.UTF_8), first); + return processor.processContent(content); + } + return Optional.empty(); + } + + /** + * Check if there are additional complete items in the buffer. + * + * @return next complete parsed result from buffer if available + */ + public Optional next() { + return extractNextFromBytes(); + } + + /** + * Check if parser has any buffered data + */ + public boolean hasBufferedData() { + return byteBuffer.position() > 0; + } + + private Optional extractNextFromBytes() { + if (byteBuffer.position() == 0) { + return Optional.empty(); + } + // Find boundary directly in bytes + BoundaryInfo boundary = processor.findBoundary(byteBuffer.array(), byteBuffer.position()); + if (boundary.position == -1) { + return Optional.empty(); + } + // Extract content bytes without copying the entire buffer + byte[] contentBytes = new byte[boundary.position]; + byteBuffer.flip(); + byteBuffer.get(contentBytes, 0, boundary.position); + // Compact buffer to remove processed content + delimiter + byteBuffer.position(boundary.position + boundary.delimiterLength); + byteBuffer.compact(); + String content = processor.sanitizeContent(new String(contentBytes, StandardCharsets.UTF_8), first); + if (first) { + first = false; + } + Optional result = processor.processContent(content); + if (result.isPresent()) { + return result; + } + // Check for additional items if this one was skipped + return extractNextFromBytes(); + } + + private ByteBuffer expandByteBuffer(int newCapacity) { + ByteBuffer newBuffer = ByteBuffer.allocate(Math.max(newCapacity, byteBuffer.capacity() * 2)); + byteBuffer.flip(); + newBuffer.put(byteBuffer); + return newBuffer; + } + + /** + * Check if a byte pattern matches at a specific position + */ + public static boolean matchesPattern(byte[] data, int pos, int limit, byte... pattern) { + if (pos + pattern.length > limit) { + return false; + } + for (int i = 0; i < pattern.length; i++) { + if (data[pos + i] != pattern[i]) { + return false; + } + } + return true; + } + + // ===== JSON Lines Content Processor ===== + + /** + * JSON Lines content processor implementation + */ + private static class JsonLContentProcessor implements StreamContentProcessor { + // Line boundary patterns + private static final byte CR = '\r'; + private static final byte LF = '\n'; + private static final byte[] CRLF = {CR, LF}; // \r\n + private static final byte[] LF_ONLY = {LF}; // \n + + @Override + public BoundaryInfo findBoundary(byte[] data, int limit) { + for (int i = 0; i < limit; i++) { + // Check for CRLF first (longer pattern) + if (matchesPattern(data, i, limit, CRLF)) { + return new BoundaryInfo(i, CRLF.length); + } + // Check for LF only + if (matchesPattern(data, i, limit, LF_ONLY)) { + return new BoundaryInfo(i, LF_ONLY.length); + } + } + return new BoundaryInfo(-1, 0); + } + + @Override + public Optional processContent(String content) { + String trimmed = content.trim(); + // Return non-empty JSON lines + return trimmed.isEmpty() ? Optional.empty() : Optional.of(trimmed); + } + } + + // ===== SSE Content Processor ===== + + /** + * SSE content processor implementation + */ + private static class SSEContentProcessor implements StreamContentProcessor { + private static final String BYTE_ORDER_MARK = "\uFEFF"; + private static final Pattern LINE_PATTERN = Pattern.compile("^([a-zA-Z]+): ?(.*)$"); + private static final char LINEFEED = '\n'; + // Message boundary patterns + private static final byte CR = '\r'; + private static final byte LF = '\n'; + private static final byte[] CRLF_CRLF = {CR, LF, CR, LF}; // \r\n\r\n + private static final byte[] CRLF_LF = {CR, LF, LF}; // \r\n\n + private static final byte[] LF_CRLF = {LF, CR, LF}; // \n\r\n + private static final byte[] LF_LF = {LF, LF}; // \n\n + + @Override + public BoundaryInfo findBoundary(byte[] data, int limit) { + for (int i = 0; i < limit; i++) { + // Need at least 2 bytes for any boundary pattern + if (i + 1 >= limit) { + continue; + } + // Check longest patterns first to avoid partial matches + if (matchesPattern(data, i, limit, CRLF_CRLF)) { + return new BoundaryInfo(i, CRLF_CRLF.length); + } + if (matchesPattern(data, i, limit, CRLF_LF)) { + return new BoundaryInfo(i, CRLF_LF.length); + } + if (matchesPattern(data, i, limit, LF_CRLF)) { + return new BoundaryInfo(i, LF_CRLF.length); + } + if (matchesPattern(data, i, limit, LF_LF)) { + return new BoundaryInfo(i, LF_LF.length); + } + } + return new BoundaryInfo(-1, 0); + } + + @Override + public Optional processContent(String content) { + if (content.trim().isEmpty()) { + return Optional.empty(); + } + return Optional.of(parseMessage(content)); + } + + @Override + public String sanitizeContent(String rawContent, boolean isFirst) { + String sanitized = rawContent.replace("\r\n", "\n").replace("\r", "\n"); + if (isFirst && sanitized.startsWith(BYTE_ORDER_MARK)) { + sanitized = sanitized.substring(BYTE_ORDER_MARK.length()); + } + return sanitized; + } + + private EventStreamMessage parseMessage(String text) { + String[] lines = text.split("\n"); + Optional event = Optional.empty(); + Optional id = Optional.empty(); + Optional retryMs = Optional.empty(); + StringBuilder data = new StringBuilder(); + boolean firstData = true; + for (String line : lines) { + // Skip comment lines + if (line.startsWith(":")) { + continue; + } + Matcher m = LINE_PATTERN.matcher(line); + if (m.find()) { + String key = m.group(1).toLowerCase(); + String value = m.group(2); + switch (key) { + case "event": + event = Optional.of(value); + break; + case "id": + id = Optional.of(value); + break; + case "retry": + try { + retryMs = Optional.of(Integer.parseInt(value)); + } catch (NumberFormatException e) { + // ignore invalid retry values + } + break; + case "data": + if (!firstData) { + data.append(LINEFEED); + } + firstData = false; + data.append(value); + break; + // ignore unknown fields + } + } + } + return new EventStreamMessage(event, id, retryMs, data.toString()); + } + } + + // ===== Factory Methods ===== + + /** + * Create a streaming parser for JSON Lines format + */ + public static StreamingParser forJsonLines() { + return new StreamingParser<>(new JsonLContentProcessor()); + } + + /** + * Create a streaming parser for SSE format + */ + public static StreamingParser forSSE() { + return new StreamingParser<>(new SSEContentProcessor()); + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/TypedObject.java b/src/main/java/studio/livepeer/livepeer/utils/TypedObject.java index 9df9c0a4..7954f30e 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/TypedObject.java +++ b/src/main/java/studio/livepeer/livepeer/utils/TypedObject.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.io.IOException; @@ -37,7 +36,12 @@ public TypeReference typeReference() { public JsonShape shape() { return shape; } - + + @Override + public String toString() { + return String.valueOf(value); + } + public static TypedObject of(T value, JsonShape shape, TypeReference typeReference) { return new TypedObject(value, shape, typeReference); } diff --git a/src/main/java/studio/livepeer/livepeer/utils/Types.java b/src/main/java/studio/livepeer/livepeer/utils/Types.java index ab350f59..284bdd3b 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/Types.java +++ b/src/main/java/studio/livepeer/livepeer/utils/Types.java @@ -1,7 +1,6 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; import java.util.HashSet; diff --git a/src/main/java/studio/livepeer/livepeer/utils/Utf8UrlEncoder.java b/src/main/java/studio/livepeer/livepeer/utils/Utf8UrlEncoder.java new file mode 100644 index 00000000..10588790 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/Utf8UrlEncoder.java @@ -0,0 +1,116 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils; + +import java.io.CharArrayWriter; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.BitSet; +import java.util.Objects; + +// Internal use only +// TODO move to an internal package +public final class Utf8UrlEncoder { + + private static final BitSet DO_NOT_ENCODE_CHARS = createDoNotEncodeChars(); + private static final int CASE_DIFF = ('a' - 'A'); + + private final BitSet safeChars; + + public static final Utf8UrlEncoder ALLOW_RESERVED = new Utf8UrlEncoder(":/?#[]@!$&'()*+,;="); + public static final Utf8UrlEncoder DEFAULT = new Utf8UrlEncoder(""); + + public static Utf8UrlEncoder allowReserved(boolean allowReserved) { + return allowReserved ? ALLOW_RESERVED : DEFAULT; + } + + private Utf8UrlEncoder(String safeCharacters) { + Objects.requireNonNull(safeCharacters, "safeCharacters"); + int max = -1; + for (int i = 0; i < safeCharacters.length(); i++) { + char ch = safeCharacters.charAt(i); + max = Math.max(ch, max); + } + BitSet safeChars = new BitSet(max + 1); + for (int i = 0; i < safeCharacters.length(); i++) { + char ch = safeCharacters.charAt(i); + safeChars.set(ch); + } + this.safeChars = safeChars; + } + + public String encode(String s) { + return encode(s, StandardCharsets.UTF_8); + } + + private String encode(String s, Charset charset) { + boolean changed = false; + StringBuilder out = new StringBuilder(s.length()); + CharArrayWriter writer = new CharArrayWriter(); + + for (int i = 0; i < s.length();) { + int c = (int) s.charAt(i); + if (DO_NOT_ENCODE_CHARS.get(c) || safeChars.get(c)) { + out.append((char) c); + i++; + } else { + // convert to external encoding before hex conversion + do { + writer.write(c); + if (c >= 0xD800 && c <= 0xDBFF) { + if ((i + 1) < s.length()) { + int d = (int) s.charAt(i + 1); + if (d >= 0xDC00 && d <= 0xDFFF) { + writer.write(d); + i++; + } + } + } + i++; + } while (i < s.length() && !DO_NOT_ENCODE_CHARS.get((c = (int) s.charAt(i)))); + + writer.flush(); + String str = new String(writer.toCharArray()); + byte[] ba = str.getBytes(charset); + for (int j = 0; j < ba.length; j++) { + out.append('%'); + char ch = Character.forDigit((ba[j] >> 4) & 0xF, 16); + // converting to use uppercase letter as part of + // the hex value if ch is a letter. + if (Character.isLetter(ch)) { + ch -= CASE_DIFF; + } + out.append(ch); + ch = Character.forDigit(ba[j] & 0xF, 16); + if (Character.isLetter(ch)) { + ch -= CASE_DIFF; + } + out.append(ch); + } + writer.reset(); + changed = true; + } + } + + return (changed ? out.toString() : s); + } + + private static BitSet createDoNotEncodeChars() { + BitSet b = new BitSet(256); + for (int i = 'a'; i <= 'z'; i++) { + b.set(i); + } + for (int i = 'A'; i <= 'Z'; i++) { + b.set(i); + } + for (int i = '0'; i <= '9'; i++) { + b.set(i); + } + b.set('-'); + b.set('_'); + b.set('.'); + b.set('*'); + return b; + } +} diff --git a/src/main/java/studio/livepeer/livepeer/utils/Utils.java b/src/main/java/studio/livepeer/livepeer/utils/Utils.java index a0a07ad8..66d6e266 100644 --- a/src/main/java/studio/livepeer/livepeer/utils/Utils.java +++ b/src/main/java/studio/livepeer/livepeer/utils/Utils.java @@ -1,50 +1,62 @@ /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ - package studio.livepeer.livepeer.utils; -import java.io.InputStream; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.math.BigDecimal; import java.math.BigInteger; import java.net.URI; -import java.net.URLEncoder; +import java.net.URISyntaxException; import java.net.http.HttpClient.Version; import java.net.http.HttpHeaders; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import java.time.LocalDate; import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.concurrent.Callable; -import java.util.function.BiPredicate; import java.util.HashMap; import java.util.Iterator; +import java.lang.Iterable; +import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.NoSuchElementException; +import java.util.Objects; import java.util.Optional; +import java.util.Random; +import java.util.concurrent.Callable; +import java.util.function.BiPredicate; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.stream.StreamSupport; +import java.util.concurrent.CompletableFuture; import javax.net.ssl.SSLSession; import org.apache.commons.io.IOUtils; -import org.apache.http.NameValuePair; - import org.openapitools.jackson.nullable.JsonNullable; import com.fasterxml.jackson.core.JsonProcessingException; @@ -57,6 +69,10 @@ import com.fasterxml.jackson.databind.node.TextNode; import com.fasterxml.jackson.databind.type.TypeFactory; +import studio.livepeer.livepeer.models.errors.AsyncSDKException; +import studio.livepeer.livepeer.models.errors.SDKException; + + public final class Utils { private Utils() { @@ -71,7 +87,7 @@ public static boolean referenceEquals(Object a, Object b) { } public static String generateURL(String baseURL, String path) - throws IllegalArgumentException, IllegalAccessException { + throws IllegalArgumentException { if (baseURL != null && baseURL.endsWith("/")) { baseURL = baseURL.substring(0, baseURL.length() - 1); } @@ -80,7 +96,7 @@ public static String generateURL(String baseURL, String path) } public static String generateURL(Class type, String baseURL, String path, JsonNullable params, - Map>> globals) throws JsonProcessingException, IllegalArgumentException, IllegalAccessException { + Globals globals) throws JsonProcessingException, IllegalArgumentException, IllegalAccessException { if (params.isPresent() && params.get() != null) { return generateURL(type, baseURL, path, params.get(), globals); } else { @@ -89,7 +105,7 @@ public static String generateURL(Class type, String baseURL, String path, } public static String generateURL(Class type, String baseURL, String path, Optional params, - Map>> globals) throws JsonProcessingException, IllegalArgumentException, IllegalAccessException { + Globals globals) throws JsonProcessingException, IllegalArgumentException, IllegalAccessException { if (params.isPresent()) { return generateURL(type, baseURL, path, params.get(), globals); } else { @@ -98,7 +114,7 @@ public static String generateURL(Class type, String baseURL, String path, } public static String generateURL(Class type, String baseURL, String path, T params, - Map>> globals) + Globals globals) throws IllegalArgumentException, IllegalAccessException, JsonProcessingException { if (baseURL != null && baseURL.endsWith("/")) { baseURL = baseURL.substring(0, baseURL.length() - 1); @@ -137,7 +153,9 @@ public static String generateURL(Class type, String baseURL, String path, pathParams.put(pathParamsMetadata.name, String.join(",", - array.stream().map(v -> Utils.valToString(v)) + array.stream() + .map(v -> valToString(v)) + .map(v -> pathEncode(v, pathParamsMetadata.allowReserved)) .collect(Collectors.toList()))); break; case MAP: @@ -149,17 +167,24 @@ public static String generateURL(Class type, String baseURL, String path, pathParams.put(pathParamsMetadata.name, String.join(",", map.entrySet().stream().map(e -> { if (pathParamsMetadata.explode) { - return String.format("%s=%s", Utils.valToString(e.getKey()), - Utils.valToString(e.getValue())); + return String.format("%s=%s", pathEncode(valToString(e.getKey()), false), + pathEncode(valToString(e.getValue()), false)); } else { - return String.format("%s,%s", Utils.valToString(e.getKey()), - Utils.valToString(e.getValue())); + return String.format("%s,%s", pathEncode(valToString(e.getKey()), false), + pathEncode(valToString(e.getValue()), false)); } }).collect(Collectors.toList()))); break; case OBJECT: if (!allowIntrospection(value.getClass())) { - pathParams.put(pathParamsMetadata.name, Utils.valToString(value)); + pathParams.put(pathParamsMetadata.name, pathEncode(valToString(value), pathParamsMetadata.allowReserved)); + break; + } + Optional openEnumValue = Reflections.getOpenEnumValue(value.getClass(), value); + if (openEnumValue.isPresent()) { + pathParams.put(pathParamsMetadata.name, pathEncode( + valToString(openEnumValue.get()), + pathParamsMetadata.allowReserved)); break; } List values = new ArrayList<>(); @@ -180,25 +205,36 @@ public static String generateURL(Class type, String baseURL, String path, if (pathParamsMetadata.explode) { values.add(String.format("%s=%s", valuePathParamsMetadata.name, - Utils.valToString(val))); + pathEncode(valToString(val), valuePathParamsMetadata.allowReserved))); } else { values.add(String.format("%s,%s", valuePathParamsMetadata.name, - Utils.valToString(val))); + pathEncode(valToString(val), valuePathParamsMetadata.allowReserved))); } } pathParams.put(pathParamsMetadata.name, String.join(",", values)); break; default: - pathParams.put(pathParamsMetadata.name, Utils.valToString(value)); + pathParams.put(pathParamsMetadata.name, pathEncode(valToString(value), pathParamsMetadata.allowReserved)); break; } } } } - + // include all global params in pathParams if not already present + if (globals != null) { + globals.pathParamsAsStream() + .filter(entry -> !pathParams.containsKey(entry.getKey())) + .forEach(entry -> pathParams.put(entry.getKey(), // + pathEncode(entry.getValue(), false))); + } + return baseURL + templateUrl(path, pathParams); } + + private static String pathEncode(String s, boolean allowReserved) { + return Utf8UrlEncoder.allowReserved(allowReserved).encode(s); + } public static boolean contentTypeMatches(String contentType, String pattern) { if (contentType == null || contentType.isBlank()) { @@ -249,8 +285,8 @@ public static SerializedBody serializeRequestBody(Object request, String request return RequestBody.serialize(request, requestField, serializationMethod, nullable); } - public static List getQueryParams(Class type, Optional params, - Map>> globals) throws Exception { + public static List getQueryParams(Class type, Optional params, + Globals globals) throws Exception { if (params.isEmpty()) { return Collections.emptyList(); } else { @@ -258,8 +294,8 @@ public static List getQueryParams(Class typ } } - public static List getQueryParams(Class type, JsonNullable params, - Map>> globals) throws Exception { + public static List getQueryParams(Class type, JsonNullable params, + Globals globals) throws Exception { if (!params.isPresent() || params.get() == null) { return Collections.emptyList(); } else { @@ -267,14 +303,16 @@ public static List getQueryParams(Class typ } } - public static List getQueryParams(Class type, T params, - Map>> globals) throws Exception { + public static List getQueryParams(Class type, T params, + Globals globals) throws Exception { return QueryParameters.parseQueryParams(type, params, globals); } public static HTTPRequest configureSecurity(HTTPRequest request, Object security) throws Exception { return Security.configureSecurity(request, security); } + + private static final String DOLLAR_MARKER = "D9qPtyhOYzkHGu3c"; public static String templateUrl(String url, Map params) { StringBuilder sb = new StringBuilder(); @@ -287,20 +325,26 @@ public static String templateUrl(String url, Map params) { String key = match.substring(1, match.length() - 1); String value = params.get(key); if (value != null) { - m.appendReplacement(sb, value); + // note that we replace $ characters in values with a marker + // and then replace the markers at the end with the $ characters + // because the presence of dollar signs can stuff up the next + // regex find + m.appendReplacement(sb, value.replace("$", DOLLAR_MARKER)); } } m.appendTail(sb); - return sb.toString(); + return sb.toString().replace(DOLLAR_MARKER, "$"); } - public static Map> getHeadersFromMetadata(Object headers, Map>> globals) throws Exception { + public static Map> getHeadersFromMetadata(Object headers, Globals globals) throws Exception { + Map> result = new HashMap<>(); if (headers == null) { - return Collections.emptyMap(); - } + // include all global headers in result if not already present + mergeGlobalHeaders(result, globals); - Map> result = new HashMap<>(); + return result; + } Field[] fields = headers.getClass().getDeclaredFields(); @@ -323,9 +367,14 @@ public static Map> getHeadersFromMetadata(Object headers, M case OBJECT: { if (!allowIntrospection(value.getClass())) { break; - } - List items = new ArrayList<>(); + } + Optional openEnumValue = Reflections.getOpenEnumValue(value.getClass(), value); + if (openEnumValue.isPresent()) { + upsertHeader(result, headerMetadata.name, openEnumValue.get()); + break; + } + List items = new ArrayList<>(); Field[] valueFields = value.getClass().getDeclaredFields(); for (Field valueField : valueFields) { valueField.setAccessible(true); @@ -344,10 +393,10 @@ public static Map> getHeadersFromMetadata(Object headers, M if (headerMetadata.explode) { items.add( String.format("%s=%s", valueHeaderMetadata.name, - Utils.valToString(valueFieldValue))); + valToString(valueFieldValue))); } else { items.add(valueHeaderMetadata.name); - items.add(Utils.valToString(valueFieldValue)); + items.add(valToString(valueFieldValue)); } } @@ -370,11 +419,11 @@ public static Map> getHeadersFromMetadata(Object headers, M for (Map.Entry entry : map.entrySet()) { if (headerMetadata.explode) { - items.add(String.format("%s=%s", Utils.valToString(entry.getKey()), - Utils.valToString(entry.getValue()))); + items.add(String.format("%s=%s", valToString(entry.getKey()), + valToString(entry.getValue()))); } else { - items.add(Utils.valToString(entry.getKey())); - items.add(Utils.valToString(entry.getValue())); + items.add(valToString(entry.getKey())); + items.add(valToString(entry.getValue())); } } @@ -397,7 +446,7 @@ public static Map> getHeadersFromMetadata(Object headers, M List items = new ArrayList<>(); for (Object item : array) { - items.add(Utils.valToString(item)); + items.add(valToString(item)); } if (!result.containsKey(headerMetadata.name)) { @@ -410,32 +459,44 @@ public static Map> getHeadersFromMetadata(Object headers, M break; } default: { - if (!result.containsKey(headerMetadata.name)) { - result.put(headerMetadata.name, new ArrayList<>()); - } - - List values = result.get(headerMetadata.name); - values.add(Utils.valToString(value)); + upsertHeader(result, headerMetadata.name, value); break; } } } + // include all global headers in result if not already present + mergeGlobalHeaders(result, globals); + return result; } + private static void upsertHeader(Map> headers, String key, Object val) { + headers.computeIfAbsent(key, k -> new ArrayList<>()) + .add(valToString(val)); + } + + private static void mergeGlobalHeaders(Map> headers, Globals globals) { + if (globals == null) { + return; + } + globals.headerParamsAsStream() + .filter(entry -> !headers.containsKey(entry.getKey())) + .forEach(entry -> headers.put(entry.getKey(), + Collections.singletonList(entry.getValue()))); + } + public static String valToString(Object value) { - switch (Types.getType(value.getClass())) { - case ENUM: - try { - Field field = value.getClass().getDeclaredField("value"); - field.setAccessible(true); - return String.valueOf(field.get(value)); - } catch (Exception e) { - return "ERROR_UNKNOWN_VALUE"; - } - default: - return String.valueOf(resolveOptionals(value)); + if (value.getClass().isEnum()) { + try { + Field field = value.getClass().getDeclaredField("value"); + field.setAccessible(true); + return String.valueOf(field.get(value)); + } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) { + return "ERROR_UNKNOWN_VALUE"; + } + } else { + return String.valueOf(resolveOptionals(value)); } } @@ -447,33 +508,25 @@ public static String prefixBearer(String authHeaderValue) { } public static Object populateGlobal(Object value, String fieldName, String paramType, - Map>> globals) { - if (value == null && - globals != null && - globals.containsKey("parameters") && - globals.get("parameters").containsKey(paramType)) { - Object globalVal = globals.get("parameters").get(paramType).get(fieldName); - if (globalVal != null) { - value = globalVal; - } - } - + Globals globals) { + if (value == null && globals != null) { + return globals.getParam(paramType, fieldName).orElse(null); + } return value; } private static Map parseSerializedParams(PathParamsMetadata pathParamsMetadata, Object value) throws JsonProcessingException { Map params = new HashMap<>(); - switch (pathParamsMetadata.serialization) { case "json": ObjectMapper mapper = JSON.getMapper(); String json = mapper.writeValueAsString(value); - - params.put(pathParamsMetadata.name, URLEncoder.encode(json, StandardCharsets.UTF_8)); + params.put(pathParamsMetadata.name, pathEncode(json, pathParamsMetadata.allowReserved)); + break; + default: break; } - return params; } @@ -733,6 +786,10 @@ public JsonShape shape() { } static Object resolveStringShape(Class type, String fieldName, Object value) throws IllegalAccessException { + if (value == null) { + return value; + } + try { // the presence of this TypeReference field indicates that the parameter // has a JsonShape of String and that we should convert BigInteger to @@ -751,7 +808,12 @@ static Object resolveStringShape(Class type, String fieldName, Object val public static Stream stream(Callable> first, Function> next) { return StreamSupport.stream(iterable(first, next).spliterator(), false); } - + + public static Stream toStream(Iterable iterable) { + return StreamSupport.stream(iterable.spliterator(), false); + } + + // need a Function method that throws public interface Function { T apply(S value) throws Exception; @@ -796,24 +858,14 @@ private void load() { pending = false; } } catch (Exception e) { - rethrow(e); + Exceptions.rethrow(e); } } }; } }; } - - private static T rethrow(Throwable e) { - if (e instanceof RuntimeException) { - throw (RuntimeException) e; - } else if (e instanceof Error) { - throw (Error) e; - } else { - throw new RuntimeException(e); - } - } - + public static boolean statusCodeMatches(int statusCode, String... expectedStatusCodes) { return Arrays.stream(expectedStatusCodes) .anyMatch(expected -> statusCodeMatchesOne(statusCode, expected)); @@ -961,7 +1013,7 @@ public static final class HttpResponseCached implements HttpResponse response) throws IOException { this.response = response; - this.bytes = Utils.toByteArrayAndClose(response.body()); + this.bytes = toByteArrayAndClose(response.body()); } public String bodyAsUtf8() { @@ -1018,11 +1070,62 @@ public String toString() { } } - private static final char[] HEX_ARRAY = "0123456789abcdef".toCharArray(); + private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); - public static String bytesToLowerCaseHex(byte[] bytes) { - char[] hexChars = new char[bytes.length * 2]; - for (int j = 0; j < bytes.length; j++) { + public static byte[] readBytes(String filename) { + return readBytes(new File(filename)); + } + + public static String readString(String filename) { + return readString(new File(filename)); + } + + public static byte[] readBytes(File file) { + try { + return readBytesAndClose(new FileInputStream(file)); + } catch (FileNotFoundException e) { + throw new UncheckedIOException(e); + } + } + + public static String readString(File file) { + byte[] bytes = readBytes(file); + return new String(bytes, StandardCharsets.UTF_8); + } + + public static byte[] readBytesAndClose(InputStream in) { + try { + return readBytes(in); + } finally { + try { + in.close(); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + } + + public static byte[] readBytes(InputStream in) { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + byte[] buffer = new byte[8192]; + int n; + try { + while ((n = in.read(buffer))!= -1) { + bytes.write(buffer, 0, n); + } + } catch (IOException e) { + throw new UncheckedIOException(e); + } + return bytes.toByteArray(); + } + + public static String toHex(byte[] bytes) { + return toHex(bytes, bytes.length); + } + + private static String toHex(byte[] bytes, int length) { + char[] hexChars = new char[length * 2]; + for (int j = 0; j < length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = HEX_ARRAY[v >>> 4]; hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F]; @@ -1050,4 +1153,511 @@ public static String discriminatorToString(Object o) { return (String) o; } } + + public static void recordTest(String id) { + try { + new File("build").mkdir(); + Files.writeString(Paths.get("build/test-javav2-record.txt"), id + "\n", StandardOpenOption.CREATE, + StandardOpenOption.APPEND); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + /** + * Returns an equivalent url with query parameters sorted by name. Sort is + * stable in that parameters with the same name will not be reordered. + * + * @param url input + * @return url with query parameters sorted by name + */ + public static String sortQueryParameters(String url) { + if (url == null || url.isBlank()) { + return ""; + } + String[] parts = url.split("\\?"); + if (parts.length == 1) { + return url; + } + String query = parts[1]; + String[] params = query.split("&"); + sortByDelimitedKey(params, "="); + return parts[0] + "?" + Arrays.stream(params).collect(Collectors.joining("&")); + } + + public static Object sortSerializedMaps(Object input, String regex, String delim) { + if (input == null) { + return input; + } else if (input instanceof String) { + return sortMapString((String) input, regex, delim); + } else if (input.getClass().isArray()) { + Object[] a = (Object[]) input; + String[] b = new String[a.length]; + for (int i = 0; i < a.length; i++) { + if (!(a[i] instanceof String)) { + throw new IllegalArgumentException("expected array item type of String, found " + a[i]); + } + b[i] = sortMapString((String) a[i], regex, delim); + } + return b; + } else if (input instanceof Map) { + @SuppressWarnings("unchecked") + Map a = (Map) input; + Map b = new LinkedHashMap<>(); + for (Entry entry: a.entrySet()) { + if (!(entry.getKey() instanceof String)) { + throw new IllegalArgumentException("expected map key type of String, found " + entry.getKey()); + } + if (!(entry.getValue() instanceof String)) { + throw new IllegalArgumentException("expected map value type of String, found " + entry.getValue()); + } + b.put((String) entry.getKey(), sortMapString((String) entry.getValue(), regex, delim)); + } + return b; + } else { + throw new IllegalArgumentException("unexpected type: " + input.getClass()); + } + } + + private static String sortMapString(String input, String regex, String delim) { + return Pattern.compile(regex).matcher(input).replaceAll(m -> { + String escapedDelim = Pattern.quote(delim); + String result = m.group(); + for (int i = 1; i <= m.groupCount(); i++) { + final String match = m.group(i); + String[] pairs; + if (match.contains("=")) { + pairs = match.split(escapedDelim); + sortByDelimitedKey(pairs, "="); + } else { + String[] values = match.split(escapedDelim); + if (values.length == 1) { + pairs = values; + } else { + pairs = new String[values.length / 2]; + for (int j = 0; j < values.length; j += 2) { + pairs[j / 2] = values[j] + delim + values[j + 1]; + } + } + sortByDelimitedKey(pairs, delim); + } + String joined = Arrays.stream(pairs).collect(Collectors.joining(delim)); + result = result.replace(m.group(i), joined); + } + return result; + }); + } + + private static void sortByDelimitedKey(String[] array, String delim) { + Arrays.sort(array, (a, b) -> { + String escapedDelim = Pattern.quote(delim); + String aKey = a.split(escapedDelim)[0]; + String bKey = b.split(escapedDelim)[0]; + return aKey.compareTo(bKey); + }); + } + + public static boolean isPresentAndNotNull(Optional x) { + return x.isPresent(); + } + + public static boolean isPresentAndNotNull(JsonNullable x) { + return x.isPresent() && x.get() != null; + } + + public static void setSseSentinel(Object o, String value) { + if (o == null || value.isBlank()) { + return; + } else { + try { + Field field = o.getClass().getDeclaredField("_eventSentinel"); + field.setAccessible(true); + field.set(o, Optional.of(value)); + } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + // ignore + } + } + } + + public static String sessionKey(String... items) { + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + String input = Arrays.stream(items).collect(Collectors.joining(":")); + byte[] bytes = md.digest(input.getBytes(StandardCharsets.UTF_8)); + return Utils.toHex(bytes).toLowerCase(Locale.ENGLISH); + } catch (NoSuchAlgorithmException e) { + // not expected, MD5 always available + throw new RuntimeException(e); + } + } + + // internal API + public static HTTPClient createTestHTTPClient(String testName) { + return createTestHTTPClient(new SpeakeasyHTTPClient(), testName); + } + + // internal API + public static HTTPClient createTestHTTPClient(SpeakeasyHTTPClient client, String testName) { + return new TestHTTPClient(client, testName, randomLetters(16)); + } + + private static final class TestHTTPClient implements HTTPClient { + + private final HTTPClient client; + private final String testName; + private final String testInstanceId; + + TestHTTPClient(HTTPClient client, String testName, String testInstanceId) { + checkNotNull(client, "client"); + checkNotNull(testName, "name"); + checkNotNull(testInstanceId, "instanceId"); + this.client = client; + this.testName = testName; + this.testInstanceId = testInstanceId; + } + + @Override + public HttpResponse send(HttpRequest request) + throws IOException, InterruptedException, URISyntaxException { + HttpRequest r = Utils.copy(request) // + .header("x-speakeasy-test-name", testName) // + .header("x-speakeasy-test-instance-id", testInstanceId) // + .build(); + return client.send(r); + } + } + + private static final Random RANDOM = new Random(); + + private static String randomLetters(int length) { + return RANDOM.ints(length).mapToObj(x -> (char) (Math.abs(x) % 26 + 'a') + "").collect(Collectors.joining()); + } + + /** + * Internal use. Returns the system property with {@code key = "env." + name} + * and if doesn't exist returns the value of the environment variable with the + * given name of if it doesn't exist returns {@code defaultValue}. + * + * @param name variable name + * @param defaultValue default value if system property and environment variable + * don't exist + * @return system property with name prepended with ".env" or environment + * variable of given name or default value + */ + public static String environmentVariable(String name, String defaultValue) { + String value = System.getProperty("env." + name); + if (value != null) { + return value; + } + value = System.getenv(name); + if (value != null) { + return value; + } else { + return defaultValue; + } + } + + // internal use + public static Optional toOptional(JsonNullable a) { + if (a.isPresent() && a.get() != null) { + return Optional.of(a.get()); + } else { + return Optional.empty(); + } + } + + // internal use + public static String sortJSONObjectKeys(String json, String... fields) { + var fieldList = List.of(fields); + var m = new ObjectMapper(); + try { + JsonNode tree = m.readTree(json); + if (!tree.isObject()) { + return json; + } else if (fieldList.isEmpty()) { + return m.writeValueAsString(sortKeys(m, tree)); + } else { + var node = (ObjectNode) tree; + var list = toList(node.fields()); + list.stream() // + .filter(entry -> fieldList.contains(entry.getKey())) // + .forEach(entry -> node.set(entry.getKey(), sortKeys(m, entry.getValue()))); + return m.writeValueAsString(node); + } + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + + private static JsonNode sortKeys(ObjectMapper m, JsonNode node) { + if (!node.isObject()) { + return node; + } else { + var list = toList(node.fields()); + list.sort((a, b) -> a.getKey().compareTo(b.getKey())); + var map = new LinkedHashMap(); + list.forEach(x -> map.put(x.getKey(), x.getValue())); + return new ObjectNode(m.getNodeFactory(), map); + } + } + + private static List toList(Iterator it) { + var list = new ArrayList(); + while (it.hasNext()) { + list.add(it.next()); + } + return list; + } + + public static T valueOrElse(T value, T valueIfNotPresent) { + return value != null ? value : valueIfNotPresent; + } + + public static T valueOrElse(Optional value, T valueIfNotPresent) { + if (value == null) { + // this defensive check is used in custom exception class constructors + // to simplify calling code + return valueIfNotPresent; + } + return value.orElse(valueIfNotPresent); + } + + public static T valueOrElse(JsonNullable value, T valueIfNotPresent) { + if (value.isPresent()) { + return value.get(); + } else { + return valueIfNotPresent; + } + } + + public static T valueOrNull(T value) { + return valueOrElse(value, null); + } + + public static T valueOrNull(Optional value) { + return valueOrElse(value, null); + } + + public static T valueOrNull(JsonNullable value) { + return valueOrElse(value, null); + } + + public static N castLong(long value, Class targetType) { + // Handle supported types safely + if (targetType == Integer.class) { + return targetType.cast((int) value); + } else if (targetType == Long.class) { + return targetType.cast(value); + } else if (targetType == Short.class) { + return targetType.cast((short) value); + } else if (targetType == BigInteger.class) { + return targetType.cast(BigInteger.valueOf(value)); + } else { + throw new IllegalArgumentException("Unsupported number type: " + targetType); + } + } + + public static Iterator transform(Iterator iterator, Function mapper) { + return new Iterator<>() { + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public O next() { + return Exceptions.unchecked(() -> mapper.apply(iterator.next())).get(); + } + }; + } + + /** + * Returns true if and only if the two objects are deeply equal, uses + * mathematical equivalence for Number subclasses ({@code 2 == 2.0}) instead of + * {@code Number.equals}. + * + *

+ * Should be paired with {@link #enhancedHashCode(Object)} to ensure the + * equals/hashCode contract. + * + * @param a the first object to compare + * @param b the second object to compare + * @return true if the objects are deeply equal bearing in mind mathematical + * equivalence, false otherwise + */ + public static boolean enhancedDeepEquals(Object a, Object b) { + if (a == null && b == null) { + return true; + } else if (a == null || b == null) { + return false; + } else if (a instanceof Optional && b instanceof Optional) { + return enhancedDeepEquals(((Optional) a).orElse(null), ((Optional) b).orElse(null)); + } else if (a instanceof JsonNullable && b instanceof JsonNullable) { + JsonNullable x = (JsonNullable) a; + JsonNullable y = (JsonNullable) b; + if (x.isPresent() && y.isPresent()) { + return enhancedDeepEquals(x.get(), y.get()); + } else { + return Objects.deepEquals(x, y); + } + } else if (a instanceof List && b instanceof List) { + List listA = (List) a; + List listB = (List) b; + if (listA.size() != listB.size()) { + return false; + } + for (int i = 0; i < listA.size(); i++) { + if (!enhancedDeepEquals(listA.get(i), listB.get(i))) { + return false; + } + } + return true; + } else if (a instanceof Map && b instanceof Map) { + // don't expect number keys, just Strings and enums + Map x = (Map) a; + Map y = (Map) b; + if (x.size() != y.size()) { + return false; + } + for (Entry entry : x.entrySet()) { + Object key = entry.getKey(); + Object value1 = entry.getValue(); + Object value2 = y.get(key); + if (!enhancedDeepEquals(value1, value2)) { + return false; + } + } + return true; + } else if (a instanceof Number && b instanceof Number) { + // compare values mathematically + BigDecimal x = toBigDecimal((Number) a); + BigDecimal y = toBigDecimal((Number) b); + return x.compareTo(y) == 0; + } else { + // we use deepEquals so that byte[] fields are compared appropriately + return Objects.deepEquals(a, b); + } + } + + /** + * Returns a combined hash code (applying {@link #enhancedHashCode}) for the + * given objects (usually the fields of an object whose hashCode we want to + * be calculated). + * + * @param objects + * @return combined hash code for the objects, 0 if the objects are null + */ + public static int enhancedHash(Object... objects) { + if (objects == null) { + return 0; + } + int result = 1; + for (Object o : objects) { + result = 31 * result + (o == null ? 0 :enhancedHashCode(o)); + } + return result; + } + + /** + * Returns a hash code that complies with the equals/hashCode contract when + * equals is implemented by {@link #enhancedDeepEquals(Object, Object)}. + * + * @param o object to calculate the hash code for (can be null) + * @return hash code for the object, 0 if the object is null + */ + public static int enhancedHashCode(Object o) { + if (o == null) { + return 0; + } else if (o instanceof Optional) { + Optional opt = (Optional) o; + return opt.map(Utils::enhancedHashCode).orElse(Optional.empty().hashCode()); + } else if (o instanceof JsonNullable) { + JsonNullable n = (JsonNullable) o; + return n.isPresent() ? Utils.enhancedHashCode(n.get()) : JsonNullable.undefined().hashCode(); + } else if (o instanceof List) { + return ((List) o).stream().mapToInt(Utils::enhancedHashCode).sum(); + } else if (o instanceof Map) { + // don't expect number keys, just Strings and enums + Map m = (Map) o; + return m.entrySet() // + .stream() // + .mapToInt(entry -> Objects.hashCode(entry.getKey()) + Utils.enhancedHashCode(entry.getValue())) // + .sum(); + } else if (o instanceof Number) { + return toBigDecimal((Number) o).stripTrailingZeros().hashCode(); + } else { + return o.hashCode(); + } + } + + private static BigDecimal toBigDecimal(Number number) { + if (number instanceof BigDecimal) { + return (BigDecimal) number; + } else if (number instanceof BigInteger) { + return new BigDecimal((BigInteger) number); + } else if (number instanceof Byte || number instanceof Short || + number instanceof Integer || number instanceof Long) { + return BigDecimal.valueOf(number.longValue()); + } else if (number instanceof Float || number instanceof Double) { + // Prevent precision issues for float/double + return BigDecimal.valueOf(number.doubleValue()); + } else { + // Fallback: treat as double + return BigDecimal.valueOf(number.doubleValue()); + } + } + + /** + * Creates a failed CompletableFuture with an async API exception. + * Uses the Blob to read the response body asynchronously. + */ + public static CompletableFuture createAsyncApiError( + HttpResponse response, + String reason) { + return response.body().toByteArray() + .thenApply(bodyBytes -> { + throw new AsyncSDKException( + reason, + response.statusCode(), + bodyBytes, + response, + null); + }); + } + + public static T unmarshal(HttpResponse response, TypeReference typeReference) { + try { + return mapper().readValue( + Utils.extractByteArrayFromBody(response), + typeReference); + } catch (Exception e) { + throw SDKException.from( + "Error deserializing response body: " + e.getMessage(), response, e); + } + } + public static CompletableFuture unmarshalAsync(HttpResponse response, TypeReference typeReference) { + return response.body() + .toByteArray() + .handle((bytes, err) -> { + // if a body read error occurs, we want to transform the exception + if (err != null) { + throw new AsyncSDKException( + "Error reading response body: " + err.getMessage(), + response.statusCode(), + null, + response, + err); + } + try { + return mapper().readValue(bytes, typeReference); + } catch (Exception e) { + throw new AsyncSDKException( + "Error deserializing response body: " + e.getMessage(), + response.statusCode(), + bytes, + response, + e); + } + }); + } } diff --git a/src/main/java/studio/livepeer/livepeer/utils/reactive/EventStream.java b/src/main/java/studio/livepeer/livepeer/utils/reactive/EventStream.java new file mode 100644 index 00000000..4361b332 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/reactive/EventStream.java @@ -0,0 +1,364 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils.reactive; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import studio.livepeer.livepeer.utils.AsyncResponse; +import studio.livepeer.livepeer.utils.Blob; +import studio.livepeer.livepeer.utils.EventStreamMessage; +import studio.livepeer.livepeer.utils.StreamingParser; +import studio.livepeer.livepeer.utils.Utils; + +import java.net.http.HttpResponse; +import java.nio.ByteBuffer; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Flow; +import java.util.concurrent.atomic.AtomicLong; +import org.reactivestreams.Publisher; +import org.reactivestreams.Subscriber; +import org.reactivestreams.Subscription; + +/** + * A reactive event stream publisher that can handle different protocols (SSE, JSONL) + * and emits typed events with proper backpressure handling. + * + * @param the AsyncResponse type that contains the event stream + * @param the type that events are deserialized into + */ +public class EventStream implements Publisher { + + /** + * Protocol interface that defines how to parse and process different event stream formats + */ + public interface Protocol { + /** + * Create a new parser instance for this protocol + */ + StreamingParser createParser(); + + /** + * Process a parsed item and convert it to the target type + * @param parsed the parsed item from the parser + * @param objectMapper the ObjectMapper for deserialization + * @param typeReference the target type reference + * @return the converted item, or null if this item should be skipped + * @throws Exception if conversion fails + */ + ItemT processItem(ParsedT parsed, ObjectMapper objectMapper, TypeReference typeReference) throws Exception; + + /** + * Check if processing should stop (e.g., terminal message encountered) + * @param parsed the parsed item + * @return true if processing should stop + */ + boolean shouldStop(ParsedT parsed); + } + + private final CompletableFuture asyncResponseFuture; + private final TypeReference typeReference; + private final ObjectMapper objectMapper; + private final Protocol protocol; + + private EventStream(CompletableFuture asyncResponseFuture, + TypeReference typeReference, + ObjectMapper objectMapper, + Protocol protocol) { + this.asyncResponseFuture = asyncResponseFuture; + this.typeReference = typeReference; + this.objectMapper = objectMapper; + this.protocol = protocol; + } + + /** + * Create an EventStream for SSE (Server-Sent Events) format + */ + public static EventStream forSSE( + CompletableFuture asyncResponseFuture, + TypeReference typeReference, + ObjectMapper objectMapper, + String terminalMessage) { + return new EventStream<>(asyncResponseFuture, typeReference, objectMapper, + new SSEProtocol<>(terminalMessage)); + } + + /** + * Create an EventStream for JSONL (JSON Lines) format + */ + public static EventStream forJsonL( + CompletableFuture asyncResponseFuture, + TypeReference typeReference, + ObjectMapper objectMapper) { + return new EventStream<>(asyncResponseFuture, typeReference, objectMapper, + new JsonLProtocol<>()); + } + + /** + * Returns the value of the Content-Type header. + **/ + public CompletableFuture contentType() { + return asyncResponseFuture.thenApply(AsyncResponse::contentType); + } + + /** + * Returns the HTTP status code. + **/ + public CompletableFuture statusCode() { + return asyncResponseFuture.thenApply(AsyncResponse::statusCode); + } + + /** + * Returns the raw HTTP response. + **/ + public CompletableFuture> rawResponse() { + return asyncResponseFuture.thenApply(AsyncResponse::rawResponse); + } + + /** + * Returns the AsyncResponse body. + **/ + public CompletableFuture body() { + return asyncResponseFuture; + } + + @Override + public void subscribe(Subscriber subscriber) { + if (subscriber == null) { + throw new NullPointerException("Subscriber cannot be null"); + } + + EventStreamSubscription subscription = new EventStreamSubscription(subscriber); + subscriber.onSubscribe(subscription); + // Start the async operation only after onSubscribe has been called + subscription.start(rawResponse()); + } + + private class EventStreamSubscription implements Subscription { + private final Subscriber subscriber; + private final AtomicLong demand = new AtomicLong(0); + private final StreamingParser parser; + + private Flow.Subscription upstreamSubscription; + private volatile boolean cancelled = false; + private volatile boolean completed = false; + + @SuppressWarnings("unchecked") + public EventStreamSubscription(Subscriber subscriber) { + this.subscriber = subscriber; + this.parser = ((Protocol) protocol).createParser(); + } + + public void start(CompletableFuture> httpResponseFuture) { + // Wait for the CompletableFuture and then subscribe to the Blob + httpResponseFuture.whenComplete((httpResponse, throwable) -> { + if (cancelled) { + return; + } + if (throwable != null) { + // Signal error immediately per Reactive Streams specification + signalError(throwable); + return; + } + + // Extract Blob from HttpResponse and subscribe to it + Blob blob = httpResponse.body(); + // Blob.asPublisher() now returns Flow.Publisher directly + Flow.Publisher flowPublisher; + try { + flowPublisher = blob.asPublisher(); + } catch (Exception e) { + // Handle case where blob is already consumed or other errors + signalError(e); + return; + } + flowPublisher.subscribe(new Flow.Subscriber<>() { + @Override + public void onSubscribe(Flow.Subscription subscription) { + if (cancelled) { + subscription.cancel(); + return; + } + upstreamSubscription = subscription; + requestMoreIfNeeded(); + } + + @Override + public void onNext(ByteBuffer byteBuffer) { + if (cancelled || completed) { + return; + } + try { + processBuffer(byteBuffer); + if (!completed) { + requestMoreIfNeeded(); + } + } catch (Exception e) { + signalError(e); + } + } + + @Override + public void onError(Throwable throwable) { + signalError(throwable); + } + + @Override + public void onComplete() { + try { + processEndOfStream(); + signalComplete(); + } catch (Exception e) { + signalError(e); + } + } + }); + }); + } + + @Override + public void request(long n) { + if (n <= 0) { + signalError(new IllegalArgumentException("Request amount must be positive")); + return; + } + if (cancelled || completed) { + return; + } + demand.addAndGet(n); + requestMoreIfNeeded(); + } + + @Override + public void cancel() { + if (!cancelled) { + cancelled = true; + if (upstreamSubscription != null) { + upstreamSubscription.cancel(); + } + } + } + + private void processBuffer(ByteBuffer byteBuffer) { + // Use ByteBuffer directly without copying + Optional parsedOpt = parser.add(byteBuffer); + while (parsedOpt.isPresent()) { + if (!processItem(parsedOpt.get())) { + return; // Stop processing (terminal condition or error) + } + // Check for additional items in the buffer + parsedOpt = parser.next(); + } + } + + @SuppressWarnings("unchecked") + private boolean processItem(Object parsed) { + Protocol typedProtocol = (Protocol) protocol; + + // Check if processing should stop + if (typedProtocol.shouldStop(parsed)) { + signalComplete(); + return false; + } + + // Emit if there's demand + if (demand.get() > 0) { + try { + ItemT item = typedProtocol.processItem(parsed, objectMapper, typeReference); + if (item != null) { + demand.decrementAndGet(); + subscriber.onNext(item); + } + } catch (Exception e) { + signalError(e); + return false; // Signal to stop processing on error + } + } + return true; // Continue processing + } + + private void requestMoreIfNeeded() { + if (cancelled || completed) { + return; + } + + if (upstreamSubscription != null && demand.get() > 0) { + upstreamSubscription.request(1); + } + } + + private void processEndOfStream() { + Optional parsedOpt = parser.finish(); + parsedOpt.ifPresent(this::processItem); + } + + private void signalError(Throwable t) { + if (!cancelled && !completed) { + completed = true; + subscriber.onError(t); + } + } + + private void signalComplete() { + if (!cancelled && !completed) { + completed = true; + subscriber.onComplete(); + } + } + } + + /** + * SSE Protocol implementation + */ + private static class SSEProtocol implements Protocol { + private final String terminalMessage; + + public SSEProtocol(String terminalMessage) { + this.terminalMessage = terminalMessage; + } + + @Override + public StreamingParser createParser() { + return StreamingParser.forSSE(); + } + + @Override + public ItemT processItem(EventStreamMessage message, ObjectMapper objectMapper, TypeReference typeReference) { + // Skip empty data messages + if (message.data().isEmpty()) { + return null; + } + return Utils.asType(message, objectMapper, typeReference); + } + + @Override + public boolean shouldStop(EventStreamMessage message) { + // Check if this is a terminal message + return terminalMessage != null && terminalMessage.equals(message.data()); + } + } + + /** + * JSONL Protocol implementation + */ + private static class JsonLProtocol implements Protocol { + + @Override + public StreamingParser createParser() { + return StreamingParser.forJsonLines(); + } + + @Override + public ItemT processItem(String jsonLine, ObjectMapper objectMapper, TypeReference typeReference) throws Exception { + return objectMapper.readValue(jsonLine, typeReference); + } + + @Override + public boolean shouldStop(String jsonLine) { + // JSONL doesn't have terminal messages + return false; + } + } + +} \ No newline at end of file diff --git a/src/main/java/studio/livepeer/livepeer/utils/reactive/ReactiveUtils.java b/src/main/java/studio/livepeer/livepeer/utils/reactive/ReactiveUtils.java new file mode 100644 index 00000000..15c6e228 --- /dev/null +++ b/src/main/java/studio/livepeer/livepeer/utils/reactive/ReactiveUtils.java @@ -0,0 +1,512 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package studio.livepeer.livepeer.utils.reactive; + +import java.util.Iterator; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Flow; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; + +// Internal API only + +/** + * Utility class for reactive stream operations. + */ +public final class ReactiveUtils { + + private ReactiveUtils() { + // Utility class + } + + /** + * Maps elements from a Flow.Publisher using an asynchronous transformation function. + * This is useful for transforming HttpResponse elements using operations + * that return CompletableFuture results. + * + * @param the input element type + * @param the output element type + * @param source the source publisher + * @param mapper the async transformation function (e.g., AsyncOperation::handleResponse) + * @return a new publisher that emits the mapped elements + */ + public static Flow.Publisher mapAsync( + Flow.Publisher source, + Function> mapper) { + + Objects.requireNonNull(source, "Source publisher cannot be null"); + Objects.requireNonNull(mapper, "Mapper function cannot be null"); + + return new AsyncMappingPublisher<>(source, mapper); + } + + /** + * Maps elements from a Flow.Publisher using a synchronous transformation function. + * + * @param the input element type + * @param the output element type + * @param source the source publisher + * @param mapper the transformation function + * @return a new publisher that emits the mapped elements + */ + public static Flow.Publisher map( + Flow.Publisher source, + Function mapper) { + + Objects.requireNonNull(source, "Source publisher cannot be null"); + Objects.requireNonNull(mapper, "Mapper function cannot be null"); + + return new SyncMappingPublisher<>(source, mapper); + } + + /** + * Flattens a stream of collections into a stream of individual items. + * + * @param the input collection type + * @param the output element type + * @param source the source publisher emitting collections + * @param flattener the function to extract items from each collection + * @return a new publisher that emits individual items from the collections + */ + public static Flow.Publisher flatten( + Flow.Publisher source, + Function> flattener) { + + Objects.requireNonNull(source, "Source publisher cannot be null"); + Objects.requireNonNull(flattener, "Flattener function cannot be null"); + + return new FlatteningPublisher<>(source, flattener); + } + + /** + * Flattens a stream of {@code List} into a stream of individual {@code T} items. + * + * @param the type of elements to emit downstream + * @param source the source publisher emitting lists + * @return a new publisher that emits individual items from the lists + */ + public static Flow.Publisher flatten(Flow.Publisher> source) { + return flatten(source, list -> list); + } + + /** + * Wraps a {@code Flow.Publisher} into a {@code Flow.Publisher>}. + * + * @param source the source publisher + * @param the type of elements to emit downstream + * @return a new publisher that emits lists of items from the source publisher + */ + public static Flow.Publisher> wrapped(Flow.Publisher source) { + return new SyncMappingPublisher<>(source, List::of); + } + + /** + * Concatenates multiple publishers into a single publisher. + * + * @param pubs the publishers to concatenate + * @param the type of elements to emit downstream + * @return a new publisher that concatenates the given publishers + */ + public static Flow.Publisher concat(List> pubs) { + return new ConcatPublisher<>(pubs); + } + + /** + * Internal implementation of async mapping publisher. + */ + private static class AsyncMappingPublisher implements Flow.Publisher { + private final Flow.Publisher source; + private final Function> mapper; + + public AsyncMappingPublisher(Flow.Publisher source, Function> mapper) { + this.source = source; + this.mapper = mapper; + } + + @Override + public void subscribe(Flow.Subscriber subscriber) { + source.subscribe(new AsyncMappingSubscriber<>(subscriber, mapper)); + } + } + + /** + * Internal implementation of sync mapping publisher. + */ + private static class SyncMappingPublisher implements Flow.Publisher { + private final Flow.Publisher source; + private final Function mapper; + + public SyncMappingPublisher(Flow.Publisher source, Function mapper) { + this.source = source; + this.mapper = mapper; + } + + @Override + public void subscribe(Flow.Subscriber subscriber) { + source.subscribe(new SyncMappingSubscriber<>(subscriber, mapper)); + } + } + + /** + * Internal implementation of flattening publisher. + */ + private static class FlatteningPublisher implements Flow.Publisher { + private final Flow.Publisher source; + private final Function> flattener; + + public FlatteningPublisher(Flow.Publisher source, Function> flattener) { + this.source = source; + this.flattener = flattener; + } + + @Override + public void subscribe(Flow.Subscriber subscriber) { + source.subscribe(new FlatteningSubscriber<>(subscriber, flattener)); + } + } + + /** + * Internal implementation of concatenating publisher. + */ + private static final class ConcatPublisher implements Flow.Publisher { + private final List> pubs; + + ConcatPublisher(List> pubs) { + this.pubs = List.copyOf(pubs); + } + + @SuppressWarnings("unchecked") + @Override + public void subscribe(Flow.Subscriber downstream) { + downstream.onSubscribe(new ConcatSubscription<>((Flow.Subscriber) downstream, pubs.iterator())); + } + + } + + /** + * Subscriber that handles async mapping transformations. + */ + private static class AsyncMappingSubscriber implements Flow.Subscriber { + private final Flow.Subscriber downstream; + private final Function> mapper; + private final AtomicBoolean cancelled = new AtomicBoolean(false); + private final AtomicLong pendingDemand = new AtomicLong(0); + private final AtomicLong pendingCompletes = new AtomicLong(0); + private Flow.Subscription upstream; + private volatile boolean upstreamCompleted = false; + + public AsyncMappingSubscriber(Flow.Subscriber downstream, Function> mapper) { + this.downstream = downstream; + this.mapper = mapper; + } + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.upstream = subscription; + downstream.onSubscribe(new Flow.Subscription() { + @Override + public void request(long n) { + if (n <= 0) { + downstream.onError(new IllegalArgumentException("Request count must be positive")); + return; + } + + long currentDemand = pendingDemand.addAndGet(n); + if (currentDemand < 0) { + pendingDemand.set(Long.MAX_VALUE); + } + + upstream.request(n); + } + + @Override + public void cancel() { + cancelled.set(true); + upstream.cancel(); + } + }); + } + + @Override + public void onNext(T item) { + if (cancelled.get()) return; + + try { + pendingCompletes.incrementAndGet(); + CompletableFuture future = mapper.apply(item); + future.whenComplete((result, error) -> { + if (cancelled.get()) { + return; + } + + if (error != null) { + cancelled.set(true); + downstream.onError(error); + } else if (pendingDemand.get() > 0) { + pendingDemand.decrementAndGet(); + downstream.onNext(result); + } + + // Check if we should complete after this async operation + if (pendingCompletes.decrementAndGet() == 0 && upstreamCompleted) { + downstream.onComplete(); + } + }); + } catch (Exception e) { + if (!cancelled.get()) { + cancelled.set(true); + downstream.onError(e); + } + } + } + + @Override + public void onError(Throwable throwable) { + if (!cancelled.get()) { + downstream.onError(throwable); + } + } + + @Override + public void onComplete() { + upstreamCompleted = true; + if (!cancelled.get() && pendingCompletes.get() == 0) { + downstream.onComplete(); + } + } + } + + /** + * Subscriber that handles sync mapping transformations. + */ + private static class SyncMappingSubscriber implements Flow.Subscriber { + private final Flow.Subscriber downstream; + private final Function mapper; + private Flow.Subscription upstream; + private volatile boolean cancelled = false; + + public SyncMappingSubscriber(Flow.Subscriber downstream, Function mapper) { + this.downstream = downstream; + this.mapper = mapper; + } + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.upstream = subscription; + downstream.onSubscribe(new Flow.Subscription() { + @Override + public void request(long n) { + if (!cancelled) { + upstream.request(n); + } + } + + @Override + public void cancel() { + cancelled = true; + upstream.cancel(); + } + }); + } + + @Override + public void onNext(T item) { + if (cancelled) return; + + try { + R result = mapper.apply(item); + downstream.onNext(result); + } catch (Exception e) { + cancelled = true; + upstream.cancel(); + downstream.onError(e); + } + } + + @Override + public void onError(Throwable throwable) { + if (!cancelled) { + downstream.onError(throwable); + } + } + + @Override + public void onComplete() { + if (!cancelled) { + downstream.onComplete(); + } + } + } + + /** + * Subscriber that handles flattening transformations. + */ + private static class FlatteningSubscriber implements Flow.Subscriber { + private final Flow.Subscriber downstream; + private final Function> flattener; + private Flow.Subscription upstreamSubscription; + private volatile boolean cancelled = false; + + public FlatteningSubscriber(Flow.Subscriber downstream, Function> flattener) { + this.downstream = Objects.requireNonNull(downstream, "Downstream subscriber cannot be null"); + this.flattener = flattener; + } + + @Override + public void onSubscribe(Flow.Subscription subscription) { + this.upstreamSubscription = Objects.requireNonNull(subscription, "Upstream subscription cannot be null"); + downstream.onSubscribe(new Flow.Subscription() { + @Override + public void request(long n) { + if (n <= 0) { + downstream.onError(new IllegalArgumentException("Demand must be positive: " + n)); + return; + } + + if (!cancelled && upstreamSubscription != null) { + upstreamSubscription.request(n); + } + } + + @Override + public void cancel() { + cancelled = true; + if (upstreamSubscription != null) { + upstreamSubscription.cancel(); + } + } + }); + } + + @Override + public void onNext(T item) { + if (cancelled) { + return; + } + + try { + Iterable items = flattener.apply(item); + for (R flattenedItem : items) { + if (cancelled) { + break; + } + downstream.onNext(flattenedItem); + } + } catch (Exception e) { + if (!cancelled) { + cancelled = true; + upstreamSubscription.cancel(); + downstream.onError(e); + } + } + } + + @Override + public void onError(Throwable throwable) { + if (!cancelled) { + downstream.onError(throwable); + } + } + + @Override + public void onComplete() { + if (!cancelled) { + downstream.onComplete(); + } + } + } + + /** + * Subscriber that handles concatenating publishers. + */ + private static final class ConcatSubscription implements Flow.Subscription { + private final Flow.Subscriber downstream; + private final Iterator> it; + + private Flow.Subscription upstream; + private long demand = 0L; + private boolean cancelled = false; + private boolean completed = false; + + public ConcatSubscription(Flow.Subscriber downstream, + Iterator> it) { + this.downstream = downstream; + this.it = it; + } + + + @Override + public synchronized void request(long n) { + if (cancelled || completed || n <= 0) return; + demand = addCap(demand, n); + if (upstream == null) { + subscribeNext(); + } else { + upstream.request(n); + } + } + + @Override + public synchronized void cancel() { + cancelled = true; + if (upstream != null) upstream.cancel(); + } + + private void subscribeNext() { + if (cancelled) return; + if (!it.hasNext()) { + completed = true; + downstream.onComplete(); + return; + } + Flow.Publisher next = it.next(); + next.subscribe(new Upstream()); + } + + private final class Upstream implements Flow.Subscriber { + @Override + public void onSubscribe(Flow.Subscription s) { + synchronized (ConcatSubscription.this) { + upstream = s; + if (demand > 0) s.request(demand); + } + } + + @Override + public void onNext(T item) { + long afterDecrement; + synchronized (ConcatSubscription.this) { + if (demand == 0) return; // should not happen if upstream respects RS + demand--; + afterDecrement = demand; + } + downstream.onNext(item); + // no need to request here; downstream will call request() again if needed + } + + @Override + public void onError(Throwable t) { + downstream.onError(t); + } + + @Override + public void onComplete() { + synchronized (ConcatSubscription.this) { + upstream = null; + if (cancelled) return; + } + // carry over remaining demand to next publisher + subscribeNext(); + } + } + + private static long addCap(long a, long b) { + long r = a + b; + return (r < 0L) ? Long.MAX_VALUE : r; + } + } +}