upgrade sdk core:
supported json param; change the way of include Utils.h;
This commit is contained in:
@@ -17,21 +17,21 @@
|
||||
#ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICEREQUEST_H_
|
||||
#define CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICEREQUEST_H_
|
||||
|
||||
#include <map>
|
||||
#include "CoreExport.h"
|
||||
#include "Url.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
class ALIBABACLOUD_CORE_EXPORT ServiceRequest {
|
||||
public:
|
||||
public:
|
||||
typedef std::string ParameterNameType;
|
||||
typedef std::string ParameterValueType;
|
||||
typedef std::map<ParameterNameType, ParameterValueType> ParameterCollection;
|
||||
|
||||
virtual ~ServiceRequest();
|
||||
|
||||
const char* content() const;
|
||||
const char *content() const;
|
||||
size_t contentSize() const;
|
||||
bool hasContent() const;
|
||||
ParameterCollection parameters() const;
|
||||
@@ -44,33 +44,33 @@ class ALIBABACLOUD_CORE_EXPORT ServiceRequest {
|
||||
void setConnectTimeout(const long connectTimeout);
|
||||
void setReadTimeout(const long readTimeout);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
ServiceRequest(const std::string &product, const std::string &version);
|
||||
ServiceRequest(const ServiceRequest &other);
|
||||
ServiceRequest(ServiceRequest &&other);
|
||||
ServiceRequest& operator=(const ServiceRequest &other);
|
||||
ServiceRequest& operator=(ServiceRequest &&other);
|
||||
ServiceRequest &operator=(const ServiceRequest &other);
|
||||
ServiceRequest &operator=(ServiceRequest &&other);
|
||||
|
||||
void addParameter(const ParameterNameType &name,
|
||||
const ParameterValueType &value);
|
||||
const ParameterValueType &value);
|
||||
ParameterValueType parameter(const ParameterNameType &name) const;
|
||||
ParameterValueType coreParameter(const ParameterNameType &name) const;
|
||||
void removeParameter(const ParameterNameType &name);
|
||||
void setContent(const char *data, size_t size);
|
||||
void setParameter(const ParameterNameType &name,
|
||||
const ParameterValueType &value);
|
||||
const ParameterValueType &value);
|
||||
|
||||
void setCoreParameter(const ParameterNameType &name,
|
||||
const ParameterValueType &value);
|
||||
|
||||
const ParameterValueType &value);
|
||||
|
||||
void setParameters(const ParameterCollection ¶ms);
|
||||
void setJsonParameters(const ParameterNameType &name, const ParameterCollection ¶ms);
|
||||
void setResourcePath(const std::string &path);
|
||||
void setProduct(const std::string &product);
|
||||
void setVersion(const std::string &version);
|
||||
void setScheme(const std::string scheme);
|
||||
|
||||
private:
|
||||
private:
|
||||
char *content_;
|
||||
size_t contentSize_;
|
||||
ParameterCollection params_;
|
||||
@@ -81,6 +81,6 @@ class ALIBABACLOUD_CORE_EXPORT ServiceRequest {
|
||||
long connectTimeout_;
|
||||
long readTimeout_;
|
||||
};
|
||||
} // namespace AlibabaCloud
|
||||
} // namespace AlibabaCloud
|
||||
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICEREQUEST_H_
|
||||
#endif // CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICEREQUEST_H_
|
||||
|
||||
43
core/include/alibabacloud/core/Utils.h
Normal file
43
core/include/alibabacloud/core/Utils.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 1999-2019 Alibaba Cloud All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef CORE_SRC_UTILS_H_
|
||||
#define CORE_SRC_UTILS_H_
|
||||
|
||||
#include <alibabacloud/core/HttpMessage.h>
|
||||
#include <alibabacloud/core/HttpRequest.h>
|
||||
#include <json/json.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
std::string ComputeContentMD5(const char *data, size_t size);
|
||||
std::string GenerateUuid();
|
||||
std::string HttpMethodToString(HttpRequest::Method method);
|
||||
void StringReplace(std::string &src, const std::string &s1,
|
||||
const std::string &s2);
|
||||
std::string UrlEncode(const std::string &src);
|
||||
std::string UrlDecode(const std::string &src);
|
||||
std::string
|
||||
canonicalizedQuery(const std::map<std::string, std::string> ¶ms);
|
||||
std::string canonicalizedHeaders(const HttpMessage::HeaderCollection &headers);
|
||||
std::string GetEnv(const std::string env);
|
||||
Json::Value ReadJson(const std::string str);
|
||||
std::string MapToJson(const std::map<std::string, std::string> &maps);
|
||||
std::map<std::string, std::string> JsonToMap(const std::string &json);
|
||||
} // namespace AlibabaCloud
|
||||
#endif // CORE_SRC_UTILS_H_
|
||||
Reference in New Issue
Block a user