Quellcode durchsuchen

Support Open Service API.

sdk-team vor 6 Jahren
Ursprung
Commit
b31d71fa81

+ 3 - 0
CHANGELOG

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

+ 4 - 0
imm/CMakeLists.txt

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

+ 8 - 0
imm/include/alibabacloud/imm/ImmClient.h

@@ -156,6 +156,8 @@
 #include "model/ListVideoTasksResult.h"
 #include "model/ListVideosRequest.h"
 #include "model/ListVideosResult.h"
+#include "model/OpenImmServiceRequest.h"
+#include "model/OpenImmServiceResult.h"
 #include "model/PutProjectRequest.h"
 #include "model/PutProjectResult.h"
 #include "model/RefreshOfficeEditTokenRequest.h"
@@ -386,6 +388,9 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::ListVideosResult> ListVideosOutcome;
 			typedef std::future<ListVideosOutcome> ListVideosOutcomeCallable;
 			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 std::future<PutProjectOutcome> PutProjectOutcomeCallable;
 			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;
 			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;
+			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;
 			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;

+ 2 - 0
imm/include/alibabacloud/imm/model/GetDRMLicenseResult.h

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

+ 4 - 4
imm/include/alibabacloud/imm/model/GetVideoResult.h

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

+ 4 - 3
imm/include/alibabacloud/imm/model/ListVideosResult.h

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

+ 48 - 0
imm/include/alibabacloud/imm/model/OpenImmServiceRequest.h

@@ -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_

+ 51 - 0
imm/include/alibabacloud/imm/model/OpenImmServiceResult.h

@@ -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_

+ 39 - 3
imm/src/ImmClient.cc

@@ -31,21 +31,21 @@ ImmClient::ImmClient(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, "imm");
 }
 
 ImmClient::ImmClient(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, "imm");
 }
 
 ImmClient::ImmClient(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, "imm");
 }
 
 ImmClient::~ImmClient()
@@ -2463,6 +2463,42 @@ ImmClient::ListVideosOutcomeCallable ImmClient::listVideosCallable(const ListVid
 	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
 {
 	auto endpointOutcome = endpointProvider_->getEndpoint();

+ 7 - 0
imm/src/model/GetDRMLicenseResult.cc

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

+ 8 - 8
imm/src/model/GetVideoResult.cc

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

+ 8 - 6
imm/src/model/ListVideosResult.cc

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

+ 40 - 0
imm/src/model/OpenImmServiceRequest.cc

@@ -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));
+}
+

+ 51 - 0
imm/src/model/OpenImmServiceResult.cc

@@ -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_;
+}
+