This commit is contained in:
sdk-team
2023-04-27 09:21:28 +00:00
parent 6e851fd163
commit 4b1dc6a6c3
8 changed files with 297 additions and 1 deletions

View File

@@ -1023,6 +1023,42 @@ CC5GClient::ListBatchOperateCardsTasksOutcomeCallable CC5GClient::listBatchOpera
return task->get_future();
}
CC5GClient::ListCardDayUsagesOutcome CC5GClient::listCardDayUsages(const ListCardDayUsagesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ListCardDayUsagesOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ListCardDayUsagesOutcome(ListCardDayUsagesResult(outcome.result()));
else
return ListCardDayUsagesOutcome(outcome.error());
}
void CC5GClient::listCardDayUsagesAsync(const ListCardDayUsagesRequest& request, const ListCardDayUsagesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, listCardDayUsages(request), context);
};
asyncExecute(new Runnable(fn));
}
CC5GClient::ListCardDayUsagesOutcomeCallable CC5GClient::listCardDayUsagesCallable(const ListCardDayUsagesRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ListCardDayUsagesOutcome()>>(
[this, request]()
{
return this->listCardDayUsages(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CC5GClient::ListCardUsagesOutcome CC5GClient::listCardUsages(const ListCardUsagesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -0,0 +1,56 @@
/*
* 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/cc5g/model/ListCardDayUsagesRequest.h>
using AlibabaCloud::CC5G::Model::ListCardDayUsagesRequest;
ListCardDayUsagesRequest::ListCardDayUsagesRequest()
: RpcServiceRequest("cc5g", "2022-03-14", "ListCardDayUsages") {
setMethod(HttpRequest::Method::Get);
}
ListCardDayUsagesRequest::~ListCardDayUsagesRequest() {}
int ListCardDayUsagesRequest::getLatestMonthNum() const {
return latestMonthNum_;
}
void ListCardDayUsagesRequest::setLatestMonthNum(int latestMonthNum) {
latestMonthNum_ = latestMonthNum;
setParameter(std::string("LatestMonthNum"), std::to_string(latestMonthNum));
}
std::vector<ListCardDayUsagesRequest::std::string> ListCardDayUsagesRequest::getIccids() const {
return iccids_;
}
void ListCardDayUsagesRequest::setIccids(const std::vector<ListCardDayUsagesRequest::std::string> &iccids) {
iccids_ = iccids;
for(int dep1 = 0; dep1 != iccids.size(); dep1++) {
setParameter(std::string("Iccids") + "." + std::to_string(dep1 + 1), iccids[dep1]);
}
}
std::string ListCardDayUsagesRequest::getWirelessCloudConnectorId() const {
return wirelessCloudConnectorId_;
}
void ListCardDayUsagesRequest::setWirelessCloudConnectorId(const std::string &wirelessCloudConnectorId) {
wirelessCloudConnectorId_ = wirelessCloudConnectorId;
setParameter(std::string("WirelessCloudConnectorId"), wirelessCloudConnectorId);
}

View File

@@ -0,0 +1,77 @@
/*
* 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/cc5g/model/ListCardDayUsagesResult.h>
#include <json/json.h>
using namespace AlibabaCloud::CC5G;
using namespace AlibabaCloud::CC5G::Model;
ListCardDayUsagesResult::ListCardDayUsagesResult() :
ServiceResult()
{}
ListCardDayUsagesResult::ListCardDayUsagesResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ListCardDayUsagesResult::~ListCardDayUsagesResult()
{}
void ListCardDayUsagesResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allCardsNode = value["Cards"]["Card"];
for (auto valueCardsCard : allCardsNode)
{
Card cardsObject;
if(!valueCardsCard["Iccid"].isNull())
cardsObject.iccid = valueCardsCard["Iccid"].asString();
auto allUsageDataMonthsNode = valueCardsCard["UsageDataMonths"]["UsageDataMonth"];
for (auto valueCardsCardUsageDataMonthsUsageDataMonth : allUsageDataMonthsNode)
{
Card::UsageDataMonth usageDataMonthsObject;
if(!valueCardsCardUsageDataMonthsUsageDataMonth["UsageDataMonth"].isNull())
usageDataMonthsObject.usageDataMonth = valueCardsCardUsageDataMonthsUsageDataMonth["UsageDataMonth"].asString();
if(!valueCardsCardUsageDataMonthsUsageDataMonth["Month"].isNull())
usageDataMonthsObject.month = valueCardsCardUsageDataMonthsUsageDataMonth["Month"].asString();
auto allCardDayUsagesNode = valueCardsCardUsageDataMonthsUsageDataMonth["CardDayUsages"]["CardDayUsage"];
for (auto valueCardsCardUsageDataMonthsUsageDataMonthCardDayUsagesCardDayUsage : allCardDayUsagesNode)
{
Card::UsageDataMonth::CardDayUsage cardDayUsagesObject;
if(!valueCardsCardUsageDataMonthsUsageDataMonthCardDayUsagesCardDayUsage["Day"].isNull())
cardDayUsagesObject.day = valueCardsCardUsageDataMonthsUsageDataMonthCardDayUsagesCardDayUsage["Day"].asString();
if(!valueCardsCardUsageDataMonthsUsageDataMonthCardDayUsagesCardDayUsage["UsageData"].isNull())
cardDayUsagesObject.usageData = valueCardsCardUsageDataMonthsUsageDataMonthCardDayUsagesCardDayUsage["UsageData"].asString();
usageDataMonthsObject.cardDayUsages.push_back(cardDayUsagesObject);
}
cardsObject.usageDataMonths.push_back(usageDataMonthsObject);
}
cards_.push_back(cardsObject);
}
}
std::vector<ListCardDayUsagesResult::Card> ListCardDayUsagesResult::getCards()const
{
return cards_;
}