2 Star 8 Fork 1

tencentcloud/tencentcloud-sdk-cpp

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
SmhClient.cpp 18.04 KB
一键复制 编辑 原始数据 按行查看 历史
tencentcloud 提交于 2026-04-06 03:18 +08:00 . release 3.3.71
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
/*
* Copyright (c) 2017-2025 Tencent. 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 <tencentcloud/smh/v20210712/SmhClient.h>
#include <tencentcloud/core/Executor.h>
#include <tencentcloud/core/Runnable.h>
using namespace TencentCloud;
using namespace TencentCloud::Smh::V20210712;
using namespace TencentCloud::Smh::V20210712::Model;
using namespace std;
namespace
{
const string VERSION = "2021-07-12";
const string ENDPOINT = "smh.tencentcloudapi.com";
}
SmhClient::SmhClient(const Credential &credential, const string &region) :
SmhClient(credential, region, ClientProfile())
{
}
SmhClient::SmhClient(const Credential &credential, const string &region, const ClientProfile &profile) :
AbstractClient(ENDPOINT, VERSION, credential, region, profile)
{
}
SmhClient::CreateLibraryOutcome SmhClient::CreateLibrary(const CreateLibraryRequest &request)
{
auto outcome = MakeRequest(request, "CreateLibrary");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateLibraryResponse rsp = CreateLibraryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateLibraryOutcome(rsp);
else
return CreateLibraryOutcome(o.GetError());
}
else
{
return CreateLibraryOutcome(outcome.GetError());
}
}
void SmhClient::CreateLibraryAsync(const CreateLibraryRequest& request, const CreateLibraryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const CreateLibraryRequest&;
using Resp = CreateLibraryResponse;
DoRequestAsync<Req, Resp>(
"CreateLibrary", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
SmhClient::CreateLibraryOutcomeCallable SmhClient::CreateLibraryCallable(const CreateLibraryRequest &request)
{
const auto prom = std::make_shared<std::promise<CreateLibraryOutcome>>();
CreateLibraryAsync(
request,
[prom](
const SmhClient*,
const CreateLibraryRequest&,
CreateLibraryOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
SmhClient::DeleteLibraryOutcome SmhClient::DeleteLibrary(const DeleteLibraryRequest &request)
{
auto outcome = MakeRequest(request, "DeleteLibrary");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteLibraryResponse rsp = DeleteLibraryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteLibraryOutcome(rsp);
else
return DeleteLibraryOutcome(o.GetError());
}
else
{
return DeleteLibraryOutcome(outcome.GetError());
}
}
void SmhClient::DeleteLibraryAsync(const DeleteLibraryRequest& request, const DeleteLibraryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const DeleteLibraryRequest&;
using Resp = DeleteLibraryResponse;
DoRequestAsync<Req, Resp>(
"DeleteLibrary", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
SmhClient::DeleteLibraryOutcomeCallable SmhClient::DeleteLibraryCallable(const DeleteLibraryRequest &request)
{
const auto prom = std::make_shared<std::promise<DeleteLibraryOutcome>>();
DeleteLibraryAsync(
request,
[prom](
const SmhClient*,
const DeleteLibraryRequest&,
DeleteLibraryOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
SmhClient::DescribeLibrariesOutcome SmhClient::DescribeLibraries(const DescribeLibrariesRequest &request)
{
auto outcome = MakeRequest(request, "DescribeLibraries");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeLibrariesResponse rsp = DescribeLibrariesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeLibrariesOutcome(rsp);
else
return DescribeLibrariesOutcome(o.GetError());
}
else
{
return DescribeLibrariesOutcome(outcome.GetError());
}
}
void SmhClient::DescribeLibrariesAsync(const DescribeLibrariesRequest& request, const DescribeLibrariesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const DescribeLibrariesRequest&;
using Resp = DescribeLibrariesResponse;
DoRequestAsync<Req, Resp>(
"DescribeLibraries", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
SmhClient::DescribeLibrariesOutcomeCallable SmhClient::DescribeLibrariesCallable(const DescribeLibrariesRequest &request)
{
const auto prom = std::make_shared<std::promise<DescribeLibrariesOutcome>>();
DescribeLibrariesAsync(
request,
[prom](
const SmhClient*,
const DescribeLibrariesRequest&,
DescribeLibrariesOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
SmhClient::DescribeLibrarySecretOutcome SmhClient::DescribeLibrarySecret(const DescribeLibrarySecretRequest &request)
{
auto outcome = MakeRequest(request, "DescribeLibrarySecret");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeLibrarySecretResponse rsp = DescribeLibrarySecretResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeLibrarySecretOutcome(rsp);
else
return DescribeLibrarySecretOutcome(o.GetError());
}
else
{
return DescribeLibrarySecretOutcome(outcome.GetError());
}
}
void SmhClient::DescribeLibrarySecretAsync(const DescribeLibrarySecretRequest& request, const DescribeLibrarySecretAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const DescribeLibrarySecretRequest&;
using Resp = DescribeLibrarySecretResponse;
DoRequestAsync<Req, Resp>(
"DescribeLibrarySecret", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
SmhClient::DescribeLibrarySecretOutcomeCallable SmhClient::DescribeLibrarySecretCallable(const DescribeLibrarySecretRequest &request)
{
const auto prom = std::make_shared<std::promise<DescribeLibrarySecretOutcome>>();
DescribeLibrarySecretAsync(
request,
[prom](
const SmhClient*,
const DescribeLibrarySecretRequest&,
DescribeLibrarySecretOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
SmhClient::DescribeOfficialInstancesOutcome SmhClient::DescribeOfficialInstances(const DescribeOfficialInstancesRequest &request)
{
auto outcome = MakeRequest(request, "DescribeOfficialInstances");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeOfficialInstancesResponse rsp = DescribeOfficialInstancesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeOfficialInstancesOutcome(rsp);
else
return DescribeOfficialInstancesOutcome(o.GetError());
}
else
{
return DescribeOfficialInstancesOutcome(outcome.GetError());
}
}
void SmhClient::DescribeOfficialInstancesAsync(const DescribeOfficialInstancesRequest& request, const DescribeOfficialInstancesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const DescribeOfficialInstancesRequest&;
using Resp = DescribeOfficialInstancesResponse;
DoRequestAsync<Req, Resp>(
"DescribeOfficialInstances", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
SmhClient::DescribeOfficialInstancesOutcomeCallable SmhClient::DescribeOfficialInstancesCallable(const DescribeOfficialInstancesRequest &request)
{
const auto prom = std::make_shared<std::promise<DescribeOfficialInstancesOutcome>>();
DescribeOfficialInstancesAsync(
request,
[prom](
const SmhClient*,
const DescribeOfficialInstancesRequest&,
DescribeOfficialInstancesOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
SmhClient::DescribeOfficialOverviewOutcome SmhClient::DescribeOfficialOverview(const DescribeOfficialOverviewRequest &request)
{
auto outcome = MakeRequest(request, "DescribeOfficialOverview");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeOfficialOverviewResponse rsp = DescribeOfficialOverviewResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeOfficialOverviewOutcome(rsp);
else
return DescribeOfficialOverviewOutcome(o.GetError());
}
else
{
return DescribeOfficialOverviewOutcome(outcome.GetError());
}
}
void SmhClient::DescribeOfficialOverviewAsync(const DescribeOfficialOverviewRequest& request, const DescribeOfficialOverviewAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const DescribeOfficialOverviewRequest&;
using Resp = DescribeOfficialOverviewResponse;
DoRequestAsync<Req, Resp>(
"DescribeOfficialOverview", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
SmhClient::DescribeOfficialOverviewOutcomeCallable SmhClient::DescribeOfficialOverviewCallable(const DescribeOfficialOverviewRequest &request)
{
const auto prom = std::make_shared<std::promise<DescribeOfficialOverviewOutcome>>();
DescribeOfficialOverviewAsync(
request,
[prom](
const SmhClient*,
const DescribeOfficialOverviewRequest&,
DescribeOfficialOverviewOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
SmhClient::DescribeTrafficPackagesOutcome SmhClient::DescribeTrafficPackages(const DescribeTrafficPackagesRequest &request)
{
auto outcome = MakeRequest(request, "DescribeTrafficPackages");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeTrafficPackagesResponse rsp = DescribeTrafficPackagesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeTrafficPackagesOutcome(rsp);
else
return DescribeTrafficPackagesOutcome(o.GetError());
}
else
{
return DescribeTrafficPackagesOutcome(outcome.GetError());
}
}
void SmhClient::DescribeTrafficPackagesAsync(const DescribeTrafficPackagesRequest& request, const DescribeTrafficPackagesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const DescribeTrafficPackagesRequest&;
using Resp = DescribeTrafficPackagesResponse;
DoRequestAsync<Req, Resp>(
"DescribeTrafficPackages", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
SmhClient::DescribeTrafficPackagesOutcomeCallable SmhClient::DescribeTrafficPackagesCallable(const DescribeTrafficPackagesRequest &request)
{
const auto prom = std::make_shared<std::promise<DescribeTrafficPackagesOutcome>>();
DescribeTrafficPackagesAsync(
request,
[prom](
const SmhClient*,
const DescribeTrafficPackagesRequest&,
DescribeTrafficPackagesOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
SmhClient::ModifyLibraryOutcome SmhClient::ModifyLibrary(const ModifyLibraryRequest &request)
{
auto outcome = MakeRequest(request, "ModifyLibrary");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ModifyLibraryResponse rsp = ModifyLibraryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ModifyLibraryOutcome(rsp);
else
return ModifyLibraryOutcome(o.GetError());
}
else
{
return ModifyLibraryOutcome(outcome.GetError());
}
}
void SmhClient::ModifyLibraryAsync(const ModifyLibraryRequest& request, const ModifyLibraryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const ModifyLibraryRequest&;
using Resp = ModifyLibraryResponse;
DoRequestAsync<Req, Resp>(
"ModifyLibrary", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
SmhClient::ModifyLibraryOutcomeCallable SmhClient::ModifyLibraryCallable(const ModifyLibraryRequest &request)
{
const auto prom = std::make_shared<std::promise<ModifyLibraryOutcome>>();
ModifyLibraryAsync(
request,
[prom](
const SmhClient*,
const ModifyLibraryRequest&,
ModifyLibraryOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
SmhClient::SendSmsCodeOutcome SmhClient::SendSmsCode(const SendSmsCodeRequest &request)
{
auto outcome = MakeRequest(request, "SendSmsCode");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
SendSmsCodeResponse rsp = SendSmsCodeResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return SendSmsCodeOutcome(rsp);
else
return SendSmsCodeOutcome(o.GetError());
}
else
{
return SendSmsCodeOutcome(outcome.GetError());
}
}
void SmhClient::SendSmsCodeAsync(const SendSmsCodeRequest& request, const SendSmsCodeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const SendSmsCodeRequest&;
using Resp = SendSmsCodeResponse;
DoRequestAsync<Req, Resp>(
"SendSmsCode", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
SmhClient::SendSmsCodeOutcomeCallable SmhClient::SendSmsCodeCallable(const SendSmsCodeRequest &request)
{
const auto prom = std::make_shared<std::promise<SendSmsCodeOutcome>>();
SendSmsCodeAsync(
request,
[prom](
const SmhClient*,
const SendSmsCodeRequest&,
SendSmsCodeOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
SmhClient::VerifySmsCodeOutcome SmhClient::VerifySmsCode(const VerifySmsCodeRequest &request)
{
auto outcome = MakeRequest(request, "VerifySmsCode");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
VerifySmsCodeResponse rsp = VerifySmsCodeResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return VerifySmsCodeOutcome(rsp);
else
return VerifySmsCodeOutcome(o.GetError());
}
else
{
return VerifySmsCodeOutcome(outcome.GetError());
}
}
void SmhClient::VerifySmsCodeAsync(const VerifySmsCodeRequest& request, const VerifySmsCodeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const VerifySmsCodeRequest&;
using Resp = VerifySmsCodeResponse;
DoRequestAsync<Req, Resp>(
"VerifySmsCode", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
SmhClient::VerifySmsCodeOutcomeCallable SmhClient::VerifySmsCodeCallable(const VerifySmsCodeRequest &request)
{
const auto prom = std::make_shared<std::promise<VerifySmsCodeOutcome>>();
VerifySmsCodeAsync(
request,
[prom](
const SmhClient*,
const VerifySmsCodeRequest&,
VerifySmsCodeOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tencentcloud/tencentcloud-sdk-cpp.git
git@gitee.com:tencentcloud/tencentcloud-sdk-cpp.git
tencentcloud
tencentcloud-sdk-cpp
tencentcloud-sdk-cpp
master

搜索帮助