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 <alibabacloud/oss/Export.h>
19 #include <alibabacloud/oss/OssRequest.h>
20 
21 namespace AlibabaCloud
22 {
23 namespace OSS
24 {
25 
26     class ALIBABACLOUD_OSS_EXPORT ListObjectVersionsRequest : public OssBucketRequest
27     {
28     public:
ListObjectVersionsRequest(const std::string & bucket)29         ListObjectVersionsRequest(const std::string& bucket):
30             OssBucketRequest(bucket),
31             delimiterIsSet_(false),
32             keyMarkerIsSet_(false),
33             maxKeysIsSet_(false),
34             prefixIsSet_(false),
35             encodingTypeIsSet_(false),
36             versionIdMarkerIsSet_(false)
37         {
38         }
setDelimiter(const std::string & delimiter)39         void setDelimiter(const std::string& delimiter) { delimiter_ = delimiter; delimiterIsSet_ = true; }
setKeyMarker(const std::string & marker)40         void setKeyMarker(const std::string& marker) { keyMarker_ = marker; keyMarkerIsSet_ = true;}
setMaxKeys(int maxKeys)41         void setMaxKeys(int maxKeys) {maxKeys_ = maxKeys; maxKeysIsSet_ = true;}
setPrefix(const std::string & prefix)42         void setPrefix(const std::string& prefix) { prefix_ = prefix; prefixIsSet_ = true; }
setEncodingType(const std::string & type)43         void setEncodingType(const std::string& type) { encodingType_ = type; encodingTypeIsSet_ = true; }
setVersionIdMarker(const std::string & marker)44         void setVersionIdMarker(const std::string& marker) { versionIdMarker_ = marker; versionIdMarkerIsSet_ = true; }
45 
46     protected:
specialParameters()47         virtual ParameterCollection specialParameters() const
48         {
49             ParameterCollection params;
50             params["versions"] = "";
51             if (delimiterIsSet_) params["delimiter"] = delimiter_;
52             if (keyMarkerIsSet_) params["key-marker"] = keyMarker_;
53             if (maxKeysIsSet_) params["max-keys"] = std::to_string(maxKeys_);
54             if (prefixIsSet_) params["prefix"] = prefix_;
55             if (encodingTypeIsSet_) params["encoding-type"] = encodingType_;
56             if (versionIdMarkerIsSet_) params["version-id-marker"] = versionIdMarker_;
57             return params;
58         }
59     private:
60         std::string delimiter_;
61         bool delimiterIsSet_;
62         std::string keyMarker_;
63         bool keyMarkerIsSet_;
64         int maxKeys_;
65         bool maxKeysIsSet_;
66         std::string prefix_;
67         bool prefixIsSet_;
68         std::string encodingType_;
69         bool encodingTypeIsSet_;
70         std::string versionIdMarker_;
71         bool versionIdMarkerIsSet_;
72     };
73 }
74 }
75