/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// // THIS CODE IS AUTOGENERATED, DO NOT MODIFY ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// #pragma once #include #include #include #include #include #include #include #include #include #include #include #if defined (PLATFORM_SUPPORTS_AWS_NATIVE_SDK) // The AWS Native SDK AWSAllocator triggers a warning due to accessing members of std::allocator directly. // AWSAllocator.h(70): warning C4996: 'std::allocator::pointer': warning STL4010: Various members of std::allocator are deprecated in C++17. // Use std::allocator_traits instead of accessing these members directly. // You can define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. AZ_PUSH_DISABLE_WARNING(4251 4996, "-Wunknown-warning-option") #include #include AZ_POP_DISABLE_WARNING #endif // (PLATFORM_SUPPORTS_AWS_NATIVE_SDK) #include #include "CloudGemTextToSpeech_precompiled.h" namespace CloudGemTextToSpeech { namespace ServiceAPI { extern const char* LmbrAWS_CodeGen_SpeechMarksRequest_UUID; extern const char* LmbrAWS_CodeGen_Component_UUID; extern const char* LmbrAWS_CodeGen_ResponseHandler_UUID; extern const char* LmbrAWS_CodeGen_NotificationBus1_UUID; extern const char* LmbrAWS_CodeGen_RequestBus1_UUID; extern const char* LmbrAWS_CodeGen_VoiceRequest_UUID; extern const char* LmbrAWS_CodeGen_VoiceUrl_UUID; // redefs bool WriteJson(CloudGemFramework::JsonWriter& writer, const int& item); bool WriteJson(CloudGemFramework::JsonWriter& writer, const AZStd::string& item); bool WriteJson(CloudGemFramework::JsonWriter& writer, const double& item); struct VoiceRequest { AZ_TYPE_INFO(VoiceRequest, LmbrAWS_CodeGen_VoiceRequest_UUID) AZ_CLASS_ALLOCATOR(VoiceRequest, AZ::SystemAllocator, 0) AZStd::string message; AZStd::string voice; bool OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader); static void Reflect(AZ::ReflectContext* reflection); }; bool WriteJson(CloudGemFramework::JsonWriter& writer, const VoiceRequest& item); struct VoiceUrl { AZ_TYPE_INFO(VoiceUrl, LmbrAWS_CodeGen_VoiceUrl_UUID) AZ_CLASS_ALLOCATOR(VoiceUrl, AZ::SystemAllocator, 0) AZStd::string url; bool OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader); static void Reflect(AZ::ReflectContext* reflection); }; bool WriteJson(CloudGemFramework::JsonWriter& writer, const VoiceUrl& item); struct SpeechMarksRequest { AZ_TYPE_INFO(SpeechMarksRequest, LmbrAWS_CodeGen_SpeechMarksRequest_UUID) AZ_CLASS_ALLOCATOR(SpeechMarksRequest, AZ::SystemAllocator, 0) AZStd::string message; AZStd::string voice; AZStd::string speechMarks; bool OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader); static void Reflect(AZ::ReflectContext* reflection); }; bool WriteJson(CloudGemFramework::JsonWriter& writer, const SpeechMarksRequest& item); // Service RequestJobs CLOUD_GEM_SERVICE(CloudGemTextToSpeech); class PostTtsVoicelineRequest : public CloudGemFramework::ServiceRequest { public: SERVICE_REQUEST(CloudGemTextToSpeech, HttpMethod::HTTP_POST, "/tts/voiceline"); struct Parameters { VoiceRequest request_info; bool BuildRequest(CloudGemFramework::RequestBuilder& request); bool WriteJson(CloudGemFramework::JsonWriter& writer) const; }; VoiceUrl result; Parameters parameters; }; using PostTtsVoicelineRequestJob = CloudGemFramework::ServiceRequestJob; class PostTtsSpeechmarksRequest : public CloudGemFramework::ServiceRequest { public: SERVICE_REQUEST(CloudGemTextToSpeech, HttpMethod::HTTP_POST, "/tts/speechmarks"); struct Parameters { SpeechMarksRequest request_info; bool BuildRequest(CloudGemFramework::RequestBuilder& request); bool WriteJson(CloudGemFramework::JsonWriter& writer) const; }; VoiceUrl result; Parameters parameters; }; using PostTtsSpeechmarksRequestJob = CloudGemFramework::ServiceRequestJob; // Notification bus for this component class CloudGemTextToSpeechNotifications : public AZ::ComponentBus { public: /** * Sent when the request is a success * * Params: * jsonOutput: The output receieved from the lambda call * request: The AWS Lambda request object */ virtual void OnPostTtsVoicelineRequestSuccess(const VoiceUrl response); /** * Sent when the request fails * * Params: * error: The output receieved from the lambda call, * could be function error or an issue with the request * request: The AWS Lambda request object */ virtual void OnPostTtsVoicelineRequestError(const CloudGemFramework::Error error); /** * Sent when the request is a success * * Params: * jsonOutput: The output receieved from the lambda call * request: The AWS Lambda request object */ virtual void OnPostTtsSpeechmarksRequestSuccess(const VoiceUrl response); /** * Sent when the request fails * * Params: * error: The output receieved from the lambda call, * could be function error or an issue with the request * request: The AWS Lambda request object */ virtual void OnPostTtsSpeechmarksRequestError(const CloudGemFramework::Error error); }; using CloudGemTextToSpeechNotificationBus = AZ::EBus; class BehaviorCloudGemTextToSpeechNotificationBusHandler : public CloudGemTextToSpeechNotificationBus::Handler, public AZ::BehaviorEBusHandler { public: AZ_EBUS_BEHAVIOR_BINDER(BehaviorCloudGemTextToSpeechNotificationBusHandler, LmbrAWS_CodeGen_NotificationBus1_UUID, AZ::SystemAllocator , OnPostTtsVoicelineRequestSuccess , OnPostTtsVoicelineRequestError , OnPostTtsSpeechmarksRequestSuccess , OnPostTtsSpeechmarksRequestError ); void OnPostTtsVoicelineRequestSuccess(const VoiceUrl response) override; void OnPostTtsVoicelineRequestError(const CloudGemFramework::Error error) override; void OnPostTtsSpeechmarksRequestSuccess(const VoiceUrl response) override; void OnPostTtsSpeechmarksRequestError(const CloudGemFramework::Error error) override; }; class CloudGemTextToSpeechResponseHandler; // Request bus for this component class CloudGemTextToSpeechRequests : public AZ::ComponentBus { public: virtual ~CloudGemTextToSpeechRequests() {} virtual void PostTtsVoiceline(const VoiceRequest& request_info, CloudGemTextToSpeechResponseHandler* responseHandler); virtual void PostTtsSpeechmarks(const SpeechMarksRequest& request_info, CloudGemTextToSpeechResponseHandler* responseHandler); }; using CloudGemTextToSpeechRequestBus = AZ::EBus; // This class is used as a parameter for all requests and throws the response on the CloudGemTextToSpeechNotificationBus // Inherit from this to define custom behavior. class CloudGemTextToSpeechResponseHandler { public: AZ_TYPE_INFO(CloudGemTextToSpeechResponseHandler, LmbrAWS_CodeGen_ResponseHandler_UUID) AZ_CLASS_ALLOCATOR(CloudGemTextToSpeechResponseHandler, AZ::SystemAllocator, 0) virtual ~CloudGemTextToSpeechResponseHandler() {} virtual void HandlePostTtsVoicelineSuccess(PostTtsVoicelineRequestJob* job, AZ::EntityId entityId); virtual void HandlePostTtsVoicelineError(PostTtsVoicelineRequestJob* job, AZ::EntityId entityId); virtual void HandlePostTtsSpeechmarksSuccess(PostTtsSpeechmarksRequestJob* job, AZ::EntityId entityId); virtual void HandlePostTtsSpeechmarksError(PostTtsSpeechmarksRequestJob* job, AZ::EntityId entityId); }; class CloudGemTextToSpeechClientComponent : public AZ::Component , public CloudGemTextToSpeechRequestBus::Handler { public: AZ_COMPONENT(CloudGemTextToSpeechClientComponent, LmbrAWS_CodeGen_Component_UUID); virtual ~CloudGemTextToSpeechClientComponent() = default; AZStd::shared_ptr m_defaultResponseHandler; void Init() override; void Activate() override; void Deactivate() override; static void Reflect(AZ::ReflectContext* reflection) { VoiceRequest::Reflect(reflection); VoiceUrl::Reflect(reflection); SpeechMarksRequest::Reflect(reflection); AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { // we must include any fields we want to expose to the editor or lua in the serialize context serializeContext->Class() ->Version(1); AZ::EditContext* editContext = serializeContext->GetEditContext(); if (editContext) { editContext->Class("CloudGemTextToSpeechClientComponent", "CloudGemTextToSpeech Component") ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::Category, "Cloud Canvas Gems") ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game")); } } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->EBus("CloudGemTextToSpeechRequestBus") // one of these for each function ->Event("PostTtsVoiceline", &CloudGemTextToSpeechRequestBus::Events::PostTtsVoiceline) ->Event("PostTtsSpeechmarks", &CloudGemTextToSpeechRequestBus::Events::PostTtsSpeechmarks) ; behaviorContext->EBus("CloudGemTextToSpeechNotificationBus") ->Handler() ; } } // Functions from the swagger definitions void PostTtsVoiceline(const VoiceRequest& request_info, CloudGemTextToSpeechResponseHandler* responseHandler) override; void PostTtsSpeechmarks(const SpeechMarksRequest& request_info, CloudGemTextToSpeechResponseHandler* responseHandler) override; }; } // ServiceAPI } // CloudGemTextToSpeech