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