CommonRequest.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 "CoreExport.h"
  19. #include "HttpRequest.h"
  20. #include "ServiceRequest.h"
  21. #include <string>
  22. namespace AlibabaCloud {
  23. class ALIBABACLOUD_CORE_EXPORT CommonRequest : public ServiceRequest {
  24. public:
  25. enum RequestPattern { RpcPattern, RoaPattern };
  26. explicit CommonRequest(RequestPattern pattern = RpcPattern);
  27. ~CommonRequest();
  28. std::string domain() const;
  29. ParameterValueType headerParameter(const ParameterNameType &name) const;
  30. ParameterCollection headerParameters() const;
  31. HttpRequest::Method httpMethod() const;
  32. ParameterValueType queryParameter(const ParameterNameType &name) const;
  33. ParameterCollection queryParameters() const;
  34. using ServiceRequest::setContent;
  35. void setDomain(const std::string &domain);
  36. void setHeaderParameter(const ParameterNameType &name,
  37. const ParameterValueType &value);
  38. void setHttpMethod(HttpRequest::Method method);
  39. void setQueryParameter(const ParameterNameType &name,
  40. const ParameterValueType &value);
  41. using ServiceRequest::setResourcePath;
  42. void setRequestPattern(RequestPattern pattern);
  43. using ServiceRequest::setScheme;
  44. using ServiceRequest::setVersion;
  45. RequestPattern requestPattern() const;
  46. protected:
  47. using ServiceRequest::product;
  48. private:
  49. std::string domain_;
  50. RequestPattern requestPattern_;
  51. ParameterCollection queryParams_;
  52. ParameterCollection headerParams_;
  53. HttpRequest::Method httpMethod_;
  54. };
  55. } // namespace AlibabaCloud
  56. #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONREQUEST_H_