sdk-team 7 лет назад
Родитель
Сommit
c5ef4b1c88

+ 3 - 0
CHANGELOG

@@ -1,3 +1,6 @@
+2019-10-25 Version 1.36.160
+- Supported query push records.
+
 2019-10-25 Version 1.36.159
 - Add DescribeDBClusterPerformance, DescribeDBNodePerformance for performance.
 

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.36.159
+1.36.160

+ 4 - 0
push/CMakeLists.txt

@@ -67,6 +67,8 @@ set(push_public_header_model
 	include/alibabacloud/push/model/QueryDevicesByAliasResult.h
 	include/alibabacloud/push/model/QueryPushListRequest.h
 	include/alibabacloud/push/model/QueryPushListResult.h
+	include/alibabacloud/push/model/QueryPushRecordsRequest.h
+	include/alibabacloud/push/model/QueryPushRecordsResult.h
 	include/alibabacloud/push/model/QueryPushStatByAppRequest.h
 	include/alibabacloud/push/model/QueryPushStatByAppResult.h
 	include/alibabacloud/push/model/QueryPushStatByMsgRequest.h
@@ -132,6 +134,8 @@ set(push_src
 	src/model/QueryDevicesByAliasResult.cc
 	src/model/QueryPushListRequest.cc
 	src/model/QueryPushListResult.cc
+	src/model/QueryPushRecordsRequest.cc
+	src/model/QueryPushRecordsResult.cc
 	src/model/QueryPushStatByAppRequest.cc
 	src/model/QueryPushStatByAppResult.cc
 	src/model/QueryPushStatByMsgRequest.cc

+ 8 - 0
push/include/alibabacloud/push/PushClient.h

@@ -68,6 +68,8 @@
 #include "model/QueryDevicesByAliasResult.h"
 #include "model/QueryPushListRequest.h"
 #include "model/QueryPushListResult.h"
+#include "model/QueryPushRecordsRequest.h"
+#include "model/QueryPushRecordsResult.h"
 #include "model/QueryPushStatByAppRequest.h"
 #include "model/QueryPushStatByAppResult.h"
 #include "model/QueryPushStatByMsgRequest.h"
@@ -162,6 +164,9 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::QueryPushListResult> QueryPushListOutcome;
 			typedef std::future<QueryPushListOutcome> QueryPushListOutcomeCallable;
 			typedef std::function<void(const PushClient*, const Model::QueryPushListRequest&, const QueryPushListOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> QueryPushListAsyncHandler;
+			typedef Outcome<Error, Model::QueryPushRecordsResult> QueryPushRecordsOutcome;
+			typedef std::future<QueryPushRecordsOutcome> QueryPushRecordsOutcomeCallable;
+			typedef std::function<void(const PushClient*, const Model::QueryPushRecordsRequest&, const QueryPushRecordsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> QueryPushRecordsAsyncHandler;
 			typedef Outcome<Error, Model::QueryPushStatByAppResult> QueryPushStatByAppOutcome;
 			typedef std::future<QueryPushStatByAppOutcome> QueryPushStatByAppOutcomeCallable;
 			typedef std::function<void(const PushClient*, const Model::QueryPushStatByAppRequest&, const QueryPushStatByAppOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> QueryPushStatByAppAsyncHandler;
@@ -260,6 +265,9 @@ namespace AlibabaCloud
 			QueryPushListOutcome queryPushList(const Model::QueryPushListRequest &request)const;
 			void queryPushListAsync(const Model::QueryPushListRequest& request, const QueryPushListAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			QueryPushListOutcomeCallable queryPushListCallable(const Model::QueryPushListRequest& request) const;
+			QueryPushRecordsOutcome queryPushRecords(const Model::QueryPushRecordsRequest &request)const;
+			void queryPushRecordsAsync(const Model::QueryPushRecordsRequest& request, const QueryPushRecordsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			QueryPushRecordsOutcomeCallable queryPushRecordsCallable(const Model::QueryPushRecordsRequest& request) const;
 			QueryPushStatByAppOutcome queryPushStatByApp(const Model::QueryPushStatByAppRequest &request)const;
 			void queryPushStatByAppAsync(const Model::QueryPushStatByAppRequest& request, const QueryPushStatByAppAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			QueryPushStatByAppOutcomeCallable queryPushStatByAppCallable(const Model::QueryPushStatByAppRequest& request) const;

+ 75 - 0
push/include/alibabacloud/push/model/QueryPushRecordsRequest.h

@@ -0,0 +1,75 @@
+/*
+ * Copyright 2009-2017 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 ALIBABACLOUD_PUSH_MODEL_QUERYPUSHRECORDSREQUEST_H_
+#define ALIBABACLOUD_PUSH_MODEL_QUERYPUSHRECORDSREQUEST_H_
+
+#include <string>
+#include <vector>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <alibabacloud/push/PushExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Push
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_PUSH_EXPORT QueryPushRecordsRequest : public RpcServiceRequest
+			{
+
+			public:
+				QueryPushRecordsRequest();
+				~QueryPushRecordsRequest();
+
+				std::string getStartTime()const;
+				void setStartTime(const std::string& startTime);
+				std::string getSource()const;
+				void setSource(const std::string& source);
+				std::string getAccessKeyId()const;
+				void setAccessKeyId(const std::string& accessKeyId);
+				std::string getNextToken()const;
+				void setNextToken(const std::string& nextToken);
+				int getPageSize()const;
+				void setPageSize(int pageSize);
+				std::string getKeyword()const;
+				void setKeyword(const std::string& keyword);
+				std::string getEndTime()const;
+				void setEndTime(const std::string& endTime);
+				std::string getTarget()const;
+				void setTarget(const std::string& target);
+				long getAppKey()const;
+				void setAppKey(long appKey);
+				std::string getPushType()const;
+				void setPushType(const std::string& pushType);
+
+            private:
+				std::string startTime_;
+				std::string source_;
+				std::string accessKeyId_;
+				std::string nextToken_;
+				int pageSize_;
+				std::string keyword_;
+				std::string endTime_;
+				std::string target_;
+				long appKey_;
+				std::string pushType_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_PUSH_MODEL_QUERYPUSHRECORDSREQUEST_H_

+ 68 - 0
push/include/alibabacloud/push/model/QueryPushRecordsResult.h

@@ -0,0 +1,68 @@
+/*
+ * Copyright 2009-2017 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 ALIBABACLOUD_PUSH_MODEL_QUERYPUSHRECORDSRESULT_H_
+#define ALIBABACLOUD_PUSH_MODEL_QUERYPUSHRECORDSRESULT_H_
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <alibabacloud/core/ServiceResult.h>
+#include <alibabacloud/push/PushExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Push
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_PUSH_EXPORT QueryPushRecordsResult : public ServiceResult
+			{
+			public:
+				struct PushInfo
+				{
+					std::string status;
+					std::string pushType;
+					std::string deviceType;
+					std::string target;
+					std::string pushTime;
+					long appKey;
+					std::string title;
+					std::string body;
+					std::string source;
+					long messageId;
+				};
+
+
+				QueryPushRecordsResult();
+				explicit QueryPushRecordsResult(const std::string &payload);
+				~QueryPushRecordsResult();
+				std::vector<PushInfo> getPushInfos()const;
+				std::string getNextToken()const;
+				int getPageSize()const;
+
+			protected:
+				void parse(const std::string &payload);
+			private:
+				std::vector<PushInfo> pushInfos_;
+				std::string nextToken_;
+				int pageSize_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_PUSH_MODEL_QUERYPUSHRECORDSRESULT_H_

+ 39 - 3
push/src/PushClient.cc

@@ -31,21 +31,21 @@ PushClient::PushClient(const Credentials &credentials, const ClientConfiguration
 	RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
 {
 	auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
-	endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
+	endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "cps");
 }
 
 PushClient::PushClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
 	RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
 {
 	auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
-	endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
+	endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "cps");
 }
 
 PushClient::PushClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
 	RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
 {
 	auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
-	endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
+	endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "cps");
 }
 
 PushClient::~PushClient()
@@ -879,6 +879,42 @@ PushClient::QueryPushListOutcomeCallable PushClient::queryPushListCallable(const
 	return task->get_future();
 }
 
+PushClient::QueryPushRecordsOutcome PushClient::queryPushRecords(const QueryPushRecordsRequest &request) const
+{
+	auto endpointOutcome = endpointProvider_->getEndpoint();
+	if (!endpointOutcome.isSuccess())
+		return QueryPushRecordsOutcome(endpointOutcome.error());
+
+	auto outcome = makeRequest(endpointOutcome.result(), request);
+
+	if (outcome.isSuccess())
+		return QueryPushRecordsOutcome(QueryPushRecordsResult(outcome.result()));
+	else
+		return QueryPushRecordsOutcome(outcome.error());
+}
+
+void PushClient::queryPushRecordsAsync(const QueryPushRecordsRequest& request, const QueryPushRecordsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
+{
+	auto fn = [this, request, handler, context]()
+	{
+		handler(this, request, queryPushRecords(request), context);
+	};
+
+	asyncExecute(new Runnable(fn));
+}
+
+PushClient::QueryPushRecordsOutcomeCallable PushClient::queryPushRecordsCallable(const QueryPushRecordsRequest &request) const
+{
+	auto task = std::make_shared<std::packaged_task<QueryPushRecordsOutcome()>>(
+			[this, request]()
+			{
+			return this->queryPushRecords(request);
+			});
+
+	asyncExecute(new Runnable([task]() { (*task)(); }));
+	return task->get_future();
+}
+
 PushClient::QueryPushStatByAppOutcome PushClient::queryPushStatByApp(const QueryPushStatByAppRequest &request) const
 {
 	auto endpointOutcome = endpointProvider_->getEndpoint();

+ 137 - 0
push/src/model/QueryPushRecordsRequest.cc

@@ -0,0 +1,137 @@
+/*
+ * Copyright 2009-2017 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.
+ */
+
+#include <alibabacloud/push/model/QueryPushRecordsRequest.h>
+
+using AlibabaCloud::Push::Model::QueryPushRecordsRequest;
+
+QueryPushRecordsRequest::QueryPushRecordsRequest() :
+	RpcServiceRequest("push", "2016-08-01", "QueryPushRecords")
+{}
+
+QueryPushRecordsRequest::~QueryPushRecordsRequest()
+{}
+
+std::string QueryPushRecordsRequest::getStartTime()const
+{
+	return startTime_;
+}
+
+void QueryPushRecordsRequest::setStartTime(const std::string& startTime)
+{
+	startTime_ = startTime;
+	setCoreParameter("StartTime", startTime);
+}
+
+std::string QueryPushRecordsRequest::getSource()const
+{
+	return source_;
+}
+
+void QueryPushRecordsRequest::setSource(const std::string& source)
+{
+	source_ = source;
+	setCoreParameter("Source", source);
+}
+
+std::string QueryPushRecordsRequest::getAccessKeyId()const
+{
+	return accessKeyId_;
+}
+
+void QueryPushRecordsRequest::setAccessKeyId(const std::string& accessKeyId)
+{
+	accessKeyId_ = accessKeyId;
+	setCoreParameter("AccessKeyId", accessKeyId);
+}
+
+std::string QueryPushRecordsRequest::getNextToken()const
+{
+	return nextToken_;
+}
+
+void QueryPushRecordsRequest::setNextToken(const std::string& nextToken)
+{
+	nextToken_ = nextToken;
+	setCoreParameter("NextToken", nextToken);
+}
+
+int QueryPushRecordsRequest::getPageSize()const
+{
+	return pageSize_;
+}
+
+void QueryPushRecordsRequest::setPageSize(int pageSize)
+{
+	pageSize_ = pageSize;
+	setCoreParameter("PageSize", std::to_string(pageSize));
+}
+
+std::string QueryPushRecordsRequest::getKeyword()const
+{
+	return keyword_;
+}
+
+void QueryPushRecordsRequest::setKeyword(const std::string& keyword)
+{
+	keyword_ = keyword;
+	setCoreParameter("Keyword", keyword);
+}
+
+std::string QueryPushRecordsRequest::getEndTime()const
+{
+	return endTime_;
+}
+
+void QueryPushRecordsRequest::setEndTime(const std::string& endTime)
+{
+	endTime_ = endTime;
+	setCoreParameter("EndTime", endTime);
+}
+
+std::string QueryPushRecordsRequest::getTarget()const
+{
+	return target_;
+}
+
+void QueryPushRecordsRequest::setTarget(const std::string& target)
+{
+	target_ = target;
+	setCoreParameter("Target", target);
+}
+
+long QueryPushRecordsRequest::getAppKey()const
+{
+	return appKey_;
+}
+
+void QueryPushRecordsRequest::setAppKey(long appKey)
+{
+	appKey_ = appKey;
+	setCoreParameter("AppKey", std::to_string(appKey));
+}
+
+std::string QueryPushRecordsRequest::getPushType()const
+{
+	return pushType_;
+}
+
+void QueryPushRecordsRequest::setPushType(const std::string& pushType)
+{
+	pushType_ = pushType;
+	setCoreParameter("PushType", pushType);
+}
+

+ 89 - 0
push/src/model/QueryPushRecordsResult.cc

@@ -0,0 +1,89 @@
+/*
+ * Copyright 2009-2017 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.
+ */
+
+#include <alibabacloud/push/model/QueryPushRecordsResult.h>
+#include <json/json.h>
+
+using namespace AlibabaCloud::Push;
+using namespace AlibabaCloud::Push::Model;
+
+QueryPushRecordsResult::QueryPushRecordsResult() :
+	ServiceResult()
+{}
+
+QueryPushRecordsResult::QueryPushRecordsResult(const std::string &payload) :
+	ServiceResult()
+{
+	parse(payload);
+}
+
+QueryPushRecordsResult::~QueryPushRecordsResult()
+{}
+
+void QueryPushRecordsResult::parse(const std::string &payload)
+{
+	Json::Reader reader;
+	Json::Value value;
+	reader.parse(payload, value);
+	setRequestId(value["RequestId"].asString());
+	auto allPushInfosNode = value["PushInfos"]["PushInfo"];
+	for (auto valuePushInfosPushInfo : allPushInfosNode)
+	{
+		PushInfo pushInfosObject;
+		if(!valuePushInfosPushInfo["AppKey"].isNull())
+			pushInfosObject.appKey = std::stol(valuePushInfosPushInfo["AppKey"].asString());
+		if(!valuePushInfosPushInfo["MessageId"].isNull())
+			pushInfosObject.messageId = std::stol(valuePushInfosPushInfo["MessageId"].asString());
+		if(!valuePushInfosPushInfo["PushType"].isNull())
+			pushInfosObject.pushType = valuePushInfosPushInfo["PushType"].asString();
+		if(!valuePushInfosPushInfo["DeviceType"].isNull())
+			pushInfosObject.deviceType = valuePushInfosPushInfo["DeviceType"].asString();
+		if(!valuePushInfosPushInfo["Target"].isNull())
+			pushInfosObject.target = valuePushInfosPushInfo["Target"].asString();
+		if(!valuePushInfosPushInfo["Source"].isNull())
+			pushInfosObject.source = valuePushInfosPushInfo["Source"].asString();
+		if(!valuePushInfosPushInfo["PushTime"].isNull())
+			pushInfosObject.pushTime = valuePushInfosPushInfo["PushTime"].asString();
+		if(!valuePushInfosPushInfo["Title"].isNull())
+			pushInfosObject.title = valuePushInfosPushInfo["Title"].asString();
+		if(!valuePushInfosPushInfo["Body"].isNull())
+			pushInfosObject.body = valuePushInfosPushInfo["Body"].asString();
+		if(!valuePushInfosPushInfo["Status"].isNull())
+			pushInfosObject.status = valuePushInfosPushInfo["Status"].asString();
+		pushInfos_.push_back(pushInfosObject);
+	}
+	if(!value["NextToken"].isNull())
+		nextToken_ = value["NextToken"].asString();
+	if(!value["PageSize"].isNull())
+		pageSize_ = std::stoi(value["PageSize"].asString());
+
+}
+
+std::vector<QueryPushRecordsResult::PushInfo> QueryPushRecordsResult::getPushInfos()const
+{
+	return pushInfos_;
+}
+
+std::string QueryPushRecordsResult::getNextToken()const
+{
+	return nextToken_;
+}
+
+int QueryPushRecordsResult::getPageSize()const
+{
+	return pageSize_;
+}
+