/* * 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 ///////////////////////////////////////////////////////// ///////////////////////////////////////////////////////// #include "StdAfx.h" #include "AWS/ServiceAPI/CloudGemWebCommunicatorClientComponent.h" namespace CloudGemWebCommunicator { namespace ServiceAPI { const char* LmbrAWS_CodeGen_PortalSetUserStatus_UUID= "{dd856276-e85b-40b4-95c4-f5d528405434}"; const char* LmbrAWS_CodeGen_Component_UUID= "{84b4eb2a-4258-4c15-92d0-8ba6bd75aaea}"; const char* LmbrAWS_CodeGen_ChannelRequestResult_UUID= "{4fe8f2f7-56e0-4699-85e3-bdd3d86aa9a7}"; const char* LmbrAWS_CodeGen_ResponseHandler_UUID= "{3accaebc-ec68-48d9-a693-7018c33fffa7}"; const char* LmbrAWS_CodeGen_RegistrationResult_UUID= "{91c1f123-9773-4444-81f5-5d3f20de3a82}"; const char* LmbrAWS_CodeGen_NotificationBus1_UUID= "{5bf470e4-676f-40db-9c85-cfdb108db854}"; const char* LmbrAWS_CodeGen_RequestBus1_UUID= "{08675663-c443-43c6-9ea0-b868be17d044}"; const char* LmbrAWS_CodeGen_PortalUserListResults_UUID= "{8d9d2f86-3bfb-45ab-9014-7ed91d0b07cf}"; const char* LmbrAWS_CodeGen_ServiceStatus_UUID= "{513dfc40-6e88-4a25-8ffd-5251bfea9888}"; const char* LmbrAWS_CodeGen_BroadcastRequest_UUID= "{39c39616-1c73-4a8d-ba68-88b92b5f2736}"; const char* LmbrAWS_CodeGen_PortalBroadcastResult_UUID= "{6a851ce8-2c01-4db3-9fe1-b8410fef6495}"; const char* LmbrAWS_CodeGen_ChannelInfo_UUID= "{c55f45b8-9ac2-46da-accc-1690ff3239a3}"; void Configure() { // Insert any necessary CloudGemFramework configuration here } // redefs bool WriteJson(CloudGemFramework::JsonWriter& writer, const int& item) { return writer.Int(item); } bool WriteJson(CloudGemFramework::JsonWriter& writer, const AZStd::string& item) { return writer.String(item); } bool WriteJson(CloudGemFramework::JsonWriter& writer, const double& item) { return writer.Double(item); } bool WriteJson(CloudGemFramework::JsonWriter& writer, const ChannelInfo& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("CommunicationChannel"); ok = ok && WriteJson(writer, item.CommunicationChannel); ok = ok && writer.Key("ChannelName"); ok = ok && WriteJson(writer, item.ChannelName); ok = ok && writer.Key("CommunicationType"); ok = ok && WriteJson(writer, item.CommunicationType); ok = ok && writer.Key("Subscription"); ok = ok && WriteJson(writer, item.Subscription); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const ChannelRequestResultArray& list) { bool ok = true; ok = ok && writer.StartArray(); for (auto item : list) { ok = ok && WriteJson(writer, item); } ok = ok && writer.EndArray(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const ChannelRequestResult& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("Channels"); ok = ok && WriteJson(writer, item.Channels); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const ServiceStatus& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("status"); ok = ok && WriteJson(writer, item.status); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const PortalSetUserStatus& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("RegistrationStatus"); ok = ok && WriteJson(writer, item.RegistrationStatus); ok = ok && writer.Key("ClientID"); ok = ok && WriteJson(writer, item.ClientID); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const PortalUserListResultArray& list) { bool ok = true; ok = ok && writer.StartArray(); for (auto item : list) { ok = ok && WriteJson(writer, item); } ok = ok && writer.EndArray(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const PortalUserListResults& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("Users"); ok = ok && WriteJson(writer, item.Users); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const RegistrationResult& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("Endpoint"); ok = ok && WriteJson(writer, item.Endpoint); ok = ok && writer.Key("EndpointPort"); ok = ok && WriteJson(writer, item.EndpointPort); ok = ok && writer.Key("PrivateKey"); ok = ok && WriteJson(writer, item.PrivateKey); ok = ok && writer.Key("ConnectionType"); ok = ok && WriteJson(writer, item.ConnectionType); ok = ok && writer.Key("Result"); ok = ok && WriteJson(writer, item.Result); ok = ok && writer.Key("DeviceCert"); ok = ok && WriteJson(writer, item.DeviceCert); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const BroadcastRequest& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("Message"); ok = ok && WriteJson(writer, item.Message); ok = ok && writer.Key("ChannelName"); ok = ok && WriteJson(writer, item.ChannelName); ok = ok && writer.EndObject(); return ok; } bool WriteJson(CloudGemFramework::JsonWriter& writer, const PortalBroadcastResult& item) { bool ok = true; ok = ok && writer.StartObject(); ok = ok && writer.Key("Result"); ok = ok && WriteJson(writer, item.Result); ok = ok && writer.EndObject(); return ok; } // Generated Function Parameters bool get_client_channelsRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool get_client_channelsRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; return ok; } bool get_service_statusRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool get_service_statusRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; return ok; } bool PostPortalUsersRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool PostPortalUsersRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; ok = ok && CloudGemWebCommunicator::ServiceAPI::WriteJson(writer, request_content); return ok; } bool GetPortalUsersRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool GetPortalUsersRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; return ok; } bool get_client_registrationRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.SetPathParameter("{""registration_type""}", registration_type); ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool get_client_registrationRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; return ok; } bool channel_broadcastRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool channel_broadcastRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; ok = ok && CloudGemWebCommunicator::ServiceAPI::WriteJson(writer, message_info); return ok; } bool list_all_channelsRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool list_all_channelsRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; return ok; } bool client_channel_broadcastRequest::Parameters::BuildRequest(CloudGemFramework::RequestBuilder& request) { bool ok = true; ok = ok && request.WriteJsonBodyParameter(*this); return ok; } bool client_channel_broadcastRequest::Parameters::WriteJson(CloudGemFramework::JsonWriter& writer) const { bool ok = true; ok = ok && CloudGemWebCommunicator::ServiceAPI::WriteJson(writer, message_info); return ok; } // CloudGemWebCommunicatorNotificationBus void CloudGemWebCommunicatorNotifications::Onget_client_channelsRequestSuccess(const ChannelRequestResult response) { } void CloudGemWebCommunicatorNotifications::Onget_client_channelsRequestError(const CloudGemFramework::Error error) { } void CloudGemWebCommunicatorNotifications::Onget_service_statusRequestSuccess(const ServiceStatus response) { } void CloudGemWebCommunicatorNotifications::Onget_service_statusRequestError(const CloudGemFramework::Error error) { } void CloudGemWebCommunicatorNotifications::OnPostPortalUsersRequestSuccess(const PortalSetUserStatus response) { } void CloudGemWebCommunicatorNotifications::OnPostPortalUsersRequestError(const CloudGemFramework::Error error) { } void CloudGemWebCommunicatorNotifications::OnGetPortalUsersRequestSuccess(const PortalUserListResults response) { } void CloudGemWebCommunicatorNotifications::OnGetPortalUsersRequestError(const CloudGemFramework::Error error) { } void CloudGemWebCommunicatorNotifications::Onget_client_registrationRequestSuccess(const RegistrationResult response) { } void CloudGemWebCommunicatorNotifications::Onget_client_registrationRequestError(const CloudGemFramework::Error error) { } void CloudGemWebCommunicatorNotifications::Onchannel_broadcastRequestSuccess(const PortalBroadcastResult response) { } void CloudGemWebCommunicatorNotifications::Onchannel_broadcastRequestError(const CloudGemFramework::Error error) { } void CloudGemWebCommunicatorNotifications::Onlist_all_channelsRequestSuccess(const ChannelRequestResult response) { } void CloudGemWebCommunicatorNotifications::Onlist_all_channelsRequestError(const CloudGemFramework::Error error) { } void CloudGemWebCommunicatorNotifications::Onclient_channel_broadcastRequestSuccess(const PortalBroadcastResult response) { } void CloudGemWebCommunicatorNotifications::Onclient_channel_broadcastRequestError(const CloudGemFramework::Error error) { } // BehaviorContext CloudGemWebCommunicatorNotificationBus handler implementation void BehaviorCloudGemWebCommunicatorNotificationBusHandler::Onget_client_channelsRequestSuccess(const ChannelRequestResult response) { Call(FN_Onget_client_channelsRequestSuccess, response); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::Onget_client_channelsRequestError(const CloudGemFramework::Error error) { Call(FN_Onget_client_channelsRequestError, error); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::Onget_service_statusRequestSuccess(const ServiceStatus response) { Call(FN_Onget_service_statusRequestSuccess, response); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::Onget_service_statusRequestError(const CloudGemFramework::Error error) { Call(FN_Onget_service_statusRequestError, error); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::OnPostPortalUsersRequestSuccess(const PortalSetUserStatus response) { Call(FN_OnPostPortalUsersRequestSuccess, response); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::OnPostPortalUsersRequestError(const CloudGemFramework::Error error) { Call(FN_OnPostPortalUsersRequestError, error); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::OnGetPortalUsersRequestSuccess(const PortalUserListResults response) { Call(FN_OnGetPortalUsersRequestSuccess, response); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::OnGetPortalUsersRequestError(const CloudGemFramework::Error error) { Call(FN_OnGetPortalUsersRequestError, error); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::Onget_client_registrationRequestSuccess(const RegistrationResult response) { Call(FN_Onget_client_registrationRequestSuccess, response); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::Onget_client_registrationRequestError(const CloudGemFramework::Error error) { Call(FN_Onget_client_registrationRequestError, error); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::Onchannel_broadcastRequestSuccess(const PortalBroadcastResult response) { Call(FN_Onchannel_broadcastRequestSuccess, response); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::Onchannel_broadcastRequestError(const CloudGemFramework::Error error) { Call(FN_Onchannel_broadcastRequestError, error); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::Onlist_all_channelsRequestSuccess(const ChannelRequestResult response) { Call(FN_Onlist_all_channelsRequestSuccess, response); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::Onlist_all_channelsRequestError(const CloudGemFramework::Error error) { Call(FN_Onlist_all_channelsRequestError, error); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::Onclient_channel_broadcastRequestSuccess(const PortalBroadcastResult response) { Call(FN_Onclient_channel_broadcastRequestSuccess, response); } void BehaviorCloudGemWebCommunicatorNotificationBusHandler::Onclient_channel_broadcastRequestError(const CloudGemFramework::Error error) { Call(FN_Onclient_channel_broadcastRequestError, error); } // CloudGemWebCommunicatorRequestBus void CloudGemWebCommunicatorRequests::get_client_channels(CloudGemWebCommunicatorResponseHandler* responseHandler) { } void CloudGemWebCommunicatorRequests::get_service_status(CloudGemWebCommunicatorResponseHandler* responseHandler) { } void CloudGemWebCommunicatorRequests::PostPortalUsers(const PortalSetUserStatus& request_content, CloudGemWebCommunicatorResponseHandler* responseHandler) { } void CloudGemWebCommunicatorRequests::GetPortalUsers(CloudGemWebCommunicatorResponseHandler* responseHandler) { } void CloudGemWebCommunicatorRequests::get_client_registration(const AZStd::string& registration_type, CloudGemWebCommunicatorResponseHandler* responseHandler) { } void CloudGemWebCommunicatorRequests::channel_broadcast(const BroadcastRequest& message_info, CloudGemWebCommunicatorResponseHandler* responseHandler) { } void CloudGemWebCommunicatorRequests::list_all_channels(CloudGemWebCommunicatorResponseHandler* responseHandler) { } void CloudGemWebCommunicatorRequests::client_channel_broadcast(const BroadcastRequest& message_info, CloudGemWebCommunicatorResponseHandler* responseHandler) { } // CloudGemWebCommunicatorResponseHandler void CloudGemWebCommunicatorResponseHandler::Handleget_client_channelsSuccess(get_client_channelsRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, Onget_client_channelsRequestSuccess, job->result); } void CloudGemWebCommunicatorResponseHandler::Handleget_client_channelsError(get_client_channelsRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, Onget_client_channelsRequestError, job->error); } void CloudGemWebCommunicatorResponseHandler::Handleget_service_statusSuccess(get_service_statusRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, Onget_service_statusRequestSuccess, job->result); } void CloudGemWebCommunicatorResponseHandler::Handleget_service_statusError(get_service_statusRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, Onget_service_statusRequestError, job->error); } void CloudGemWebCommunicatorResponseHandler::HandlePostPortalUsersSuccess(PostPortalUsersRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, OnPostPortalUsersRequestSuccess, job->result); } void CloudGemWebCommunicatorResponseHandler::HandlePostPortalUsersError(PostPortalUsersRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, OnPostPortalUsersRequestError, job->error); } void CloudGemWebCommunicatorResponseHandler::HandleGetPortalUsersSuccess(GetPortalUsersRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, OnGetPortalUsersRequestSuccess, job->result); } void CloudGemWebCommunicatorResponseHandler::HandleGetPortalUsersError(GetPortalUsersRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, OnGetPortalUsersRequestError, job->error); } void CloudGemWebCommunicatorResponseHandler::Handleget_client_registrationSuccess(get_client_registrationRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, Onget_client_registrationRequestSuccess, job->result); } void CloudGemWebCommunicatorResponseHandler::Handleget_client_registrationError(get_client_registrationRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, Onget_client_registrationRequestError, job->error); } void CloudGemWebCommunicatorResponseHandler::Handlechannel_broadcastSuccess(channel_broadcastRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, Onchannel_broadcastRequestSuccess, job->result); } void CloudGemWebCommunicatorResponseHandler::Handlechannel_broadcastError(channel_broadcastRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, Onchannel_broadcastRequestError, job->error); } void CloudGemWebCommunicatorResponseHandler::Handlelist_all_channelsSuccess(list_all_channelsRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, Onlist_all_channelsRequestSuccess, job->result); } void CloudGemWebCommunicatorResponseHandler::Handlelist_all_channelsError(list_all_channelsRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, Onlist_all_channelsRequestError, job->error); } void CloudGemWebCommunicatorResponseHandler::Handleclient_channel_broadcastSuccess(client_channel_broadcastRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, Onclient_channel_broadcastRequestSuccess, job->result); } void CloudGemWebCommunicatorResponseHandler::Handleclient_channel_broadcastError(client_channel_broadcastRequestJob* job, AZ::EntityId entityId) { EBUS_EVENT_ID(entityId, CloudGemWebCommunicatorNotificationBus, Onclient_channel_broadcastRequestError, job->error); } // CloudGemWebCommunicatorClientComponent void CloudGemWebCommunicatorClientComponent::Init() { m_defaultResponseHandler = AZStd::make_shared(); CloudGemWebCommunicator::ServiceAPI::Configure(); } void CloudGemWebCommunicatorClientComponent::Activate() { CloudGemWebCommunicatorRequestBus::Handler::BusConnect(m_entity->GetId()); } void CloudGemWebCommunicatorClientComponent::Deactivate() { CloudGemWebCommunicatorRequestBus::Handler::BusDisconnect(); } void CloudGemWebCommunicatorClientComponent::get_client_channels(CloudGemWebCommunicatorResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemWebCommunicatorResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job get_client_channelsRequestJob* requestJob = get_client_channelsRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](get_client_channelsRequestJob* successJob) { // handle success CloudGemWebCommunicatorResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->Handleget_client_channelsSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](get_client_channelsRequestJob* failedJob) { // handle error CloudGemWebCommunicatorResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->Handleget_client_channelsError(failedJob, entityId); } } ); requestJob->Start(); } void CloudGemWebCommunicatorClientComponent::get_service_status(CloudGemWebCommunicatorResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemWebCommunicatorResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job get_service_statusRequestJob* requestJob = get_service_statusRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](get_service_statusRequestJob* successJob) { // handle success CloudGemWebCommunicatorResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->Handleget_service_statusSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](get_service_statusRequestJob* failedJob) { // handle error CloudGemWebCommunicatorResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->Handleget_service_statusError(failedJob, entityId); } } ); requestJob->Start(); } void CloudGemWebCommunicatorClientComponent::PostPortalUsers(const PortalSetUserStatus& request_content, CloudGemWebCommunicatorResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemWebCommunicatorResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job PostPortalUsersRequestJob* requestJob = PostPortalUsersRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](PostPortalUsersRequestJob* successJob) { // handle success CloudGemWebCommunicatorResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->HandlePostPortalUsersSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](PostPortalUsersRequestJob* failedJob) { // handle error CloudGemWebCommunicatorResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->HandlePostPortalUsersError(failedJob, entityId); } } ); requestJob->parameters.request_content = request_content; requestJob->Start(); } void CloudGemWebCommunicatorClientComponent::GetPortalUsers(CloudGemWebCommunicatorResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemWebCommunicatorResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job GetPortalUsersRequestJob* requestJob = GetPortalUsersRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](GetPortalUsersRequestJob* successJob) { // handle success CloudGemWebCommunicatorResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->HandleGetPortalUsersSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](GetPortalUsersRequestJob* failedJob) { // handle error CloudGemWebCommunicatorResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->HandleGetPortalUsersError(failedJob, entityId); } } ); requestJob->Start(); } void CloudGemWebCommunicatorClientComponent::get_client_registration(const AZStd::string& registration_type, CloudGemWebCommunicatorResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemWebCommunicatorResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job get_client_registrationRequestJob* requestJob = get_client_registrationRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](get_client_registrationRequestJob* successJob) { // handle success CloudGemWebCommunicatorResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->Handleget_client_registrationSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](get_client_registrationRequestJob* failedJob) { // handle error CloudGemWebCommunicatorResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->Handleget_client_registrationError(failedJob, entityId); } } ); requestJob->parameters.registration_type = registration_type; requestJob->Start(); } void CloudGemWebCommunicatorClientComponent::channel_broadcast(const BroadcastRequest& message_info, CloudGemWebCommunicatorResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemWebCommunicatorResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job channel_broadcastRequestJob* requestJob = channel_broadcastRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](channel_broadcastRequestJob* successJob) { // handle success CloudGemWebCommunicatorResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->Handlechannel_broadcastSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](channel_broadcastRequestJob* failedJob) { // handle error CloudGemWebCommunicatorResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->Handlechannel_broadcastError(failedJob, entityId); } } ); requestJob->parameters.message_info = message_info; requestJob->Start(); } void CloudGemWebCommunicatorClientComponent::list_all_channels(CloudGemWebCommunicatorResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemWebCommunicatorResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job list_all_channelsRequestJob* requestJob = list_all_channelsRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](list_all_channelsRequestJob* successJob) { // handle success CloudGemWebCommunicatorResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->Handlelist_all_channelsSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](list_all_channelsRequestJob* failedJob) { // handle error CloudGemWebCommunicatorResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->Handlelist_all_channelsError(failedJob, entityId); } } ); requestJob->Start(); } void CloudGemWebCommunicatorClientComponent::client_channel_broadcast(const BroadcastRequest& message_info, CloudGemWebCommunicatorResponseHandler* responseHandler) { // Cache our entityId in case the entity goes away AZ::EntityId entityId; if (m_entity) { entityId = m_entity->GetId(); } // Cache our default response handler in case this component goes away AZStd::shared_ptr < CloudGemWebCommunicatorResponseHandler > defaultResponseHandler = m_defaultResponseHandler; // Create job client_channel_broadcastRequestJob* requestJob = client_channel_broadcastRequestJob::Create( [responseHandler, defaultResponseHandler, entityId](client_channel_broadcastRequestJob* successJob) { // handle success CloudGemWebCommunicatorResponseHandler* successHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (successHandler) { successHandler->Handleclient_channel_broadcastSuccess(successJob, entityId); } }, [responseHandler, defaultResponseHandler, entityId](client_channel_broadcastRequestJob* failedJob) { // handle error CloudGemWebCommunicatorResponseHandler* failureHandler = responseHandler ? responseHandler : defaultResponseHandler.get(); if (failureHandler) { failureHandler->Handleclient_channel_broadcastError(failedJob, entityId); } } ); requestJob->parameters.message_info = message_info; requestJob->Start(); } bool ChannelInfo::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "CommunicationChannel") == 0) return reader.Accept(CommunicationChannel); if (strcmp(key, "ChannelName") == 0) return reader.Accept(ChannelName); if (strcmp(key, "CommunicationType") == 0) return reader.Accept(CommunicationType); if (strcmp(key, "Subscription") == 0) return reader.Accept(Subscription); return reader.Ignore(); } void ChannelInfo::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemWebCommunicator_ChannelInfo") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("CommunicationChannel", BehaviorValueProperty(&ChannelInfo::CommunicationChannel)) ->Property("ChannelName", BehaviorValueProperty(&ChannelInfo::ChannelName)) ->Property("CommunicationType", BehaviorValueProperty(&ChannelInfo::CommunicationType)) ->Property("Subscription", BehaviorValueProperty(&ChannelInfo::Subscription)) ; } } bool ChannelRequestResult::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "Channels") == 0) return reader.Accept(Channels); return reader.Ignore(); } void ChannelRequestResult::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemWebCommunicator_ChannelRequestResult") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("Channels", BehaviorValueProperty(&ChannelRequestResult::Channels)) ; } } bool ServiceStatus::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "status") == 0) return reader.Accept(status); return reader.Ignore(); } void ServiceStatus::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemWebCommunicator_ServiceStatus") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("status", BehaviorValueProperty(&ServiceStatus::status)) ; } } bool PortalSetUserStatus::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "RegistrationStatus") == 0) return reader.Accept(RegistrationStatus); if (strcmp(key, "ClientID") == 0) return reader.Accept(ClientID); return reader.Ignore(); } void PortalSetUserStatus::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemWebCommunicator_PortalSetUserStatus") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("RegistrationStatus", BehaviorValueProperty(&PortalSetUserStatus::RegistrationStatus)) ->Property("ClientID", BehaviorValueProperty(&PortalSetUserStatus::ClientID)) ; } } bool PortalUserListResults::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "Users") == 0) return reader.Accept(Users); return reader.Ignore(); } void PortalUserListResults::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemWebCommunicator_PortalUserListResults") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("Users", BehaviorValueProperty(&PortalUserListResults::Users)) ; } } bool RegistrationResult::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "Endpoint") == 0) return reader.Accept(Endpoint); if (strcmp(key, "EndpointPort") == 0) return reader.Accept(EndpointPort); if (strcmp(key, "PrivateKey") == 0) return reader.Accept(PrivateKey); if (strcmp(key, "ConnectionType") == 0) return reader.Accept(ConnectionType); if (strcmp(key, "Result") == 0) return reader.Accept(Result); if (strcmp(key, "DeviceCert") == 0) return reader.Accept(DeviceCert); return reader.Ignore(); } void RegistrationResult::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemWebCommunicator_RegistrationResult") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("Endpoint", BehaviorValueProperty(&RegistrationResult::Endpoint)) ->Property("EndpointPort", BehaviorValueProperty(&RegistrationResult::EndpointPort)) ->Property("PrivateKey", BehaviorValueProperty(&RegistrationResult::PrivateKey)) ->Property("ConnectionType", BehaviorValueProperty(&RegistrationResult::ConnectionType)) ->Property("Result", BehaviorValueProperty(&RegistrationResult::Result)) ->Property("DeviceCert", BehaviorValueProperty(&RegistrationResult::DeviceCert)) ; } } bool BroadcastRequest::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "Message") == 0) return reader.Accept(Message); if (strcmp(key, "ChannelName") == 0) return reader.Accept(ChannelName); return reader.Ignore(); } void BroadcastRequest::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemWebCommunicator_BroadcastRequest") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("Message", BehaviorValueProperty(&BroadcastRequest::Message)) ->Property("ChannelName", BehaviorValueProperty(&BroadcastRequest::ChannelName)) ; } } bool PortalBroadcastResult::OnJsonKey(const char* key, CloudGemFramework::JsonReader& reader) { if (strcmp(key, "Result") == 0) return reader.Accept(Result); return reader.Ignore(); } void PortalBroadcastResult::Reflect(AZ::ReflectContext* reflection) { AZ::SerializeContext* serializeContext = azrtti_cast(reflection); if (serializeContext) { serializeContext->Class() ->Version(1); } AZ::BehaviorContext* behaviorContext = azrtti_cast(reflection); if (behaviorContext) { behaviorContext->Class("CloudGemWebCommunicator_PortalBroadcastResult") ->Attribute(AZ::Script::Attributes::Storage, AZ::Script::Attributes::StorageType::Value) ->Property("Result", BehaviorValueProperty(&PortalBroadcastResult::Result)) ; } } } }