ObjectCallbackBuilder.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright 2009-2017 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. #pragma once
  17. #include <string>
  18. #include <alibabacloud/oss/Export.h>
  19. #include <alibabacloud/oss/Types.h>
  20. namespace AlibabaCloud
  21. {
  22. namespace OSS
  23. {
  24. class ALIBABACLOUD_OSS_EXPORT ObjectCallbackBuilder
  25. {
  26. public:
  27. enum Type
  28. {
  29. URL = 0,
  30. JSON
  31. };
  32. ObjectCallbackBuilder(const std::string& url, const std::string& body);
  33. ObjectCallbackBuilder(const std::string& url, const std::string& body,
  34. const std::string& host, Type type);
  35. const std::string& CallbackUrl() const { return callbackUrl_; }
  36. const std::string& CallbackHost() const { return callbackHost_; }
  37. const std::string& CallbackBody() const { return callbackBody_; }
  38. Type CallbackBodyType() const { return callbackBodyType_; }
  39. void setCallbackUrl(const std::string& url) { callbackUrl_ = url; }
  40. void setCallbackHost(const std::string& host) { callbackHost_ = host; }
  41. void setCallbackBody(const std::string& body) { callbackBody_ = body; }
  42. void setCallbackBodyType(Type type) { callbackBodyType_ = type; }
  43. std::string build();
  44. private:
  45. std::string callbackUrl_;
  46. std::string callbackHost_;
  47. std::string callbackBody_;
  48. Type callbackBodyType_;
  49. };
  50. class ALIBABACLOUD_OSS_EXPORT ObjectCallbackVariableBuilder
  51. {
  52. public:
  53. ObjectCallbackVariableBuilder() {};
  54. const HeaderCollection& CallbackVariable() const { return callbackVariable_; }
  55. bool addCallbackVariable(const std::string &key, const std::string& value);
  56. std::string build();
  57. private:
  58. HeaderCollection callbackVariable_;
  59. };
  60. }
  61. }