2 Star 8 Fork 1

tencentcloud/tencentcloud-sdk-cpp

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
HunyuanClient.cpp 47.79 KB
一键复制 编辑 原始数据 按行查看 历史
tencentcloud 提交于 2026-02-26 14:58 +08:00 . release 3.3.48
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442
/*
* 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/hunyuan/v20230901/HunyuanClient.h>
#include <tencentcloud/core/Executor.h>
#include <tencentcloud/core/Runnable.h>
using namespace TencentCloud;
using namespace TencentCloud::Hunyuan::V20230901;
using namespace TencentCloud::Hunyuan::V20230901::Model;
using namespace std;
namespace
{
const string VERSION = "2023-09-01";
const string ENDPOINT = "hunyuan.tencentcloudapi.com";
}
HunyuanClient::HunyuanClient(const Credential &credential, const string &region) :
HunyuanClient(credential, region, ClientProfile())
{
}
HunyuanClient::HunyuanClient(const Credential &credential, const string &region, const ClientProfile &profile) :
AbstractClient(ENDPOINT, VERSION, credential, region, profile)
{
}
HunyuanClient::ActivateServiceOutcome HunyuanClient::ActivateService(const ActivateServiceRequest &request)
{
auto outcome = MakeRequest(request, "ActivateService");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ActivateServiceResponse rsp = ActivateServiceResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ActivateServiceOutcome(rsp);
else
return ActivateServiceOutcome(o.GetError());
}
else
{
return ActivateServiceOutcome(outcome.GetError());
}
}
void HunyuanClient::ActivateServiceAsync(const ActivateServiceRequest& request, const ActivateServiceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const ActivateServiceRequest&;
using Resp = ActivateServiceResponse;
DoRequestAsync<Req, Resp>(
"ActivateService", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::ActivateServiceOutcomeCallable HunyuanClient::ActivateServiceCallable(const ActivateServiceRequest &request)
{
const auto prom = std::make_shared<std::promise<ActivateServiceOutcome>>();
ActivateServiceAsync(
request,
[prom](
const HunyuanClient*,
const ActivateServiceRequest&,
ActivateServiceOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::ChatCompletionsOutcome HunyuanClient::ChatCompletions(const ChatCompletionsRequest &request)
{
auto outcome = MakeRequest(request, "ChatCompletions");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ChatCompletionsResponse rsp = ChatCompletionsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ChatCompletionsOutcome(rsp);
else
return ChatCompletionsOutcome(o.GetError());
}
else
{
return ChatCompletionsOutcome(outcome.GetError());
}
}
void HunyuanClient::ChatCompletionsAsync(const ChatCompletionsRequest& request, const ChatCompletionsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const ChatCompletionsRequest&;
using Resp = ChatCompletionsResponse;
DoRequestAsync<Req, Resp>(
"ChatCompletions", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::ChatCompletionsOutcomeCallable HunyuanClient::ChatCompletionsCallable(const ChatCompletionsRequest &request)
{
const auto prom = std::make_shared<std::promise<ChatCompletionsOutcome>>();
ChatCompletionsAsync(
request,
[prom](
const HunyuanClient*,
const ChatCompletionsRequest&,
ChatCompletionsOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::ChatTranslationsOutcome HunyuanClient::ChatTranslations(const ChatTranslationsRequest &request)
{
auto outcome = MakeRequest(request, "ChatTranslations");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ChatTranslationsResponse rsp = ChatTranslationsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ChatTranslationsOutcome(rsp);
else
return ChatTranslationsOutcome(o.GetError());
}
else
{
return ChatTranslationsOutcome(outcome.GetError());
}
}
void HunyuanClient::ChatTranslationsAsync(const ChatTranslationsRequest& request, const ChatTranslationsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const ChatTranslationsRequest&;
using Resp = ChatTranslationsResponse;
DoRequestAsync<Req, Resp>(
"ChatTranslations", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::ChatTranslationsOutcomeCallable HunyuanClient::ChatTranslationsCallable(const ChatTranslationsRequest &request)
{
const auto prom = std::make_shared<std::promise<ChatTranslationsOutcome>>();
ChatTranslationsAsync(
request,
[prom](
const HunyuanClient*,
const ChatTranslationsRequest&,
ChatTranslationsOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::CreateGlossaryOutcome HunyuanClient::CreateGlossary(const CreateGlossaryRequest &request)
{
auto outcome = MakeRequest(request, "CreateGlossary");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateGlossaryResponse rsp = CreateGlossaryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateGlossaryOutcome(rsp);
else
return CreateGlossaryOutcome(o.GetError());
}
else
{
return CreateGlossaryOutcome(outcome.GetError());
}
}
void HunyuanClient::CreateGlossaryAsync(const CreateGlossaryRequest& request, const CreateGlossaryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const CreateGlossaryRequest&;
using Resp = CreateGlossaryResponse;
DoRequestAsync<Req, Resp>(
"CreateGlossary", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::CreateGlossaryOutcomeCallable HunyuanClient::CreateGlossaryCallable(const CreateGlossaryRequest &request)
{
const auto prom = std::make_shared<std::promise<CreateGlossaryOutcome>>();
CreateGlossaryAsync(
request,
[prom](
const HunyuanClient*,
const CreateGlossaryRequest&,
CreateGlossaryOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::CreateGlossaryEntryOutcome HunyuanClient::CreateGlossaryEntry(const CreateGlossaryEntryRequest &request)
{
auto outcome = MakeRequest(request, "CreateGlossaryEntry");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateGlossaryEntryResponse rsp = CreateGlossaryEntryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateGlossaryEntryOutcome(rsp);
else
return CreateGlossaryEntryOutcome(o.GetError());
}
else
{
return CreateGlossaryEntryOutcome(outcome.GetError());
}
}
void HunyuanClient::CreateGlossaryEntryAsync(const CreateGlossaryEntryRequest& request, const CreateGlossaryEntryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const CreateGlossaryEntryRequest&;
using Resp = CreateGlossaryEntryResponse;
DoRequestAsync<Req, Resp>(
"CreateGlossaryEntry", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::CreateGlossaryEntryOutcomeCallable HunyuanClient::CreateGlossaryEntryCallable(const CreateGlossaryEntryRequest &request)
{
const auto prom = std::make_shared<std::promise<CreateGlossaryEntryOutcome>>();
CreateGlossaryEntryAsync(
request,
[prom](
const HunyuanClient*,
const CreateGlossaryEntryRequest&,
CreateGlossaryEntryOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::CreateThreadOutcome HunyuanClient::CreateThread(const CreateThreadRequest &request)
{
auto outcome = MakeRequest(request, "CreateThread");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateThreadResponse rsp = CreateThreadResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateThreadOutcome(rsp);
else
return CreateThreadOutcome(o.GetError());
}
else
{
return CreateThreadOutcome(outcome.GetError());
}
}
void HunyuanClient::CreateThreadAsync(const CreateThreadRequest& request, const CreateThreadAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const CreateThreadRequest&;
using Resp = CreateThreadResponse;
DoRequestAsync<Req, Resp>(
"CreateThread", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::CreateThreadOutcomeCallable HunyuanClient::CreateThreadCallable(const CreateThreadRequest &request)
{
const auto prom = std::make_shared<std::promise<CreateThreadOutcome>>();
CreateThreadAsync(
request,
[prom](
const HunyuanClient*,
const CreateThreadRequest&,
CreateThreadOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::DeleteGlossaryOutcome HunyuanClient::DeleteGlossary(const DeleteGlossaryRequest &request)
{
auto outcome = MakeRequest(request, "DeleteGlossary");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteGlossaryResponse rsp = DeleteGlossaryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteGlossaryOutcome(rsp);
else
return DeleteGlossaryOutcome(o.GetError());
}
else
{
return DeleteGlossaryOutcome(outcome.GetError());
}
}
void HunyuanClient::DeleteGlossaryAsync(const DeleteGlossaryRequest& request, const DeleteGlossaryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const DeleteGlossaryRequest&;
using Resp = DeleteGlossaryResponse;
DoRequestAsync<Req, Resp>(
"DeleteGlossary", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::DeleteGlossaryOutcomeCallable HunyuanClient::DeleteGlossaryCallable(const DeleteGlossaryRequest &request)
{
const auto prom = std::make_shared<std::promise<DeleteGlossaryOutcome>>();
DeleteGlossaryAsync(
request,
[prom](
const HunyuanClient*,
const DeleteGlossaryRequest&,
DeleteGlossaryOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::DeleteGlossaryEntryOutcome HunyuanClient::DeleteGlossaryEntry(const DeleteGlossaryEntryRequest &request)
{
auto outcome = MakeRequest(request, "DeleteGlossaryEntry");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteGlossaryEntryResponse rsp = DeleteGlossaryEntryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteGlossaryEntryOutcome(rsp);
else
return DeleteGlossaryEntryOutcome(o.GetError());
}
else
{
return DeleteGlossaryEntryOutcome(outcome.GetError());
}
}
void HunyuanClient::DeleteGlossaryEntryAsync(const DeleteGlossaryEntryRequest& request, const DeleteGlossaryEntryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const DeleteGlossaryEntryRequest&;
using Resp = DeleteGlossaryEntryResponse;
DoRequestAsync<Req, Resp>(
"DeleteGlossaryEntry", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::DeleteGlossaryEntryOutcomeCallable HunyuanClient::DeleteGlossaryEntryCallable(const DeleteGlossaryEntryRequest &request)
{
const auto prom = std::make_shared<std::promise<DeleteGlossaryEntryOutcome>>();
DeleteGlossaryEntryAsync(
request,
[prom](
const HunyuanClient*,
const DeleteGlossaryEntryRequest&,
DeleteGlossaryEntryOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::FilesDeletionsOutcome HunyuanClient::FilesDeletions(const FilesDeletionsRequest &request)
{
auto outcome = MakeRequest(request, "FilesDeletions");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
FilesDeletionsResponse rsp = FilesDeletionsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return FilesDeletionsOutcome(rsp);
else
return FilesDeletionsOutcome(o.GetError());
}
else
{
return FilesDeletionsOutcome(outcome.GetError());
}
}
void HunyuanClient::FilesDeletionsAsync(const FilesDeletionsRequest& request, const FilesDeletionsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const FilesDeletionsRequest&;
using Resp = FilesDeletionsResponse;
DoRequestAsync<Req, Resp>(
"FilesDeletions", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::FilesDeletionsOutcomeCallable HunyuanClient::FilesDeletionsCallable(const FilesDeletionsRequest &request)
{
const auto prom = std::make_shared<std::promise<FilesDeletionsOutcome>>();
FilesDeletionsAsync(
request,
[prom](
const HunyuanClient*,
const FilesDeletionsRequest&,
FilesDeletionsOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::FilesListOutcome HunyuanClient::FilesList(const FilesListRequest &request)
{
auto outcome = MakeRequest(request, "FilesList");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
FilesListResponse rsp = FilesListResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return FilesListOutcome(rsp);
else
return FilesListOutcome(o.GetError());
}
else
{
return FilesListOutcome(outcome.GetError());
}
}
void HunyuanClient::FilesListAsync(const FilesListRequest& request, const FilesListAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const FilesListRequest&;
using Resp = FilesListResponse;
DoRequestAsync<Req, Resp>(
"FilesList", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::FilesListOutcomeCallable HunyuanClient::FilesListCallable(const FilesListRequest &request)
{
const auto prom = std::make_shared<std::promise<FilesListOutcome>>();
FilesListAsync(
request,
[prom](
const HunyuanClient*,
const FilesListRequest&,
FilesListOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::FilesUploadsOutcome HunyuanClient::FilesUploads(const FilesUploadsRequest &request)
{
auto outcome = MakeRequest(request, "FilesUploads");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
FilesUploadsResponse rsp = FilesUploadsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return FilesUploadsOutcome(rsp);
else
return FilesUploadsOutcome(o.GetError());
}
else
{
return FilesUploadsOutcome(outcome.GetError());
}
}
void HunyuanClient::FilesUploadsAsync(const FilesUploadsRequest& request, const FilesUploadsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const FilesUploadsRequest&;
using Resp = FilesUploadsResponse;
DoRequestAsync<Req, Resp>(
"FilesUploads", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::FilesUploadsOutcomeCallable HunyuanClient::FilesUploadsCallable(const FilesUploadsRequest &request)
{
const auto prom = std::make_shared<std::promise<FilesUploadsOutcome>>();
FilesUploadsAsync(
request,
[prom](
const HunyuanClient*,
const FilesUploadsRequest&,
FilesUploadsOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::GetEmbeddingOutcome HunyuanClient::GetEmbedding(const GetEmbeddingRequest &request)
{
auto outcome = MakeRequest(request, "GetEmbedding");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
GetEmbeddingResponse rsp = GetEmbeddingResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return GetEmbeddingOutcome(rsp);
else
return GetEmbeddingOutcome(o.GetError());
}
else
{
return GetEmbeddingOutcome(outcome.GetError());
}
}
void HunyuanClient::GetEmbeddingAsync(const GetEmbeddingRequest& request, const GetEmbeddingAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const GetEmbeddingRequest&;
using Resp = GetEmbeddingResponse;
DoRequestAsync<Req, Resp>(
"GetEmbedding", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::GetEmbeddingOutcomeCallable HunyuanClient::GetEmbeddingCallable(const GetEmbeddingRequest &request)
{
const auto prom = std::make_shared<std::promise<GetEmbeddingOutcome>>();
GetEmbeddingAsync(
request,
[prom](
const HunyuanClient*,
const GetEmbeddingRequest&,
GetEmbeddingOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::GetThreadOutcome HunyuanClient::GetThread(const GetThreadRequest &request)
{
auto outcome = MakeRequest(request, "GetThread");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
GetThreadResponse rsp = GetThreadResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return GetThreadOutcome(rsp);
else
return GetThreadOutcome(o.GetError());
}
else
{
return GetThreadOutcome(outcome.GetError());
}
}
void HunyuanClient::GetThreadAsync(const GetThreadRequest& request, const GetThreadAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const GetThreadRequest&;
using Resp = GetThreadResponse;
DoRequestAsync<Req, Resp>(
"GetThread", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::GetThreadOutcomeCallable HunyuanClient::GetThreadCallable(const GetThreadRequest &request)
{
const auto prom = std::make_shared<std::promise<GetThreadOutcome>>();
GetThreadAsync(
request,
[prom](
const HunyuanClient*,
const GetThreadRequest&,
GetThreadOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::GetThreadMessageOutcome HunyuanClient::GetThreadMessage(const GetThreadMessageRequest &request)
{
auto outcome = MakeRequest(request, "GetThreadMessage");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
GetThreadMessageResponse rsp = GetThreadMessageResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return GetThreadMessageOutcome(rsp);
else
return GetThreadMessageOutcome(o.GetError());
}
else
{
return GetThreadMessageOutcome(outcome.GetError());
}
}
void HunyuanClient::GetThreadMessageAsync(const GetThreadMessageRequest& request, const GetThreadMessageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const GetThreadMessageRequest&;
using Resp = GetThreadMessageResponse;
DoRequestAsync<Req, Resp>(
"GetThreadMessage", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::GetThreadMessageOutcomeCallable HunyuanClient::GetThreadMessageCallable(const GetThreadMessageRequest &request)
{
const auto prom = std::make_shared<std::promise<GetThreadMessageOutcome>>();
GetThreadMessageAsync(
request,
[prom](
const HunyuanClient*,
const GetThreadMessageRequest&,
GetThreadMessageOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::GetThreadMessageListOutcome HunyuanClient::GetThreadMessageList(const GetThreadMessageListRequest &request)
{
auto outcome = MakeRequest(request, "GetThreadMessageList");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
GetThreadMessageListResponse rsp = GetThreadMessageListResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return GetThreadMessageListOutcome(rsp);
else
return GetThreadMessageListOutcome(o.GetError());
}
else
{
return GetThreadMessageListOutcome(outcome.GetError());
}
}
void HunyuanClient::GetThreadMessageListAsync(const GetThreadMessageListRequest& request, const GetThreadMessageListAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const GetThreadMessageListRequest&;
using Resp = GetThreadMessageListResponse;
DoRequestAsync<Req, Resp>(
"GetThreadMessageList", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::GetThreadMessageListOutcomeCallable HunyuanClient::GetThreadMessageListCallable(const GetThreadMessageListRequest &request)
{
const auto prom = std::make_shared<std::promise<GetThreadMessageListOutcome>>();
GetThreadMessageListAsync(
request,
[prom](
const HunyuanClient*,
const GetThreadMessageListRequest&,
GetThreadMessageListOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::GetTokenCountOutcome HunyuanClient::GetTokenCount(const GetTokenCountRequest &request)
{
auto outcome = MakeRequest(request, "GetTokenCount");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
GetTokenCountResponse rsp = GetTokenCountResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return GetTokenCountOutcome(rsp);
else
return GetTokenCountOutcome(o.GetError());
}
else
{
return GetTokenCountOutcome(outcome.GetError());
}
}
void HunyuanClient::GetTokenCountAsync(const GetTokenCountRequest& request, const GetTokenCountAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const GetTokenCountRequest&;
using Resp = GetTokenCountResponse;
DoRequestAsync<Req, Resp>(
"GetTokenCount", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::GetTokenCountOutcomeCallable HunyuanClient::GetTokenCountCallable(const GetTokenCountRequest &request)
{
const auto prom = std::make_shared<std::promise<GetTokenCountOutcome>>();
GetTokenCountAsync(
request,
[prom](
const HunyuanClient*,
const GetTokenCountRequest&,
GetTokenCountOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::GroupChatCompletionsOutcome HunyuanClient::GroupChatCompletions(const GroupChatCompletionsRequest &request)
{
auto outcome = MakeRequest(request, "GroupChatCompletions");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
GroupChatCompletionsResponse rsp = GroupChatCompletionsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return GroupChatCompletionsOutcome(rsp);
else
return GroupChatCompletionsOutcome(o.GetError());
}
else
{
return GroupChatCompletionsOutcome(outcome.GetError());
}
}
void HunyuanClient::GroupChatCompletionsAsync(const GroupChatCompletionsRequest& request, const GroupChatCompletionsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const GroupChatCompletionsRequest&;
using Resp = GroupChatCompletionsResponse;
DoRequestAsync<Req, Resp>(
"GroupChatCompletions", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::GroupChatCompletionsOutcomeCallable HunyuanClient::GroupChatCompletionsCallable(const GroupChatCompletionsRequest &request)
{
const auto prom = std::make_shared<std::promise<GroupChatCompletionsOutcome>>();
GroupChatCompletionsAsync(
request,
[prom](
const HunyuanClient*,
const GroupChatCompletionsRequest&,
GroupChatCompletionsOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::ImageQuestionOutcome HunyuanClient::ImageQuestion(const ImageQuestionRequest &request)
{
auto outcome = MakeRequest(request, "ImageQuestion");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ImageQuestionResponse rsp = ImageQuestionResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ImageQuestionOutcome(rsp);
else
return ImageQuestionOutcome(o.GetError());
}
else
{
return ImageQuestionOutcome(outcome.GetError());
}
}
void HunyuanClient::ImageQuestionAsync(const ImageQuestionRequest& request, const ImageQuestionAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const ImageQuestionRequest&;
using Resp = ImageQuestionResponse;
DoRequestAsync<Req, Resp>(
"ImageQuestion", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::ImageQuestionOutcomeCallable HunyuanClient::ImageQuestionCallable(const ImageQuestionRequest &request)
{
const auto prom = std::make_shared<std::promise<ImageQuestionOutcome>>();
ImageQuestionAsync(
request,
[prom](
const HunyuanClient*,
const ImageQuestionRequest&,
ImageQuestionOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::ListGlossaryOutcome HunyuanClient::ListGlossary(const ListGlossaryRequest &request)
{
auto outcome = MakeRequest(request, "ListGlossary");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ListGlossaryResponse rsp = ListGlossaryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ListGlossaryOutcome(rsp);
else
return ListGlossaryOutcome(o.GetError());
}
else
{
return ListGlossaryOutcome(outcome.GetError());
}
}
void HunyuanClient::ListGlossaryAsync(const ListGlossaryRequest& request, const ListGlossaryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const ListGlossaryRequest&;
using Resp = ListGlossaryResponse;
DoRequestAsync<Req, Resp>(
"ListGlossary", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::ListGlossaryOutcomeCallable HunyuanClient::ListGlossaryCallable(const ListGlossaryRequest &request)
{
const auto prom = std::make_shared<std::promise<ListGlossaryOutcome>>();
ListGlossaryAsync(
request,
[prom](
const HunyuanClient*,
const ListGlossaryRequest&,
ListGlossaryOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::ListGlossaryEntryOutcome HunyuanClient::ListGlossaryEntry(const ListGlossaryEntryRequest &request)
{
auto outcome = MakeRequest(request, "ListGlossaryEntry");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ListGlossaryEntryResponse rsp = ListGlossaryEntryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ListGlossaryEntryOutcome(rsp);
else
return ListGlossaryEntryOutcome(o.GetError());
}
else
{
return ListGlossaryEntryOutcome(outcome.GetError());
}
}
void HunyuanClient::ListGlossaryEntryAsync(const ListGlossaryEntryRequest& request, const ListGlossaryEntryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const ListGlossaryEntryRequest&;
using Resp = ListGlossaryEntryResponse;
DoRequestAsync<Req, Resp>(
"ListGlossaryEntry", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::ListGlossaryEntryOutcomeCallable HunyuanClient::ListGlossaryEntryCallable(const ListGlossaryEntryRequest &request)
{
const auto prom = std::make_shared<std::promise<ListGlossaryEntryOutcome>>();
ListGlossaryEntryAsync(
request,
[prom](
const HunyuanClient*,
const ListGlossaryEntryRequest&,
ListGlossaryEntryOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::QueryHunyuanImageChatJobOutcome HunyuanClient::QueryHunyuanImageChatJob(const QueryHunyuanImageChatJobRequest &request)
{
auto outcome = MakeRequest(request, "QueryHunyuanImageChatJob");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
QueryHunyuanImageChatJobResponse rsp = QueryHunyuanImageChatJobResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return QueryHunyuanImageChatJobOutcome(rsp);
else
return QueryHunyuanImageChatJobOutcome(o.GetError());
}
else
{
return QueryHunyuanImageChatJobOutcome(outcome.GetError());
}
}
void HunyuanClient::QueryHunyuanImageChatJobAsync(const QueryHunyuanImageChatJobRequest& request, const QueryHunyuanImageChatJobAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const QueryHunyuanImageChatJobRequest&;
using Resp = QueryHunyuanImageChatJobResponse;
DoRequestAsync<Req, Resp>(
"QueryHunyuanImageChatJob", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::QueryHunyuanImageChatJobOutcomeCallable HunyuanClient::QueryHunyuanImageChatJobCallable(const QueryHunyuanImageChatJobRequest &request)
{
const auto prom = std::make_shared<std::promise<QueryHunyuanImageChatJobOutcome>>();
QueryHunyuanImageChatJobAsync(
request,
[prom](
const HunyuanClient*,
const QueryHunyuanImageChatJobRequest&,
QueryHunyuanImageChatJobOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::QueryHunyuanImageJobOutcome HunyuanClient::QueryHunyuanImageJob(const QueryHunyuanImageJobRequest &request)
{
auto outcome = MakeRequest(request, "QueryHunyuanImageJob");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
QueryHunyuanImageJobResponse rsp = QueryHunyuanImageJobResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return QueryHunyuanImageJobOutcome(rsp);
else
return QueryHunyuanImageJobOutcome(o.GetError());
}
else
{
return QueryHunyuanImageJobOutcome(outcome.GetError());
}
}
void HunyuanClient::QueryHunyuanImageJobAsync(const QueryHunyuanImageJobRequest& request, const QueryHunyuanImageJobAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const QueryHunyuanImageJobRequest&;
using Resp = QueryHunyuanImageJobResponse;
DoRequestAsync<Req, Resp>(
"QueryHunyuanImageJob", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::QueryHunyuanImageJobOutcomeCallable HunyuanClient::QueryHunyuanImageJobCallable(const QueryHunyuanImageJobRequest &request)
{
const auto prom = std::make_shared<std::promise<QueryHunyuanImageJobOutcome>>();
QueryHunyuanImageJobAsync(
request,
[prom](
const HunyuanClient*,
const QueryHunyuanImageJobRequest&,
QueryHunyuanImageJobOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::RunThreadOutcome HunyuanClient::RunThread(const RunThreadRequest &request)
{
auto outcome = MakeRequest(request, "RunThread");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
RunThreadResponse rsp = RunThreadResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return RunThreadOutcome(rsp);
else
return RunThreadOutcome(o.GetError());
}
else
{
return RunThreadOutcome(outcome.GetError());
}
}
void HunyuanClient::RunThreadAsync(const RunThreadRequest& request, const RunThreadAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const RunThreadRequest&;
using Resp = RunThreadResponse;
DoRequestAsync<Req, Resp>(
"RunThread", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::RunThreadOutcomeCallable HunyuanClient::RunThreadCallable(const RunThreadRequest &request)
{
const auto prom = std::make_shared<std::promise<RunThreadOutcome>>();
RunThreadAsync(
request,
[prom](
const HunyuanClient*,
const RunThreadRequest&,
RunThreadOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::SetPayModeOutcome HunyuanClient::SetPayMode(const SetPayModeRequest &request)
{
auto outcome = MakeRequest(request, "SetPayMode");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
SetPayModeResponse rsp = SetPayModeResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return SetPayModeOutcome(rsp);
else
return SetPayModeOutcome(o.GetError());
}
else
{
return SetPayModeOutcome(outcome.GetError());
}
}
void HunyuanClient::SetPayModeAsync(const SetPayModeRequest& request, const SetPayModeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const SetPayModeRequest&;
using Resp = SetPayModeResponse;
DoRequestAsync<Req, Resp>(
"SetPayMode", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::SetPayModeOutcomeCallable HunyuanClient::SetPayModeCallable(const SetPayModeRequest &request)
{
const auto prom = std::make_shared<std::promise<SetPayModeOutcome>>();
SetPayModeAsync(
request,
[prom](
const HunyuanClient*,
const SetPayModeRequest&,
SetPayModeOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::SubmitHunyuanImageChatJobOutcome HunyuanClient::SubmitHunyuanImageChatJob(const SubmitHunyuanImageChatJobRequest &request)
{
auto outcome = MakeRequest(request, "SubmitHunyuanImageChatJob");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
SubmitHunyuanImageChatJobResponse rsp = SubmitHunyuanImageChatJobResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return SubmitHunyuanImageChatJobOutcome(rsp);
else
return SubmitHunyuanImageChatJobOutcome(o.GetError());
}
else
{
return SubmitHunyuanImageChatJobOutcome(outcome.GetError());
}
}
void HunyuanClient::SubmitHunyuanImageChatJobAsync(const SubmitHunyuanImageChatJobRequest& request, const SubmitHunyuanImageChatJobAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const SubmitHunyuanImageChatJobRequest&;
using Resp = SubmitHunyuanImageChatJobResponse;
DoRequestAsync<Req, Resp>(
"SubmitHunyuanImageChatJob", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::SubmitHunyuanImageChatJobOutcomeCallable HunyuanClient::SubmitHunyuanImageChatJobCallable(const SubmitHunyuanImageChatJobRequest &request)
{
const auto prom = std::make_shared<std::promise<SubmitHunyuanImageChatJobOutcome>>();
SubmitHunyuanImageChatJobAsync(
request,
[prom](
const HunyuanClient*,
const SubmitHunyuanImageChatJobRequest&,
SubmitHunyuanImageChatJobOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::SubmitHunyuanImageJobOutcome HunyuanClient::SubmitHunyuanImageJob(const SubmitHunyuanImageJobRequest &request)
{
auto outcome = MakeRequest(request, "SubmitHunyuanImageJob");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
SubmitHunyuanImageJobResponse rsp = SubmitHunyuanImageJobResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return SubmitHunyuanImageJobOutcome(rsp);
else
return SubmitHunyuanImageJobOutcome(o.GetError());
}
else
{
return SubmitHunyuanImageJobOutcome(outcome.GetError());
}
}
void HunyuanClient::SubmitHunyuanImageJobAsync(const SubmitHunyuanImageJobRequest& request, const SubmitHunyuanImageJobAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const SubmitHunyuanImageJobRequest&;
using Resp = SubmitHunyuanImageJobResponse;
DoRequestAsync<Req, Resp>(
"SubmitHunyuanImageJob", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::SubmitHunyuanImageJobOutcomeCallable HunyuanClient::SubmitHunyuanImageJobCallable(const SubmitHunyuanImageJobRequest &request)
{
const auto prom = std::make_shared<std::promise<SubmitHunyuanImageJobOutcome>>();
SubmitHunyuanImageJobAsync(
request,
[prom](
const HunyuanClient*,
const SubmitHunyuanImageJobRequest&,
SubmitHunyuanImageJobOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::TextToImageLiteOutcome HunyuanClient::TextToImageLite(const TextToImageLiteRequest &request)
{
auto outcome = MakeRequest(request, "TextToImageLite");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
TextToImageLiteResponse rsp = TextToImageLiteResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return TextToImageLiteOutcome(rsp);
else
return TextToImageLiteOutcome(o.GetError());
}
else
{
return TextToImageLiteOutcome(outcome.GetError());
}
}
void HunyuanClient::TextToImageLiteAsync(const TextToImageLiteRequest& request, const TextToImageLiteAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const TextToImageLiteRequest&;
using Resp = TextToImageLiteResponse;
DoRequestAsync<Req, Resp>(
"TextToImageLite", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::TextToImageLiteOutcomeCallable HunyuanClient::TextToImageLiteCallable(const TextToImageLiteRequest &request)
{
const auto prom = std::make_shared<std::promise<TextToImageLiteOutcome>>();
TextToImageLiteAsync(
request,
[prom](
const HunyuanClient*,
const TextToImageLiteRequest&,
TextToImageLiteOutcome resp,
const std::shared_ptr<const AsyncCallerContext>&
)
{
prom->set_value(resp);
});
return prom->get_future();
}
HunyuanClient::UpdateGlossaryEntryOutcome HunyuanClient::UpdateGlossaryEntry(const UpdateGlossaryEntryRequest &request)
{
auto outcome = MakeRequest(request, "UpdateGlossaryEntry");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
UpdateGlossaryEntryResponse rsp = UpdateGlossaryEntryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return UpdateGlossaryEntryOutcome(rsp);
else
return UpdateGlossaryEntryOutcome(o.GetError());
}
else
{
return UpdateGlossaryEntryOutcome(outcome.GetError());
}
}
void HunyuanClient::UpdateGlossaryEntryAsync(const UpdateGlossaryEntryRequest& request, const UpdateGlossaryEntryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
using Req = const UpdateGlossaryEntryRequest&;
using Resp = UpdateGlossaryEntryResponse;
DoRequestAsync<Req, Resp>(
"UpdateGlossaryEntry", request, {{{"Content-Type", "application/json"}}},
[this, context, handler](Req req, Outcome<Core::Error, Resp> resp)
{
handler(this, req, std::move(resp), context);
});
}
HunyuanClient::UpdateGlossaryEntryOutcomeCallable HunyuanClient::UpdateGlossaryEntryCallable(const UpdateGlossaryEntryRequest &request)
{
const auto prom = std::make_shared<std::promise<UpdateGlossaryEntryOutcome>>();
UpdateGlossaryEntryAsync(
request,
[prom](
const HunyuanClient*,
const UpdateGlossaryEntryRequest&,
UpdateGlossaryEntryOutcome 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

搜索帮助