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

Signed-off-by: haowei.yao <haowei.yao@alibaba-inc.com>
This commit is contained in:
haowei.yao
2018-04-17 14:55:21 +08:00
parent ff129e3660
commit a28f39fd8c
11 changed files with 424 additions and 1 deletions

View File

@@ -45,6 +45,8 @@ set(cloudphoto_public_header_model
include/alibabacloud/cloudphoto/model/RegisterTagResult.h
include/alibabacloud/cloudphoto/model/ListTimeLinePhotosRequest.h
include/alibabacloud/cloudphoto/model/ListTimeLinePhotosResult.h
include/alibabacloud/cloudphoto/model/FetchMomentPhotosRequest.h
include/alibabacloud/cloudphoto/model/FetchMomentPhotosResult.h
include/alibabacloud/cloudphoto/model/DeletePhotosRequest.h
include/alibabacloud/cloudphoto/model/DeletePhotosResult.h
include/alibabacloud/cloudphoto/model/MergeFacesRequest.h
@@ -184,6 +186,8 @@ set(cloudphoto_src
src/model/RegisterTagResult.cc
src/model/ListTimeLinePhotosRequest.cc
src/model/ListTimeLinePhotosResult.cc
src/model/FetchMomentPhotosRequest.cc
src/model/FetchMomentPhotosResult.cc
src/model/DeletePhotosRequest.cc
src/model/DeletePhotosResult.cc
src/model/MergeFacesRequest.cc

View File

@@ -46,6 +46,8 @@
#include "model/RegisterTagResult.h"
#include "model/ListTimeLinePhotosRequest.h"
#include "model/ListTimeLinePhotosResult.h"
#include "model/FetchMomentPhotosRequest.h"
#include "model/FetchMomentPhotosResult.h"
#include "model/DeletePhotosRequest.h"
#include "model/DeletePhotosResult.h"
#include "model/MergeFacesRequest.h"
@@ -203,6 +205,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::ListTimeLinePhotosResult> ListTimeLinePhotosOutcome;
typedef std::future<ListTimeLinePhotosOutcome> ListTimeLinePhotosOutcomeCallable;
typedef std::function<void(const CloudPhotoClient*, const Model::ListTimeLinePhotosRequest&, const ListTimeLinePhotosOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListTimeLinePhotosAsyncHandler;
typedef Outcome<Error, Model::FetchMomentPhotosResult> FetchMomentPhotosOutcome;
typedef std::future<FetchMomentPhotosOutcome> FetchMomentPhotosOutcomeCallable;
typedef std::function<void(const CloudPhotoClient*, const Model::FetchMomentPhotosRequest&, const FetchMomentPhotosOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> FetchMomentPhotosAsyncHandler;
typedef Outcome<Error, Model::DeletePhotosResult> DeletePhotosOutcome;
typedef std::future<DeletePhotosOutcome> DeletePhotosOutcomeCallable;
typedef std::function<void(const CloudPhotoClient*, const Model::DeletePhotosRequest&, const DeletePhotosOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DeletePhotosAsyncHandler;
@@ -412,6 +417,9 @@ namespace AlibabaCloud
ListTimeLinePhotosOutcome listTimeLinePhotos(const Model::ListTimeLinePhotosRequest &request)const;
void listTimeLinePhotosAsync(const Model::ListTimeLinePhotosRequest& request, const ListTimeLinePhotosAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ListTimeLinePhotosOutcomeCallable listTimeLinePhotosCallable(const Model::ListTimeLinePhotosRequest& request) const;
FetchMomentPhotosOutcome fetchMomentPhotos(const Model::FetchMomentPhotosRequest &request)const;
void fetchMomentPhotosAsync(const Model::FetchMomentPhotosRequest& request, const FetchMomentPhotosAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
FetchMomentPhotosOutcomeCallable fetchMomentPhotosCallable(const Model::FetchMomentPhotosRequest& request) const;
DeletePhotosOutcome deletePhotos(const Model::DeletePhotosRequest &request)const;
void deletePhotosAsync(const Model::DeletePhotosRequest& request, const DeletePhotosAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
DeletePhotosOutcomeCallable deletePhotosCallable(const Model::DeletePhotosRequest& request) const;

View File

@@ -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_FETCHMOMENTPHOTOSREQUEST_H_
#define ALIBABACLOUD_CLOUDPHOTO_MODEL_FETCHMOMENTPHOTOSREQUEST_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 FetchMomentPhotosRequest : public RpcServiceRequest
{
public:
FetchMomentPhotosRequest();
~FetchMomentPhotosRequest();
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);
int getPage()const;
void setPage(int page);
long getMomentId()const;
void setMomentId(long momentId);
std::string getOrder()const;
void setOrder(const std::string& order);
private:
int size_;
std::string libraryId_;
std::string orderBy_;
std::string storeName_;
int page_;
long momentId_;
std::string order_;
};
}
}
}
#endif // !ALIBABACLOUD_CLOUDPHOTO_MODEL_FETCHMOMENTPHOTOSREQUEST_H_

View File

@@ -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_FETCHMOMENTPHOTOSRESULT_H_
#define ALIBABACLOUD_CLOUDPHOTO_MODEL_FETCHMOMENTPHOTOSRESULT_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 FetchMomentPhotosResult : 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;
};
FetchMomentPhotosResult();
explicit FetchMomentPhotosResult(const std::string &payload);
~FetchMomentPhotosResult();
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_FETCHMOMENTPHOTOSRESULT_H_

View File

@@ -57,6 +57,7 @@ namespace AlibabaCloud
long mtime;
long id;
std::string name;
std::string remark;
};

View File

@@ -483,6 +483,42 @@ CloudPhotoClient::ListTimeLinePhotosOutcomeCallable CloudPhotoClient::listTimeLi
return task->get_future();
}
CloudPhotoClient::FetchMomentPhotosOutcome CloudPhotoClient::fetchMomentPhotos(const FetchMomentPhotosRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return FetchMomentPhotosOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return FetchMomentPhotosOutcome(FetchMomentPhotosResult(outcome.result()));
else
return FetchMomentPhotosOutcome(outcome.error());
}
void CloudPhotoClient::fetchMomentPhotosAsync(const FetchMomentPhotosRequest& request, const FetchMomentPhotosAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, fetchMomentPhotos(request), context);
};
asyncExecute(new Runnable(fn));
}
CloudPhotoClient::FetchMomentPhotosOutcomeCallable CloudPhotoClient::fetchMomentPhotosCallable(const FetchMomentPhotosRequest &request) const
{
auto task = std::make_shared<std::packaged_task<FetchMomentPhotosOutcome()>>(
[this, request]()
{
return this->fetchMomentPhotos(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CloudPhotoClient::DeletePhotosOutcome CloudPhotoClient::deletePhotos(const DeletePhotosRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -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/FetchMomentPhotosRequest.h>
using AlibabaCloud::CloudPhoto::Model::FetchMomentPhotosRequest;
FetchMomentPhotosRequest::FetchMomentPhotosRequest() :
RpcServiceRequest("cloudphoto", "2017-07-11", "FetchMomentPhotos")
{}
FetchMomentPhotosRequest::~FetchMomentPhotosRequest()
{}
int FetchMomentPhotosRequest::getSize()const
{
return size_;
}
void FetchMomentPhotosRequest::setSize(int size)
{
size_ = size;
setParameter("Size", std::to_string(size));
}
std::string FetchMomentPhotosRequest::getLibraryId()const
{
return libraryId_;
}
void FetchMomentPhotosRequest::setLibraryId(const std::string& libraryId)
{
libraryId_ = libraryId;
setParameter("LibraryId", libraryId);
}
std::string FetchMomentPhotosRequest::getOrderBy()const
{
return orderBy_;
}
void FetchMomentPhotosRequest::setOrderBy(const std::string& orderBy)
{
orderBy_ = orderBy;
setParameter("OrderBy", orderBy);
}
std::string FetchMomentPhotosRequest::getStoreName()const
{
return storeName_;
}
void FetchMomentPhotosRequest::setStoreName(const std::string& storeName)
{
storeName_ = storeName;
setParameter("StoreName", storeName);
}
int FetchMomentPhotosRequest::getPage()const
{
return page_;
}
void FetchMomentPhotosRequest::setPage(int page)
{
page_ = page;
setParameter("Page", std::to_string(page));
}
long FetchMomentPhotosRequest::getMomentId()const
{
return momentId_;
}
void FetchMomentPhotosRequest::setMomentId(long momentId)
{
momentId_ = momentId;
setParameter("MomentId", std::to_string(momentId));
}
std::string FetchMomentPhotosRequest::getOrder()const
{
return order_;
}
void FetchMomentPhotosRequest::setOrder(const std::string& order)
{
order_ = order;
setParameter("Order", order);
}

View File

@@ -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/FetchMomentPhotosResult.h>
#include <json/json.h>
using namespace AlibabaCloud::CloudPhoto;
using namespace AlibabaCloud::CloudPhoto::Model;
FetchMomentPhotosResult::FetchMomentPhotosResult() :
ServiceResult()
{}
FetchMomentPhotosResult::FetchMomentPhotosResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
FetchMomentPhotosResult::~FetchMomentPhotosResult()
{}
void FetchMomentPhotosResult::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<FetchMomentPhotosResult::Photo> FetchMomentPhotosResult::getPhotos()const
{
return photos_;
}
int FetchMomentPhotosResult::getTotalCount()const
{
return totalCount_;
}
std::string FetchMomentPhotosResult::getAction()const
{
return action_;
}
std::string FetchMomentPhotosResult::getMessage()const
{
return message_;
}
std::string FetchMomentPhotosResult::getCode()const
{
return code_;
}

View File

@@ -52,6 +52,8 @@ void ListAlbumsResult::parse(const std::string &payload)
albumsObject.name = value["Name"].asString();
if(!value["State"].isNull())
albumsObject.state = value["State"].asString();
if(!value["Remark"].isNull())
albumsObject.remark = value["Remark"].asString();
if(!value["PhotosCount"].isNull())
albumsObject.photosCount = std::stol(value["PhotosCount"].asString());
if(!value["Ctime"].isNull())