Add SmartqQueryAbility api.
This commit is contained in:
@@ -211,6 +211,8 @@ set(quickbi-public_public_header_model
|
||||
include/alibabacloud/quickbi-public/model/SetDataLevelPermissionRuleConfigResult.h
|
||||
include/alibabacloud/quickbi-public/model/SetDataLevelPermissionWhiteListRequest.h
|
||||
include/alibabacloud/quickbi-public/model/SetDataLevelPermissionWhiteListResult.h
|
||||
include/alibabacloud/quickbi-public/model/SmartqQueryAbilityRequest.h
|
||||
include/alibabacloud/quickbi-public/model/SmartqQueryAbilityResult.h
|
||||
include/alibabacloud/quickbi-public/model/UpdateDataLevelPermissionStatusRequest.h
|
||||
include/alibabacloud/quickbi-public/model/UpdateDataLevelPermissionStatusResult.h
|
||||
include/alibabacloud/quickbi-public/model/UpdateEmbeddedStatusRequest.h
|
||||
@@ -424,6 +426,8 @@ set(quickbi-public_src
|
||||
src/model/SetDataLevelPermissionRuleConfigResult.cc
|
||||
src/model/SetDataLevelPermissionWhiteListRequest.cc
|
||||
src/model/SetDataLevelPermissionWhiteListResult.cc
|
||||
src/model/SmartqQueryAbilityRequest.cc
|
||||
src/model/SmartqQueryAbilityResult.cc
|
||||
src/model/UpdateDataLevelPermissionStatusRequest.cc
|
||||
src/model/UpdateDataLevelPermissionStatusResult.cc
|
||||
src/model/UpdateEmbeddedStatusRequest.cc
|
||||
|
||||
@@ -212,6 +212,8 @@
|
||||
#include "model/SetDataLevelPermissionRuleConfigResult.h"
|
||||
#include "model/SetDataLevelPermissionWhiteListRequest.h"
|
||||
#include "model/SetDataLevelPermissionWhiteListResult.h"
|
||||
#include "model/SmartqQueryAbilityRequest.h"
|
||||
#include "model/SmartqQueryAbilityResult.h"
|
||||
#include "model/UpdateDataLevelPermissionStatusRequest.h"
|
||||
#include "model/UpdateDataLevelPermissionStatusResult.h"
|
||||
#include "model/UpdateEmbeddedStatusRequest.h"
|
||||
@@ -526,6 +528,9 @@ namespace AlibabaCloud
|
||||
typedef Outcome<Error, Model::SetDataLevelPermissionWhiteListResult> SetDataLevelPermissionWhiteListOutcome;
|
||||
typedef std::future<SetDataLevelPermissionWhiteListOutcome> SetDataLevelPermissionWhiteListOutcomeCallable;
|
||||
typedef std::function<void(const Quickbi_publicClient*, const Model::SetDataLevelPermissionWhiteListRequest&, const SetDataLevelPermissionWhiteListOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SetDataLevelPermissionWhiteListAsyncHandler;
|
||||
typedef Outcome<Error, Model::SmartqQueryAbilityResult> SmartqQueryAbilityOutcome;
|
||||
typedef std::future<SmartqQueryAbilityOutcome> SmartqQueryAbilityOutcomeCallable;
|
||||
typedef std::function<void(const Quickbi_publicClient*, const Model::SmartqQueryAbilityRequest&, const SmartqQueryAbilityOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SmartqQueryAbilityAsyncHandler;
|
||||
typedef Outcome<Error, Model::UpdateDataLevelPermissionStatusResult> UpdateDataLevelPermissionStatusOutcome;
|
||||
typedef std::future<UpdateDataLevelPermissionStatusOutcome> UpdateDataLevelPermissionStatusOutcomeCallable;
|
||||
typedef std::function<void(const Quickbi_publicClient*, const Model::UpdateDataLevelPermissionStatusRequest&, const UpdateDataLevelPermissionStatusOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UpdateDataLevelPermissionStatusAsyncHandler;
|
||||
@@ -846,6 +851,9 @@ namespace AlibabaCloud
|
||||
SetDataLevelPermissionWhiteListOutcome setDataLevelPermissionWhiteList(const Model::SetDataLevelPermissionWhiteListRequest &request)const;
|
||||
void setDataLevelPermissionWhiteListAsync(const Model::SetDataLevelPermissionWhiteListRequest& request, const SetDataLevelPermissionWhiteListAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
SetDataLevelPermissionWhiteListOutcomeCallable setDataLevelPermissionWhiteListCallable(const Model::SetDataLevelPermissionWhiteListRequest& request) const;
|
||||
SmartqQueryAbilityOutcome smartqQueryAbility(const Model::SmartqQueryAbilityRequest &request)const;
|
||||
void smartqQueryAbilityAsync(const Model::SmartqQueryAbilityRequest& request, const SmartqQueryAbilityAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
SmartqQueryAbilityOutcomeCallable smartqQueryAbilityCallable(const Model::SmartqQueryAbilityRequest& request) const;
|
||||
UpdateDataLevelPermissionStatusOutcome updateDataLevelPermissionStatus(const Model::UpdateDataLevelPermissionStatusRequest &request)const;
|
||||
void updateDataLevelPermissionStatusAsync(const Model::UpdateDataLevelPermissionStatusRequest& request, const UpdateDataLevelPermissionStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
UpdateDataLevelPermissionStatusOutcomeCallable updateDataLevelPermissionStatusCallable(const Model::UpdateDataLevelPermissionStatusRequest& request) const;
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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_QUICKBI_PUBLIC_MODEL_SMARTQQUERYABILITYREQUEST_H_
|
||||
#define ALIBABACLOUD_QUICKBI_PUBLIC_MODEL_SMARTQQUERYABILITYREQUEST_H_
|
||||
|
||||
#include <alibabacloud/quickbi-public/Quickbi_publicExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace Quickbi_public {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_QUICKBI_PUBLIC_EXPORT SmartqQueryAbilityRequest : public RpcServiceRequest {
|
||||
public:
|
||||
SmartqQueryAbilityRequest();
|
||||
~SmartqQueryAbilityRequest();
|
||||
std::string getAccessPoint() const;
|
||||
void setAccessPoint(const std::string &accessPoint);
|
||||
std::string getSignType() const;
|
||||
void setSignType(const std::string &signType);
|
||||
std::string getUserId() const;
|
||||
void setUserId(const std::string &userId);
|
||||
std::string getUserQuestion() const;
|
||||
void setUserQuestion(const std::string &userQuestion);
|
||||
std::string getCubeId() const;
|
||||
void setCubeId(const std::string &cubeId);
|
||||
|
||||
private:
|
||||
std::string accessPoint_;
|
||||
std::string signType_;
|
||||
std::string userId_;
|
||||
std::string userQuestion_;
|
||||
std::string cubeId_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace Quickbi_public
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_QUICKBI_PUBLIC_MODEL_SMARTQQUERYABILITYREQUEST_H_
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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_QUICKBI_PUBLIC_MODEL_SMARTQQUERYABILITYRESULT_H_
|
||||
#define ALIBABACLOUD_QUICKBI_PUBLIC_MODEL_SMARTQQUERYABILITYRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/quickbi-public/Quickbi_publicExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Quickbi_public
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_QUICKBI_PUBLIC_EXPORT SmartqQueryAbilityResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
struct Result
|
||||
{
|
||||
struct MetaTypeItem
|
||||
{
|
||||
std::string value;
|
||||
std::string key;
|
||||
};
|
||||
struct ValuesItem
|
||||
{
|
||||
std::vector<std::string> row;
|
||||
};
|
||||
std::vector<ValuesItem> values;
|
||||
std::string chartType;
|
||||
std::vector<MetaTypeItem> metaType;
|
||||
};
|
||||
|
||||
|
||||
SmartqQueryAbilityResult();
|
||||
explicit SmartqQueryAbilityResult(const std::string &payload);
|
||||
~SmartqQueryAbilityResult();
|
||||
bool getSuccess()const;
|
||||
Result getResult()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
bool success_;
|
||||
Result result_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_QUICKBI_PUBLIC_MODEL_SMARTQQUERYABILITYRESULT_H_
|
||||
@@ -3471,6 +3471,42 @@ Quickbi_publicClient::SetDataLevelPermissionWhiteListOutcomeCallable Quickbi_pub
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
Quickbi_publicClient::SmartqQueryAbilityOutcome Quickbi_publicClient::smartqQueryAbility(const SmartqQueryAbilityRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return SmartqQueryAbilityOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return SmartqQueryAbilityOutcome(SmartqQueryAbilityResult(outcome.result()));
|
||||
else
|
||||
return SmartqQueryAbilityOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void Quickbi_publicClient::smartqQueryAbilityAsync(const SmartqQueryAbilityRequest& request, const SmartqQueryAbilityAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, smartqQueryAbility(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
Quickbi_publicClient::SmartqQueryAbilityOutcomeCallable Quickbi_publicClient::smartqQueryAbilityCallable(const SmartqQueryAbilityRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<SmartqQueryAbilityOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->smartqQueryAbility(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
Quickbi_publicClient::UpdateDataLevelPermissionStatusOutcome Quickbi_publicClient::updateDataLevelPermissionStatus(const UpdateDataLevelPermissionStatusRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
72
quickbi-public/src/model/SmartqQueryAbilityRequest.cc
Normal file
72
quickbi-public/src/model/SmartqQueryAbilityRequest.cc
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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/quickbi-public/model/SmartqQueryAbilityRequest.h>
|
||||
|
||||
using AlibabaCloud::Quickbi_public::Model::SmartqQueryAbilityRequest;
|
||||
|
||||
SmartqQueryAbilityRequest::SmartqQueryAbilityRequest()
|
||||
: RpcServiceRequest("quickbi-public", "2022-01-01", "SmartqQueryAbility") {
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
SmartqQueryAbilityRequest::~SmartqQueryAbilityRequest() {}
|
||||
|
||||
std::string SmartqQueryAbilityRequest::getAccessPoint() const {
|
||||
return accessPoint_;
|
||||
}
|
||||
|
||||
void SmartqQueryAbilityRequest::setAccessPoint(const std::string &accessPoint) {
|
||||
accessPoint_ = accessPoint;
|
||||
setParameter(std::string("AccessPoint"), accessPoint);
|
||||
}
|
||||
|
||||
std::string SmartqQueryAbilityRequest::getSignType() const {
|
||||
return signType_;
|
||||
}
|
||||
|
||||
void SmartqQueryAbilityRequest::setSignType(const std::string &signType) {
|
||||
signType_ = signType;
|
||||
setParameter(std::string("SignType"), signType);
|
||||
}
|
||||
|
||||
std::string SmartqQueryAbilityRequest::getUserId() const {
|
||||
return userId_;
|
||||
}
|
||||
|
||||
void SmartqQueryAbilityRequest::setUserId(const std::string &userId) {
|
||||
userId_ = userId;
|
||||
setParameter(std::string("UserId"), userId);
|
||||
}
|
||||
|
||||
std::string SmartqQueryAbilityRequest::getUserQuestion() const {
|
||||
return userQuestion_;
|
||||
}
|
||||
|
||||
void SmartqQueryAbilityRequest::setUserQuestion(const std::string &userQuestion) {
|
||||
userQuestion_ = userQuestion;
|
||||
setParameter(std::string("UserQuestion"), userQuestion);
|
||||
}
|
||||
|
||||
std::string SmartqQueryAbilityRequest::getCubeId() const {
|
||||
return cubeId_;
|
||||
}
|
||||
|
||||
void SmartqQueryAbilityRequest::setCubeId(const std::string &cubeId) {
|
||||
cubeId_ = cubeId;
|
||||
setParameter(std::string("CubeId"), cubeId);
|
||||
}
|
||||
|
||||
78
quickbi-public/src/model/SmartqQueryAbilityResult.cc
Normal file
78
quickbi-public/src/model/SmartqQueryAbilityResult.cc
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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/quickbi-public/model/SmartqQueryAbilityResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Quickbi_public;
|
||||
using namespace AlibabaCloud::Quickbi_public::Model;
|
||||
|
||||
SmartqQueryAbilityResult::SmartqQueryAbilityResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
SmartqQueryAbilityResult::SmartqQueryAbilityResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
SmartqQueryAbilityResult::~SmartqQueryAbilityResult()
|
||||
{}
|
||||
|
||||
void SmartqQueryAbilityResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto resultNode = value["Result"];
|
||||
if(!resultNode["ChartType"].isNull())
|
||||
result_.chartType = resultNode["ChartType"].asString();
|
||||
auto allMetaTypeNode = resultNode["MetaType"]["MetaTypeItem"];
|
||||
for (auto resultNodeMetaTypeMetaTypeItem : allMetaTypeNode)
|
||||
{
|
||||
Result::MetaTypeItem metaTypeItemObject;
|
||||
if(!resultNodeMetaTypeMetaTypeItem["Key"].isNull())
|
||||
metaTypeItemObject.key = resultNodeMetaTypeMetaTypeItem["Key"].asString();
|
||||
if(!resultNodeMetaTypeMetaTypeItem["Value"].isNull())
|
||||
metaTypeItemObject.value = resultNodeMetaTypeMetaTypeItem["Value"].asString();
|
||||
result_.metaType.push_back(metaTypeItemObject);
|
||||
}
|
||||
auto allValuesNode = resultNode["Values"]["ValuesItem"];
|
||||
for (auto resultNodeValuesValuesItem : allValuesNode)
|
||||
{
|
||||
Result::ValuesItem valuesItemObject;
|
||||
auto allRow = value["Row"]["Row"];
|
||||
for (auto value : allRow)
|
||||
valuesItemObject.row.push_back(value.asString());
|
||||
result_.values.push_back(valuesItemObject);
|
||||
}
|
||||
if(!value["Success"].isNull())
|
||||
success_ = value["Success"].asString() == "true";
|
||||
|
||||
}
|
||||
|
||||
bool SmartqQueryAbilityResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
SmartqQueryAbilityResult::Result SmartqQueryAbilityResult::getResult()const
|
||||
{
|
||||
return result_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user