CommonRequest.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright 1999-2019 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONREQUEST_H_
  17. #define CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONREQUEST_H_
  18. #include <string>
  19. #include "CoreExport.h"
  20. #include "ServiceRequest.h"
  21. #include "HttpRequest.h"
  22. namespace AlibabaCloud {
  23. class ALIBABACLOUD_CORE_EXPORT CommonRequest : public ServiceRequest {
  24. public:
  25. enum RequestPattern {
  26. RpcPattern,
  27. RoaPattern
  28. };
  29. explicit CommonRequest(RequestPattern pattern = RpcPattern);
  30. ~CommonRequest();
  31. std::string domain() const;
  32. ParameterValueType headerParameter(const ParameterNameType &name) const;
  33. ParameterCollection headerParameters() const;
  34. HttpRequest::Method httpMethod() const;
  35. ParameterValueType queryParameter(const ParameterNameType &name) const;
  36. ParameterCollection queryParameters() const;
  37. using ServiceRequest::setContent;
  38. void setDomain(const std::string &domain);
  39. void setHeaderParameter(const ParameterNameType &name,
  40. const ParameterValueType &value);
  41. void setHttpMethod(HttpRequest::Method method);
  42. void setQueryParameter(const ParameterNameType &name,
  43. const ParameterValueType &value);
  44. using ServiceRequest::setResourcePath;
  45. void setRequestPattern(RequestPattern pattern);
  46. using ServiceRequest::setVersion;
  47. using ServiceRequest::setScheme;
  48. RequestPattern requestPattern() const;
  49. protected:
  50. using ServiceRequest::product;
  51. private:
  52. std::string domain_;
  53. RequestPattern requestPattern_;
  54. ParameterCollection queryParams_;
  55. ParameterCollection headerParams_;
  56. HttpRequest::Method httpMethod_;
  57. };
  58. } // namespace AlibabaCloud
  59. #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONREQUEST_H_