Release EvaluateCertificateQuality.
This commit is contained in:
@@ -159,6 +159,42 @@ ImagerecogClient::DetectImageElementsOutcomeCallable ImagerecogClient::detectIma
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
ImagerecogClient::EvaluateCertificateQualityOutcome ImagerecogClient::evaluateCertificateQuality(const EvaluateCertificateQualityRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return EvaluateCertificateQualityOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return EvaluateCertificateQualityOutcome(EvaluateCertificateQualityResult(outcome.result()));
|
||||
else
|
||||
return EvaluateCertificateQualityOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void ImagerecogClient::evaluateCertificateQualityAsync(const EvaluateCertificateQualityRequest& request, const EvaluateCertificateQualityAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, evaluateCertificateQuality(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
ImagerecogClient::EvaluateCertificateQualityOutcomeCallable ImagerecogClient::evaluateCertificateQualityCallable(const EvaluateCertificateQualityRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<EvaluateCertificateQualityOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->evaluateCertificateQuality(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
ImagerecogClient::RecognizeImageColorOutcome ImagerecogClient::recognizeImageColor(const RecognizeImageColorRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
51
imagerecog/src/model/EvaluateCertificateQualityRequest.cc
Normal file
51
imagerecog/src/model/EvaluateCertificateQualityRequest.cc
Normal 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/imagerecog/model/EvaluateCertificateQualityRequest.h>
|
||||
|
||||
using AlibabaCloud::Imagerecog::Model::EvaluateCertificateQualityRequest;
|
||||
|
||||
EvaluateCertificateQualityRequest::EvaluateCertificateQualityRequest() :
|
||||
RpcServiceRequest("imagerecog", "2019-09-30", "EvaluateCertificateQuality")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
EvaluateCertificateQualityRequest::~EvaluateCertificateQualityRequest()
|
||||
{}
|
||||
|
||||
std::string EvaluateCertificateQualityRequest::getType()const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
void EvaluateCertificateQualityRequest::setType(const std::string& type)
|
||||
{
|
||||
type_ = type;
|
||||
setBodyParameter("Type", type);
|
||||
}
|
||||
|
||||
std::string EvaluateCertificateQualityRequest::getImageURL()const
|
||||
{
|
||||
return imageURL_;
|
||||
}
|
||||
|
||||
void EvaluateCertificateQualityRequest::setImageURL(const std::string& imageURL)
|
||||
{
|
||||
imageURL_ = imageURL;
|
||||
setBodyParameter("ImageURL", imageURL);
|
||||
}
|
||||
|
||||
62
imagerecog/src/model/EvaluateCertificateQualityResult.cc
Normal file
62
imagerecog/src/model/EvaluateCertificateQualityResult.cc
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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/imagerecog/model/EvaluateCertificateQualityResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Imagerecog;
|
||||
using namespace AlibabaCloud::Imagerecog::Model;
|
||||
|
||||
EvaluateCertificateQualityResult::EvaluateCertificateQualityResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
EvaluateCertificateQualityResult::EvaluateCertificateQualityResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
EvaluateCertificateQualityResult::~EvaluateCertificateQualityResult()
|
||||
{}
|
||||
|
||||
void EvaluateCertificateQualityResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
auto allElementsNode = dataNode["Elements"]["Element"];
|
||||
for (auto dataNodeElementsElement : allElementsNode)
|
||||
{
|
||||
Data::Element elementObject;
|
||||
if(!dataNodeElementsElement["Value"].isNull())
|
||||
elementObject.value = dataNodeElementsElement["Value"].asString();
|
||||
if(!dataNodeElementsElement["Pass"].isNull())
|
||||
elementObject.pass = dataNodeElementsElement["Pass"].asString();
|
||||
if(!dataNodeElementsElement["Score"].isNull())
|
||||
elementObject.score = dataNodeElementsElement["Score"].asString();
|
||||
data_.elements.push_back(elementObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
EvaluateCertificateQualityResult::Data EvaluateCertificateQualityResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user