3
0

HttpRequestorSystemComponent.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/Component/Component.h>
  10. #include <HttpRequestor/HttpRequestorBus.h>
  11. #include "HttpRequestManager.h"
  12. namespace HttpRequestor
  13. {
  14. class HttpRequestorSystemComponent
  15. : public AZ::Component
  16. , protected HttpRequestorRequestBus::Handler
  17. {
  18. public:
  19. AZ_COMPONENT(HttpRequestorSystemComponent, "{CF29468F-1F67-497F-B4FF-C0F123584864}");
  20. static void Reflect(AZ::ReflectContext* context);
  21. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  22. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  23. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  24. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  25. protected:
  26. ////////////////////////////////////////////////////////////////////////
  27. // HttpRequestorRequestBus interface implementation
  28. ////////////////////////////////////////////////////////////////////////
  29. void AddRequest(const AZStd::string& URI, Aws::Http::HttpMethod method, const Callback& callback) override;
  30. void AddRequestWithHeaders(const AZStd::string& URI, Aws::Http::HttpMethod method, const Headers & headers, const Callback& callback) override;
  31. void AddRequestWithHeadersAndBody(const AZStd::string& URI, Aws::Http::HttpMethod method, const Headers & headers, const AZStd::string& body, const Callback& callback) override;
  32. void AddTextRequest(const AZStd::string& URI, Aws::Http::HttpMethod method, const TextCallback& callback) override;
  33. void AddTextRequestWithHeaders(const AZStd::string& URI, Aws::Http::HttpMethod method, const Headers & headers, const TextCallback& callback) override;
  34. void AddTextRequestWithHeadersAndBody(const AZStd::string& URI, Aws::Http::HttpMethod method, const Headers & headers, const AZStd::string& body, const TextCallback& callback) override;
  35. AZStd::chrono::milliseconds GetLastRoundTripTime() const override;
  36. ////////////////////////////////////////////////////////////////////////
  37. // AZ::Component interface implementation
  38. void Init() override;
  39. void Activate() override;
  40. void Deactivate() override;
  41. ////////////////////////////////////////////////////////////////////////
  42. private:
  43. ManagerPtr m_httpManager;
  44. };
  45. }