Forráskód Böngészése

由廷诚发起的CLOUDPHOTO SDK自动发布, 版本号:1.6.5

Signed-off-by: haowei.yao <haowei.yao@alibaba-inc.com>
haowei.yao 8 éve
szülő
commit
1c441b53f5

+ 4 - 0
CHANGELOG

@@ -1,3 +1,7 @@
+2018-04-24 Version: 1.6.5
+1, add interface FetchPhotos
+2, add xflush log param unixTimestamp
+
 2018-04-23 Version: 1.6.4
 2018-04-23 Version: 1.6.4
 1, DescribeInstanceHistoryEvents adds parameter instanceEventTypes and instanceEventCycleStatuss.
 1, DescribeInstanceHistoryEvents adds parameter instanceEventTypes and instanceEventCycleStatuss.
 2, InstanceId parameter is not necessary for DescribeInstanceHistoryEvents now.
 2, InstanceId parameter is not necessary for DescribeInstanceHistoryEvents now.

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.6.4
+1.6.5

+ 4 - 0
cloudphoto/CMakeLists.txt

@@ -75,6 +75,8 @@ set(cloudphoto_public_header_model
 	include/alibabacloud/cloudphoto/model/RemoveAlbumPhotosResult.h
 	include/alibabacloud/cloudphoto/model/RemoveAlbumPhotosResult.h
 	include/alibabacloud/cloudphoto/model/ListAlbumsRequest.h
 	include/alibabacloud/cloudphoto/model/ListAlbumsRequest.h
 	include/alibabacloud/cloudphoto/model/ListAlbumsResult.h
 	include/alibabacloud/cloudphoto/model/ListAlbumsResult.h
+	include/alibabacloud/cloudphoto/model/FetchPhotosRequest.h
+	include/alibabacloud/cloudphoto/model/FetchPhotosResult.h
 	include/alibabacloud/cloudphoto/model/ListPhotoFacesRequest.h
 	include/alibabacloud/cloudphoto/model/ListPhotoFacesRequest.h
 	include/alibabacloud/cloudphoto/model/ListPhotoFacesResult.h
 	include/alibabacloud/cloudphoto/model/ListPhotoFacesResult.h
 	include/alibabacloud/cloudphoto/model/RenameAlbumRequest.h
 	include/alibabacloud/cloudphoto/model/RenameAlbumRequest.h
@@ -216,6 +218,8 @@ set(cloudphoto_src
 	src/model/RemoveAlbumPhotosResult.cc
 	src/model/RemoveAlbumPhotosResult.cc
 	src/model/ListAlbumsRequest.cc
 	src/model/ListAlbumsRequest.cc
 	src/model/ListAlbumsResult.cc
 	src/model/ListAlbumsResult.cc
+	src/model/FetchPhotosRequest.cc
+	src/model/FetchPhotosResult.cc
 	src/model/ListPhotoFacesRequest.cc
 	src/model/ListPhotoFacesRequest.cc
 	src/model/ListPhotoFacesResult.cc
 	src/model/ListPhotoFacesResult.cc
 	src/model/RenameAlbumRequest.cc
 	src/model/RenameAlbumRequest.cc

+ 8 - 0
cloudphoto/include/alibabacloud/cloudphoto/CloudPhotoClient.h

@@ -76,6 +76,8 @@
 #include "model/RemoveAlbumPhotosResult.h"
 #include "model/RemoveAlbumPhotosResult.h"
 #include "model/ListAlbumsRequest.h"
 #include "model/ListAlbumsRequest.h"
 #include "model/ListAlbumsResult.h"
 #include "model/ListAlbumsResult.h"
+#include "model/FetchPhotosRequest.h"
+#include "model/FetchPhotosResult.h"
 #include "model/ListPhotoFacesRequest.h"
 #include "model/ListPhotoFacesRequest.h"
 #include "model/ListPhotoFacesResult.h"
 #include "model/ListPhotoFacesResult.h"
 #include "model/RenameAlbumRequest.h"
 #include "model/RenameAlbumRequest.h"
@@ -250,6 +252,9 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::ListAlbumsResult> ListAlbumsOutcome;
 			typedef Outcome<Error, Model::ListAlbumsResult> ListAlbumsOutcome;
 			typedef std::future<ListAlbumsOutcome> ListAlbumsOutcomeCallable;
 			typedef std::future<ListAlbumsOutcome> ListAlbumsOutcomeCallable;
 			typedef std::function<void(const CloudPhotoClient*, const Model::ListAlbumsRequest&, const ListAlbumsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListAlbumsAsyncHandler;
 			typedef std::function<void(const CloudPhotoClient*, const Model::ListAlbumsRequest&, const ListAlbumsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListAlbumsAsyncHandler;
+			typedef Outcome<Error, Model::FetchPhotosResult> FetchPhotosOutcome;
+			typedef std::future<FetchPhotosOutcome> FetchPhotosOutcomeCallable;
+			typedef std::function<void(const CloudPhotoClient*, const Model::FetchPhotosRequest&, const FetchPhotosOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> FetchPhotosAsyncHandler;
 			typedef Outcome<Error, Model::ListPhotoFacesResult> ListPhotoFacesOutcome;
 			typedef Outcome<Error, Model::ListPhotoFacesResult> ListPhotoFacesOutcome;
 			typedef std::future<ListPhotoFacesOutcome> ListPhotoFacesOutcomeCallable;
 			typedef std::future<ListPhotoFacesOutcome> ListPhotoFacesOutcomeCallable;
 			typedef std::function<void(const CloudPhotoClient*, const Model::ListPhotoFacesRequest&, const ListPhotoFacesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListPhotoFacesAsyncHandler;
 			typedef std::function<void(const CloudPhotoClient*, const Model::ListPhotoFacesRequest&, const ListPhotoFacesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListPhotoFacesAsyncHandler;
@@ -462,6 +467,9 @@ namespace AlibabaCloud
 			ListAlbumsOutcome listAlbums(const Model::ListAlbumsRequest &request)const;
 			ListAlbumsOutcome listAlbums(const Model::ListAlbumsRequest &request)const;
 			void listAlbumsAsync(const Model::ListAlbumsRequest& request, const ListAlbumsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			void listAlbumsAsync(const Model::ListAlbumsRequest& request, const ListAlbumsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			ListAlbumsOutcomeCallable listAlbumsCallable(const Model::ListAlbumsRequest& request) const;
 			ListAlbumsOutcomeCallable listAlbumsCallable(const Model::ListAlbumsRequest& request) const;
+			FetchPhotosOutcome fetchPhotos(const Model::FetchPhotosRequest &request)const;
+			void fetchPhotosAsync(const Model::FetchPhotosRequest& request, const FetchPhotosAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			FetchPhotosOutcomeCallable fetchPhotosCallable(const Model::FetchPhotosRequest& request) const;
 			ListPhotoFacesOutcome listPhotoFaces(const Model::ListPhotoFacesRequest &request)const;
 			ListPhotoFacesOutcome listPhotoFaces(const Model::ListPhotoFacesRequest &request)const;
 			void listPhotoFacesAsync(const Model::ListPhotoFacesRequest& request, const ListPhotoFacesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			void listPhotoFacesAsync(const Model::ListPhotoFacesRequest& request, const ListPhotoFacesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			ListPhotoFacesOutcomeCallable listPhotoFacesCallable(const Model::ListPhotoFacesRequest& request) const;
 			ListPhotoFacesOutcomeCallable listPhotoFacesCallable(const Model::ListPhotoFacesRequest& request) const;

+ 66 - 0
cloudphoto/include/alibabacloud/cloudphoto/model/FetchPhotosRequest.h

@@ -0,0 +1,66 @@
+/*
+ * 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_CLOUDPHOTO_MODEL_FETCHPHOTOSREQUEST_H_
+#define ALIBABACLOUD_CLOUDPHOTO_MODEL_FETCHPHOTOSREQUEST_H_
+
+#include <string>
+#include <vector>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <alibabacloud/cloudphoto/CloudPhotoExport.h>
+
+namespace AlibabaCloud
+{
+	namespace CloudPhoto
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_CLOUDPHOTO_EXPORT FetchPhotosRequest : public RpcServiceRequest
+			{
+
+			public:
+				FetchPhotosRequest();
+				~FetchPhotosRequest();
+
+				int getSize()const;
+				void setSize(int size);
+				std::string getLibraryId()const;
+				void setLibraryId(const std::string& libraryId);
+				std::string getOrderBy()const;
+				void setOrderBy(const std::string& orderBy);
+				std::string getStoreName()const;
+				void setStoreName(const std::string& storeName);
+				std::string getState()const;
+				void setState(const std::string& state);
+				int getPage()const;
+				void setPage(int page);
+				std::string getOrder()const;
+				void setOrder(const std::string& order);
+
+            private:
+				int size_;
+				std::string libraryId_;
+				std::string orderBy_;
+				std::string storeName_;
+				std::string state_;
+				int page_;
+				std::string order_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_CLOUDPHOTO_MODEL_FETCHPHOTOSREQUEST_H_

+ 79 - 0
cloudphoto/include/alibabacloud/cloudphoto/model/FetchPhotosResult.h

@@ -0,0 +1,79 @@
+/*
+ * 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_CLOUDPHOTO_MODEL_FETCHPHOTOSRESULT_H_
+#define ALIBABACLOUD_CLOUDPHOTO_MODEL_FETCHPHOTOSRESULT_H_
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <alibabacloud/core/ServiceResult.h>
+#include <alibabacloud/cloudphoto/CloudPhotoExport.h>
+
+namespace AlibabaCloud
+{
+	namespace CloudPhoto
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_CLOUDPHOTO_EXPORT FetchPhotosResult : public ServiceResult
+			{
+			public:
+				struct Photo
+				{
+					bool isVideo;
+					long shareExpireTime;
+					std::string idStr;
+					long size;
+					std::string title;
+					long mtime;
+					std::string remark;
+					std::string state;
+					long ctime;
+					long inactiveTime;
+					std::string fileId;
+					long height;
+					long id;
+					long width;
+					long takenAt;
+					std::string location;
+					std::string md5;
+				};
+
+
+				FetchPhotosResult();
+				explicit FetchPhotosResult(const std::string &payload);
+				~FetchPhotosResult();
+				std::vector<Photo> getPhotos()const;
+				int getTotalCount()const;
+				std::string getAction()const;
+				std::string getMessage()const;
+				std::string getCode()const;
+
+			protected:
+				void parse(const std::string &payload);
+			private:
+				std::vector<Photo> photos_;
+				int totalCount_;
+				std::string action_;
+				std::string message_;
+				std::string code_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_CLOUDPHOTO_MODEL_FETCHPHOTOSRESULT_H_

+ 36 - 0
cloudphoto/src/CloudPhotoClient.cc

@@ -1023,6 +1023,42 @@ CloudPhotoClient::ListAlbumsOutcomeCallable CloudPhotoClient::listAlbumsCallable
 	return task->get_future();
 	return task->get_future();
 }
 }
 
 
+CloudPhotoClient::FetchPhotosOutcome CloudPhotoClient::fetchPhotos(const FetchPhotosRequest &request) const
+{
+	auto endpointOutcome = endpointProvider_->getEndpoint();
+	if (!endpointOutcome.isSuccess())
+		return FetchPhotosOutcome(endpointOutcome.error());
+
+	auto outcome = makeRequest(endpointOutcome.result(), request);
+
+	if (outcome.isSuccess())
+		return FetchPhotosOutcome(FetchPhotosResult(outcome.result()));
+	else
+		return FetchPhotosOutcome(outcome.error());
+}
+
+void CloudPhotoClient::fetchPhotosAsync(const FetchPhotosRequest& request, const FetchPhotosAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
+{
+	auto fn = [this, request, handler, context]()
+	{
+		handler(this, request, fetchPhotos(request), context);
+	};
+
+	asyncExecute(new Runnable(fn));
+}
+
+CloudPhotoClient::FetchPhotosOutcomeCallable CloudPhotoClient::fetchPhotosCallable(const FetchPhotosRequest &request) const
+{
+	auto task = std::make_shared<std::packaged_task<FetchPhotosOutcome()>>(
+			[this, request]()
+			{
+			return this->fetchPhotos(request);
+			});
+
+	asyncExecute(new Runnable([task]() { (*task)(); }));
+	return task->get_future();
+}
+
 CloudPhotoClient::ListPhotoFacesOutcome CloudPhotoClient::listPhotoFaces(const ListPhotoFacesRequest &request) const
 CloudPhotoClient::ListPhotoFacesOutcome CloudPhotoClient::listPhotoFaces(const ListPhotoFacesRequest &request) const
 {
 {
 	auto endpointOutcome = endpointProvider_->getEndpoint();
 	auto endpointOutcome = endpointProvider_->getEndpoint();

+ 104 - 0
cloudphoto/src/model/FetchPhotosRequest.cc

@@ -0,0 +1,104 @@
+/*
+ * 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/cloudphoto/model/FetchPhotosRequest.h>
+
+using AlibabaCloud::CloudPhoto::Model::FetchPhotosRequest;
+
+FetchPhotosRequest::FetchPhotosRequest() :
+	RpcServiceRequest("cloudphoto", "2017-07-11", "FetchPhotos")
+{}
+
+FetchPhotosRequest::~FetchPhotosRequest()
+{}
+
+int FetchPhotosRequest::getSize()const
+{
+	return size_;
+}
+
+void FetchPhotosRequest::setSize(int size)
+{
+	size_ = size;
+	setParameter("Size", std::to_string(size));
+}
+
+std::string FetchPhotosRequest::getLibraryId()const
+{
+	return libraryId_;
+}
+
+void FetchPhotosRequest::setLibraryId(const std::string& libraryId)
+{
+	libraryId_ = libraryId;
+	setParameter("LibraryId", libraryId);
+}
+
+std::string FetchPhotosRequest::getOrderBy()const
+{
+	return orderBy_;
+}
+
+void FetchPhotosRequest::setOrderBy(const std::string& orderBy)
+{
+	orderBy_ = orderBy;
+	setParameter("OrderBy", orderBy);
+}
+
+std::string FetchPhotosRequest::getStoreName()const
+{
+	return storeName_;
+}
+
+void FetchPhotosRequest::setStoreName(const std::string& storeName)
+{
+	storeName_ = storeName;
+	setParameter("StoreName", storeName);
+}
+
+std::string FetchPhotosRequest::getState()const
+{
+	return state_;
+}
+
+void FetchPhotosRequest::setState(const std::string& state)
+{
+	state_ = state;
+	setParameter("State", state);
+}
+
+int FetchPhotosRequest::getPage()const
+{
+	return page_;
+}
+
+void FetchPhotosRequest::setPage(int page)
+{
+	page_ = page;
+	setParameter("Page", std::to_string(page));
+}
+
+std::string FetchPhotosRequest::getOrder()const
+{
+	return order_;
+}
+
+void FetchPhotosRequest::setOrder(const std::string& order)
+{
+	order_ = order;
+	setParameter("Order", order);
+}
+

+ 118 - 0
cloudphoto/src/model/FetchPhotosResult.cc

@@ -0,0 +1,118 @@
+/*
+ * 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/cloudphoto/model/FetchPhotosResult.h>
+#include <json/json.h>
+
+using namespace AlibabaCloud::CloudPhoto;
+using namespace AlibabaCloud::CloudPhoto::Model;
+
+FetchPhotosResult::FetchPhotosResult() :
+	ServiceResult()
+{}
+
+FetchPhotosResult::FetchPhotosResult(const std::string &payload) :
+	ServiceResult()
+{
+	parse(payload);
+}
+
+FetchPhotosResult::~FetchPhotosResult()
+{}
+
+void FetchPhotosResult::parse(const std::string &payload)
+{
+	Json::Reader reader;
+	Json::Value value;
+	reader.parse(payload, value);
+
+	setRequestId(value["RequestId"].asString());
+	auto allPhotos = value["Photos"]["Photo"];
+	for (auto value : allPhotos)
+	{
+		Photo photosObject;
+		if(!value["Id"].isNull())
+			photosObject.id = std::stol(value["Id"].asString());
+		if(!value["IdStr"].isNull())
+			photosObject.idStr = value["IdStr"].asString();
+		if(!value["Title"].isNull())
+			photosObject.title = value["Title"].asString();
+		if(!value["FileId"].isNull())
+			photosObject.fileId = value["FileId"].asString();
+		if(!value["Location"].isNull())
+			photosObject.location = value["Location"].asString();
+		if(!value["State"].isNull())
+			photosObject.state = value["State"].asString();
+		if(!value["Md5"].isNull())
+			photosObject.md5 = value["Md5"].asString();
+		if(!value["IsVideo"].isNull())
+			photosObject.isVideo = value["IsVideo"].asString() == "true";
+		if(!value["Remark"].isNull())
+			photosObject.remark = value["Remark"].asString();
+		if(!value["Size"].isNull())
+			photosObject.size = std::stol(value["Size"].asString());
+		if(!value["Width"].isNull())
+			photosObject.width = std::stol(value["Width"].asString());
+		if(!value["Height"].isNull())
+			photosObject.height = std::stol(value["Height"].asString());
+		if(!value["Ctime"].isNull())
+			photosObject.ctime = std::stol(value["Ctime"].asString());
+		if(!value["Mtime"].isNull())
+			photosObject.mtime = std::stol(value["Mtime"].asString());
+		if(!value["TakenAt"].isNull())
+			photosObject.takenAt = std::stol(value["TakenAt"].asString());
+		if(!value["InactiveTime"].isNull())
+			photosObject.inactiveTime = std::stol(value["InactiveTime"].asString());
+		if(!value["ShareExpireTime"].isNull())
+			photosObject.shareExpireTime = std::stol(value["ShareExpireTime"].asString());
+		photos_.push_back(photosObject);
+	}
+	if(!value["Code"].isNull())
+		code_ = value["Code"].asString();
+	if(!value["Message"].isNull())
+		message_ = value["Message"].asString();
+	if(!value["TotalCount"].isNull())
+		totalCount_ = std::stoi(value["TotalCount"].asString());
+	if(!value["Action"].isNull())
+		action_ = value["Action"].asString();
+
+}
+
+std::vector<FetchPhotosResult::Photo> FetchPhotosResult::getPhotos()const
+{
+	return photos_;
+}
+
+int FetchPhotosResult::getTotalCount()const
+{
+	return totalCount_;
+}
+
+std::string FetchPhotosResult::getAction()const
+{
+	return action_;
+}
+
+std::string FetchPhotosResult::getMessage()const
+{
+	return message_;
+}
+
+std::string FetchPhotosResult::getCode()const
+{
+	return code_;
+}
+