Support Open Service API.

This commit is contained in:
sdk-team
2020-09-27 02:38:25 +00:00
parent 7ee07b8331
commit b31d71fa81
14 changed files with 277 additions and 24 deletions

View File

@@ -1,3 +1,6 @@
2020-09-27 Version: patch
- Support Open Service API.
2020-09-27 Version: patch 2020-09-27 Version: patch
- DescribeAvailableResource support list available resource for modify instance. - DescribeAvailableResource support list available resource for modify instance.

View File

@@ -155,6 +155,8 @@ set(imm_public_header_model
include/alibabacloud/imm/model/ListVideoTasksResult.h include/alibabacloud/imm/model/ListVideoTasksResult.h
include/alibabacloud/imm/model/ListVideosRequest.h include/alibabacloud/imm/model/ListVideosRequest.h
include/alibabacloud/imm/model/ListVideosResult.h include/alibabacloud/imm/model/ListVideosResult.h
include/alibabacloud/imm/model/OpenImmServiceRequest.h
include/alibabacloud/imm/model/OpenImmServiceResult.h
include/alibabacloud/imm/model/PutProjectRequest.h include/alibabacloud/imm/model/PutProjectRequest.h
include/alibabacloud/imm/model/PutProjectResult.h include/alibabacloud/imm/model/PutProjectResult.h
include/alibabacloud/imm/model/RefreshOfficeEditTokenRequest.h include/alibabacloud/imm/model/RefreshOfficeEditTokenRequest.h
@@ -312,6 +314,8 @@ set(imm_src
src/model/ListVideoTasksResult.cc src/model/ListVideoTasksResult.cc
src/model/ListVideosRequest.cc src/model/ListVideosRequest.cc
src/model/ListVideosResult.cc src/model/ListVideosResult.cc
src/model/OpenImmServiceRequest.cc
src/model/OpenImmServiceResult.cc
src/model/PutProjectRequest.cc src/model/PutProjectRequest.cc
src/model/PutProjectResult.cc src/model/PutProjectResult.cc
src/model/RefreshOfficeEditTokenRequest.cc src/model/RefreshOfficeEditTokenRequest.cc

View File

@@ -156,6 +156,8 @@
#include "model/ListVideoTasksResult.h" #include "model/ListVideoTasksResult.h"
#include "model/ListVideosRequest.h" #include "model/ListVideosRequest.h"
#include "model/ListVideosResult.h" #include "model/ListVideosResult.h"
#include "model/OpenImmServiceRequest.h"
#include "model/OpenImmServiceResult.h"
#include "model/PutProjectRequest.h" #include "model/PutProjectRequest.h"
#include "model/PutProjectResult.h" #include "model/PutProjectResult.h"
#include "model/RefreshOfficeEditTokenRequest.h" #include "model/RefreshOfficeEditTokenRequest.h"
@@ -386,6 +388,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::ListVideosResult> ListVideosOutcome; typedef Outcome<Error, Model::ListVideosResult> ListVideosOutcome;
typedef std::future<ListVideosOutcome> ListVideosOutcomeCallable; typedef std::future<ListVideosOutcome> ListVideosOutcomeCallable;
typedef std::function<void(const ImmClient*, const Model::ListVideosRequest&, const ListVideosOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListVideosAsyncHandler; typedef std::function<void(const ImmClient*, const Model::ListVideosRequest&, const ListVideosOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListVideosAsyncHandler;
typedef Outcome<Error, Model::OpenImmServiceResult> OpenImmServiceOutcome;
typedef std::future<OpenImmServiceOutcome> OpenImmServiceOutcomeCallable;
typedef std::function<void(const ImmClient*, const Model::OpenImmServiceRequest&, const OpenImmServiceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> OpenImmServiceAsyncHandler;
typedef Outcome<Error, Model::PutProjectResult> PutProjectOutcome; typedef Outcome<Error, Model::PutProjectResult> PutProjectOutcome;
typedef std::future<PutProjectOutcome> PutProjectOutcomeCallable; typedef std::future<PutProjectOutcome> PutProjectOutcomeCallable;
typedef std::function<void(const ImmClient*, const Model::PutProjectRequest&, const PutProjectOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> PutProjectAsyncHandler; typedef std::function<void(const ImmClient*, const Model::PutProjectRequest&, const PutProjectOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> PutProjectAsyncHandler;
@@ -622,6 +627,9 @@ namespace AlibabaCloud
ListVideosOutcome listVideos(const Model::ListVideosRequest &request)const; ListVideosOutcome listVideos(const Model::ListVideosRequest &request)const;
void listVideosAsync(const Model::ListVideosRequest& request, const ListVideosAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; void listVideosAsync(const Model::ListVideosRequest& request, const ListVideosAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ListVideosOutcomeCallable listVideosCallable(const Model::ListVideosRequest& request) const; ListVideosOutcomeCallable listVideosCallable(const Model::ListVideosRequest& request) const;
OpenImmServiceOutcome openImmService(const Model::OpenImmServiceRequest &request)const;
void openImmServiceAsync(const Model::OpenImmServiceRequest& request, const OpenImmServiceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
OpenImmServiceOutcomeCallable openImmServiceCallable(const Model::OpenImmServiceRequest& request) const;
PutProjectOutcome putProject(const Model::PutProjectRequest &request)const; PutProjectOutcome putProject(const Model::PutProjectRequest &request)const;
void putProjectAsync(const Model::PutProjectRequest& request, const PutProjectAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const; void putProjectAsync(const Model::PutProjectRequest& request, const PutProjectAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
PutProjectOutcomeCallable putProjectCallable(const Model::PutProjectRequest& request) const; PutProjectOutcomeCallable putProjectCallable(const Model::PutProjectRequest& request) const;

View File

@@ -37,11 +37,13 @@ namespace AlibabaCloud
GetDRMLicenseResult(); GetDRMLicenseResult();
explicit GetDRMLicenseResult(const std::string &payload); explicit GetDRMLicenseResult(const std::string &payload);
~GetDRMLicenseResult(); ~GetDRMLicenseResult();
std::string getDeviceInfo()const;
std::string getDRMData()const; std::string getDRMData()const;
protected: protected:
void parse(const std::string &payload); void parse(const std::string &payload);
private: private:
std::string deviceInfo_;
std::string dRMData_; std::string dRMData_;
}; };

View File

@@ -40,10 +40,10 @@ namespace AlibabaCloud
}; };
struct VideoTagsItem struct VideoTagsItem
{ {
std::string videoTagEnName; std::string tagName;
std::string videoTagName; float tagConfidence;
int videoTagLevel; int tagLevel;
float videoTagConfidence; std::string parentTagName;
}; };
struct PersonsItem struct PersonsItem
{ {

View File

@@ -36,9 +36,10 @@ namespace AlibabaCloud
{ {
struct VideoTagsItem struct VideoTagsItem
{ {
std::string videoTagEnName; std::string tagName;
std::string videoTagName; float tagConfidence;
float videoTagConfidence; int tagLevel;
std::string parentTagName;
}; };
struct CelebrityItem struct CelebrityItem
{ {

View File

@@ -0,0 +1,48 @@
/*
* 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_IMM_MODEL_OPENIMMSERVICEREQUEST_H_
#define ALIBABACLOUD_IMM_MODEL_OPENIMMSERVICEREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/imm/ImmExport.h>
namespace AlibabaCloud
{
namespace Imm
{
namespace Model
{
class ALIBABACLOUD_IMM_EXPORT OpenImmServiceRequest : public RpcServiceRequest
{
public:
OpenImmServiceRequest();
~OpenImmServiceRequest();
long getOwnerId()const;
void setOwnerId(long ownerId);
private:
long ownerId_;
};
}
}
}
#endif // !ALIBABACLOUD_IMM_MODEL_OPENIMMSERVICEREQUEST_H_

View File

@@ -0,0 +1,51 @@
/*
* 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_IMM_MODEL_OPENIMMSERVICERESULT_H_
#define ALIBABACLOUD_IMM_MODEL_OPENIMMSERVICERESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/imm/ImmExport.h>
namespace AlibabaCloud
{
namespace Imm
{
namespace Model
{
class ALIBABACLOUD_IMM_EXPORT OpenImmServiceResult : public ServiceResult
{
public:
OpenImmServiceResult();
explicit OpenImmServiceResult(const std::string &payload);
~OpenImmServiceResult();
std::string getOrderId()const;
protected:
void parse(const std::string &payload);
private:
std::string orderId_;
};
}
}
}
#endif // !ALIBABACLOUD_IMM_MODEL_OPENIMMSERVICERESULT_H_

View File

@@ -31,21 +31,21 @@ ImmClient::ImmClient(const Credentials &credentials, const ClientConfiguration &
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration) RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
{ {
auto locationClient = std::make_shared<LocationClient>(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, "imm");
} }
ImmClient::ImmClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) : ImmClient::ImmClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
{ {
auto locationClient = std::make_shared<LocationClient>(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, "imm");
} }
ImmClient::ImmClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : ImmClient::ImmClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration) RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
{ {
auto locationClient = std::make_shared<LocationClient>(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, "imm");
} }
ImmClient::~ImmClient() ImmClient::~ImmClient()
@@ -2463,6 +2463,42 @@ ImmClient::ListVideosOutcomeCallable ImmClient::listVideosCallable(const ListVid
return task->get_future(); return task->get_future();
} }
ImmClient::OpenImmServiceOutcome ImmClient::openImmService(const OpenImmServiceRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return OpenImmServiceOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return OpenImmServiceOutcome(OpenImmServiceResult(outcome.result()));
else
return OpenImmServiceOutcome(outcome.error());
}
void ImmClient::openImmServiceAsync(const OpenImmServiceRequest& request, const OpenImmServiceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, openImmService(request), context);
};
asyncExecute(new Runnable(fn));
}
ImmClient::OpenImmServiceOutcomeCallable ImmClient::openImmServiceCallable(const OpenImmServiceRequest &request) const
{
auto task = std::make_shared<std::packaged_task<OpenImmServiceOutcome()>>(
[this, request]()
{
return this->openImmService(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ImmClient::PutProjectOutcome ImmClient::putProject(const PutProjectRequest &request) const ImmClient::PutProjectOutcome ImmClient::putProject(const PutProjectRequest &request) const
{ {
auto endpointOutcome = endpointProvider_->getEndpoint(); auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -41,9 +41,16 @@ void GetDRMLicenseResult::parse(const std::string &payload)
setRequestId(value["RequestId"].asString()); setRequestId(value["RequestId"].asString());
if(!value["DRMData"].isNull()) if(!value["DRMData"].isNull())
dRMData_ = value["DRMData"].asString(); dRMData_ = value["DRMData"].asString();
if(!value["DeviceInfo"].isNull())
deviceInfo_ = value["DeviceInfo"].asString();
} }
std::string GetDRMLicenseResult::getDeviceInfo()const
{
return deviceInfo_;
}
std::string GetDRMLicenseResult::getDRMData()const std::string GetDRMLicenseResult::getDRMData()const
{ {
return dRMData_; return dRMData_;

View File

@@ -55,14 +55,14 @@ void GetVideoResult::parse(const std::string &payload)
for (auto valueVideoTagsVideoTagsItem : allVideoTagsNode) for (auto valueVideoTagsVideoTagsItem : allVideoTagsNode)
{ {
VideoTagsItem videoTagsObject; VideoTagsItem videoTagsObject;
if(!valueVideoTagsVideoTagsItem["VideoTagName"].isNull()) if(!valueVideoTagsVideoTagsItem["TagName"].isNull())
videoTagsObject.videoTagName = valueVideoTagsVideoTagsItem["VideoTagName"].asString(); videoTagsObject.tagName = valueVideoTagsVideoTagsItem["TagName"].asString();
if(!valueVideoTagsVideoTagsItem["VideoTagEnName"].isNull()) if(!valueVideoTagsVideoTagsItem["ParentTagName"].isNull())
videoTagsObject.videoTagEnName = valueVideoTagsVideoTagsItem["VideoTagEnName"].asString(); videoTagsObject.parentTagName = valueVideoTagsVideoTagsItem["ParentTagName"].asString();
if(!valueVideoTagsVideoTagsItem["VideoTagConfidence"].isNull()) if(!valueVideoTagsVideoTagsItem["TagConfidence"].isNull())
videoTagsObject.videoTagConfidence = std::stof(valueVideoTagsVideoTagsItem["VideoTagConfidence"].asString()); videoTagsObject.tagConfidence = std::stof(valueVideoTagsVideoTagsItem["TagConfidence"].asString());
if(!valueVideoTagsVideoTagsItem["VideoTagLevel"].isNull()) if(!valueVideoTagsVideoTagsItem["TagLevel"].isNull())
videoTagsObject.videoTagLevel = std::stoi(valueVideoTagsVideoTagsItem["VideoTagLevel"].asString()); videoTagsObject.tagLevel = std::stoi(valueVideoTagsVideoTagsItem["TagLevel"].asString());
videoTags_.push_back(videoTagsObject); videoTags_.push_back(videoTagsObject);
} }
auto allPersonsNode = value["Persons"]["PersonsItem"]; auto allPersonsNode = value["Persons"]["PersonsItem"];

View File

@@ -99,12 +99,14 @@ void ListVideosResult::parse(const std::string &payload)
for (auto allVideosNodeVideoTagsVideoTagsItem : allVideoTagsNode) for (auto allVideosNodeVideoTagsVideoTagsItem : allVideoTagsNode)
{ {
VideosItem::VideoTagsItem videoTagsObject; VideosItem::VideoTagsItem videoTagsObject;
if(!allVideosNodeVideoTagsVideoTagsItem["VideoTagName"].isNull()) if(!allVideosNodeVideoTagsVideoTagsItem["TagName"].isNull())
videoTagsObject.videoTagName = allVideosNodeVideoTagsVideoTagsItem["VideoTagName"].asString(); videoTagsObject.tagName = allVideosNodeVideoTagsVideoTagsItem["TagName"].asString();
if(!allVideosNodeVideoTagsVideoTagsItem["VideoTagEnName"].isNull()) if(!allVideosNodeVideoTagsVideoTagsItem["ParentTagName"].isNull())
videoTagsObject.videoTagEnName = allVideosNodeVideoTagsVideoTagsItem["VideoTagEnName"].asString(); videoTagsObject.parentTagName = allVideosNodeVideoTagsVideoTagsItem["ParentTagName"].asString();
if(!allVideosNodeVideoTagsVideoTagsItem["VideoTagConfidence"].isNull()) if(!allVideosNodeVideoTagsVideoTagsItem["TagConfidence"].isNull())
videoTagsObject.videoTagConfidence = std::stof(allVideosNodeVideoTagsVideoTagsItem["VideoTagConfidence"].asString()); videoTagsObject.tagConfidence = std::stof(allVideosNodeVideoTagsVideoTagsItem["TagConfidence"].asString());
if(!allVideosNodeVideoTagsVideoTagsItem["TagLevel"].isNull())
videoTagsObject.tagLevel = std::stoi(allVideosNodeVideoTagsVideoTagsItem["TagLevel"].asString());
videosObject.videoTags.push_back(videoTagsObject); videosObject.videoTags.push_back(videoTagsObject);
} }
auto allCelebrityNode = allVideosNode["Celebrity"]["CelebrityItem"]; auto allCelebrityNode = allVideosNode["Celebrity"]["CelebrityItem"];

View File

@@ -0,0 +1,40 @@
/*
* 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/imm/model/OpenImmServiceRequest.h>
using AlibabaCloud::Imm::Model::OpenImmServiceRequest;
OpenImmServiceRequest::OpenImmServiceRequest() :
RpcServiceRequest("imm", "2017-09-06", "OpenImmService")
{
setMethod(HttpRequest::Method::Post);
}
OpenImmServiceRequest::~OpenImmServiceRequest()
{}
long OpenImmServiceRequest::getOwnerId()const
{
return ownerId_;
}
void OpenImmServiceRequest::setOwnerId(long ownerId)
{
ownerId_ = ownerId;
setParameter("OwnerId", std::to_string(ownerId));
}

View File

@@ -0,0 +1,51 @@
/*
* 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/imm/model/OpenImmServiceResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Imm;
using namespace AlibabaCloud::Imm::Model;
OpenImmServiceResult::OpenImmServiceResult() :
ServiceResult()
{}
OpenImmServiceResult::OpenImmServiceResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
OpenImmServiceResult::~OpenImmServiceResult()
{}
void OpenImmServiceResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["OrderId"].isNull())
orderId_ = value["OrderId"].asString();
}
std::string OpenImmServiceResult::getOrderId()const
{
return orderId_;
}