14#include "HttpModule.h"
26#include "Misc/Paths.h"
27#include "Dom/JsonObject.h"
28#include "GenericPlatform/GenericPlatformHttp.h"
29#include "Serialization/JsonReader.h"
30#include "Serialization/JsonSerializer.h"
32#define NETWORK_GET TEXT("GET")
33#define NETWORK_POST TEXT("POST")
37 Super::Initialize(Collection);
43 Super::Deinitialize();
65 default:
return TEXT(
"[UNKNOWN]");
71 if ( InCode == 200 || InCode == 201 )
81 UWorld* World = GetWorld();
84 PRINTLOG( TEXT(
"[Network] Invalid World in AddNetworkWaitCount."));
88 if (
auto BroadcastManager = UBroadcastManager::Get(World) )
94 if (UWorld* World = GetWorld())
97 LoadingManager->LoadingCircle(bShow);
103 UWorld* World = GetWorld();
106 NETWORK_LOG(TEXT(
"[Network] Invalid World in ShowNetworkErrorPopup"));
111 FString ErrorDetail = TEXT(
"Network request failed");
113 TSharedPtr<FJsonObject> JsonObject;
114 TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(ResponseContent);
116 if (FJsonSerializer::Deserialize(Reader, JsonObject) && JsonObject.IsValid())
119 if (JsonObject->HasField(TEXT(
"detail")))
121 ErrorDetail = JsonObject->GetStringField(TEXT(
"detail"));
127 if (!ResponseContent.IsEmpty())
129 ErrorDetail = ResponseContent;
136 FString Title = FString::Printf(TEXT(
"Error %d"), ResponseCode);
139 NETWORK_LOG(TEXT(
"[Network] Error Popup - Code: %d, Detail: %s"), ResponseCode, *ErrorDetail);
144 const FString& Url,
const FString& Verb )
146 auto RetRequest = FHttpModule::Get().CreateRequest();
147 RetRequest->SetURL(Url);
148 RetRequest->SetVerb(Verb);
151 RetRequest->SetHeader(TEXT(
"Content-Type"), TEXT(
"application/json"));
152 RetRequest->SetHeader(TEXT(
"Authorization"), FString::Printf(TEXT(
"Bearer %s"), *
access_token));
167 TSharedPtr<FJsonObject> JsonObject = MakeShareable(
new FJsonObject);
168 JsonObject->SetStringField(TEXT(
"username"), UserName);
169 JsonObject->SetStringField(TEXT(
"fullname"), UserName + TEXT(
"@klingo.com"));
170 JsonObject->SetStringField(TEXT(
"password"), UserName);
173 TSharedRef<TJsonWriter<>> Writer = TJsonWriterFactory<>::Create(&RequestBody);
174 FJsonSerializer::Serialize(JsonObject.ToSharedRef(), Writer);
175 Request->SetContentAsString(RequestBody);
179 Request->OnProcessRequestComplete().BindLambda(
180 [
this, InDelegate](FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
bool bSuccess)
186 if (bSuccess && HttpResponse.IsValid())
188 const int32 ResponseCode = HttpResponse->GetResponseCode();
194 InDelegate.ExecuteIfBound(ResponseData,
true);
198 NETWORK_LOG(TEXT(
"[POST] RequestUserRegister failed - Code: %d, Response: %s"),
199 ResponseCode, *HttpResponse->GetContentAsString());
201 InDelegate.ExecuteIfBound(ResponseData,
false);
206 NETWORK_LOG(TEXT(
"[POST] RequestUserRegister failed - bSuccess: %s, Response valid: %s"),
207 bSuccess ? TEXT(
"true") : TEXT(
"false"),
208 HttpResponse.IsValid() ? TEXT(
"true") : TEXT(
"false"));
211 int32 ErrorCode = HttpResponse.IsValid() ? HttpResponse->GetResponseCode() : 0;
212 FString ErrorContent = HttpResponse.IsValid() ? HttpResponse->GetContentAsString() : TEXT(
"Network connection failed");
215 InDelegate.ExecuteIfBound(ResponseData,
false);
220 Request->ProcessRequest();
232 FormData.
AddText(TEXT(
"grant_type"), TEXT(
"password"));
233 FormData.
AddText(TEXT(
"username"), UserName);
234 FormData.
AddText(TEXT(
"password"), UserName);
239 Request->OnProcessRequestComplete().BindLambda(
240 [
this, InDelegate, UserName](FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
bool bSuccess)
246 if (bSuccess && HttpResponse.IsValid())
248 const int32 ResponseCode = HttpResponse->GetResponseCode();
252 NETWORK_LOG(TEXT(
"[RES] RequestInterviewHello - Code: %d, Response: %s"), ResponseCode, *HttpResponse->GetContentAsString());
262 InDelegate.ExecuteIfBound(ResponseData,
true);
266 NETWORK_LOG(TEXT(
"[POST] RequestUserToken failed - Code: %d, Response: %s"),
267 ResponseCode, *HttpResponse->GetContentAsString());
269 InDelegate.ExecuteIfBound(ResponseData,
false);
274 NETWORK_LOG(TEXT(
"[POST] RequestUserToken failed - bSuccess: %s, Response valid: %s"),
275 bSuccess ? TEXT(
"true") : TEXT(
"false"),
276 HttpResponse.IsValid() ? TEXT(
"true") : TEXT(
"false"));
278 int32 ErrorCode = HttpResponse.IsValid() ? HttpResponse->GetResponseCode() : 0;
279 FString ErrorContent = HttpResponse.IsValid() ? HttpResponse->GetContentAsString() : TEXT(
"Network connection failed");
282 InDelegate.ExecuteIfBound(ResponseData,
false);
287 Request->ProcessRequest();
298 Request->OnProcessRequestComplete().BindLambda(
299 [
this, InDelegate](FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
bool bSuccess)
305 if (bSuccess && HttpResponse.IsValid())
307 const int32 ResponseCode = HttpResponse->GetResponseCode();
309 NETWORK_LOG(TEXT(
"[RES] Code: %d, Response: %s"), ResponseCode, *HttpResponse->GetContentAsString());
316 ULingoGameInstanceSubsystem::Get(GetWorld())->SetUserInfo(ResponseData);
318 InDelegate.ExecuteIfBound(ResponseData,
true);
323 InDelegate.ExecuteIfBound(ResponseData,
false);
328 NETWORK_LOG(TEXT(
"[GET] RequestUserMe failed - bSuccess: %s, Response valid: %s"),
329 bSuccess ? TEXT(
"true") : TEXT(
"false"),
330 HttpResponse.IsValid() ? TEXT(
"true") : TEXT(
"false"));
332 int32 ErrorCode = HttpResponse.IsValid() ? HttpResponse->GetResponseCode() : 0;
333 FString ErrorContent = HttpResponse.IsValid() ? HttpResponse->GetContentAsString() : TEXT(
"Network connection failed");
336 InDelegate.ExecuteIfBound(ResponseData,
false);
341 Request->ProcessRequest();
361 Request->OnProcessRequestComplete().BindLambda(
362 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](FHttpRequestPtr Req, FHttpResponsePtr ResPtr,
bool bWasSuccessful)
364 if (!WeakThis.IsValid() || IsEngineExitRequested())
367 WeakThis->AddNetworkWaitCount(-1);
370 if (bWasSuccessful && ResPtr.IsValid())
372 const int32 ResponseCode = ResPtr->GetResponseCode();
374 NETWORK_LOG(TEXT(
"[RES] RequestWriteQuestions - Code: %d, Response: %s"), ResponseCode, *ResPtr->GetContentAsString());
376 if (IsResSuccess(ResponseCode))
378 ResponseData.SetFromHttpResponse(ResPtr);
379 InDelegate.ExecuteIfBound(ResponseData, true);
383 WeakThis->ShowNetworkErrorPopup(ResponseCode, ResPtr->GetContentAsString());
384 InDelegate.ExecuteIfBound(ResponseData, false);
389 NETWORK_LOG(TEXT(
"[POST] RequestWriteQuestions failed - bSuccess: %s, Response valid: %s"),
390 bWasSuccessful ? TEXT(
"true") : TEXT(
"false"),
391 ResPtr.IsValid() ? TEXT(
"true") : TEXT(
"false"));
393 int32 ErrorCode = ResPtr.
IsValid() ? ResPtr->GetResponseCode() : 0;
394 FString ErrorContent = ResPtr.IsValid() ? ResPtr->GetContentAsString() : TEXT(
"Network connection failed");
395 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
397 InDelegate.ExecuteIfBound(ResponseData,
false);
401 AddNetworkWaitCount(1);
402 Request->ProcessRequest();
415 for (FString ImageName : ImageNameArray)
417 if (!Form.
AddFile(TEXT(
"files"), FString::Printf(TEXT(
"%s"), *ImageName)))
419 NETWORK_LOG(TEXT(
"[POST] OCR Extract: file load failed: %s"), *ImageName);
421 InDelegate.ExecuteIfBound(EmptyResponse,
false);
425 for (FString targetText : InTargetText)
427 Form.
AddText(TEXT(
"target_texts"), targetText);
434 Request->OnProcessRequestComplete().BindLambda(
435 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](FHttpRequestPtr Req, FHttpResponsePtr ResPtr,
bool bWasSuccessful)
437 if (!WeakThis.IsValid() || IsEngineExitRequested())
440 WeakThis->ShowLoadingCircle(
false);
443 if (bWasSuccessful && ResPtr.IsValid())
445 const int32 ResponseCode = ResPtr->GetResponseCode();
447 NETWORK_LOG(TEXT(
"[RES] Code: %d, Response: %s"), ResponseCode, *ResPtr->GetContentAsString());
449 if (IsResSuccess(ResponseCode))
451 ResponseData.SetFromHttpResponse(ResPtr);
452 InDelegate.ExecuteIfBound(ResponseData, true);
456 WeakThis->ShowNetworkErrorPopup(ResponseCode, ResPtr->GetContentAsString());
457 InDelegate.ExecuteIfBound(ResponseData, false);
462 NETWORK_LOG(TEXT(
"[POST] RequestOcrExtract failed - bSuccess: %s, Response valid: %s"),
463 bWasSuccessful ? TEXT(
"true") : TEXT(
"false"),
464 ResPtr.IsValid() ? TEXT(
"true") : TEXT(
"false"));
466 int32 ErrorCode = ResPtr.IsValid() ? ResPtr->GetResponseCode() : 0;
467 FString ErrorContent = ResPtr.IsValid() ? ResPtr->GetContentAsString() : TEXT(
"Network connection failed");
468 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
470 InDelegate.ExecuteIfBound(ResponseData,
false);
474 ShowLoadingCircle(
true);
475 Request->ProcessRequest();
486 Request->SetContentAsString(RequestBody);
490 Request->OnProcessRequestComplete().BindLambda(
491 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](FHttpRequestPtr Req, FHttpResponsePtr ResPtr,
bool bWasSuccessful)
493 if (!WeakThis.IsValid() || IsEngineExitRequested())
496 WeakThis->ShowLoadingCircle(
false);
500 if (bWasSuccessful && ResPtr.IsValid())
502 const int32 ResponseCode = ResPtr->GetResponseCode();
504 NETWORK_LOG(TEXT(
"[RES] Code: %d, Response: %s"), ResponseCode, *ResPtr->GetContentAsString());
506 if (IsResSuccess(ResponseCode))
508 ResponseData.SetFromHttpResponse(ResPtr);
509 InDelegate.ExecuteIfBound(ResponseData, true);
513 WeakThis->ShowNetworkErrorPopup(ResponseCode, ResPtr->GetContentAsString());
514 InDelegate.ExecuteIfBound(ResponseData, false);
519 NETWORK_LOG(TEXT(
"[POST] RequestOcrExtract failed - bSuccess: %s, Response valid: %s"),
520 bWasSuccessful ? TEXT(
"true") : TEXT(
"false"),
521 ResPtr.IsValid() ? TEXT(
"true") : TEXT(
"false"));
523 int32 ErrorCode = ResPtr.IsValid() ? ResPtr->GetResponseCode() : 0;
524 FString ErrorContent = ResPtr.IsValid() ? ResPtr->GetContentAsString() : TEXT(
"Network connection failed");
525 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
527 InDelegate.ExecuteIfBound(ResponseData,
false);
531 ShowLoadingCircle(
true);
532 Request->ProcessRequest();
537 if (
auto ACM = UVoiceCacheManager::Get(GetWorld()))
543 TArray<uint8> CachedAudio;
544 if (ACM->TryGetCachedAudio(AudioText, CachedAudio))
551 if (UWorld* World = GetWorld())
554 TSharedPtr<FResponseListenAudio> SharedResponse = MakeShared<FResponseListenAudio>(Response);
556 World->GetTimerManager().SetTimerForNextTick([InDelegate, SharedResponse]()
559 InDelegate.ExecuteIfBound(*SharedResponse,
true);
565 InDelegate.ExecuteIfBound(Response,
true);
572 TMap<FString, FString> Query;
573 Query.Add(TEXT(
"audio_text"), AudioText);
578 Request->OnProcessRequestComplete().BindLambda(
579 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate, AudioText](FHttpRequestPtr Req, FHttpResponsePtr ResPtr,
bool bWasSuccessful)
581 if (!WeakThis.IsValid() || IsEngineExitRequested())
584 WeakThis->AddNetworkWaitCount(-1);
587 if (bWasSuccessful && ResPtr.IsValid())
589 const int32 ResponseCode = ResPtr->GetResponseCode();
591 NETWORK_LOG(TEXT(
"[RES] RequestListenAudio - Code: %d"), ResponseCode);
593 if (IsResSuccess(ResponseCode))
595 ResponseData.SetFromHttpResponse(ResPtr);
596 ResponseData.PrintData();
599 if (auto ACM = UVoiceCacheManager::Get(WeakThis->GetWorld()))
601 if (ResponseData.audio_base64.Num() > 0)
603 ACM->SaveToCache(AudioText, ResponseData.audio_base64);
607 InDelegate.ExecuteIfBound(ResponseData, true);
611 WeakThis->ShowNetworkErrorPopup(ResponseCode, ResPtr->GetContentAsString());
612 InDelegate.ExecuteIfBound(ResponseData, false);
617 NETWORK_LOG(TEXT(
"[POST] RequestListenAudio failed - bSuccess: %s, Response valid: %s"),
618 bWasSuccessful ? TEXT(
"true") : TEXT(
"false"),
619 ResPtr.IsValid() ? TEXT(
"true") : TEXT(
"false"));
621 int32 ErrorCode = ResPtr.IsValid() ? ResPtr->GetResponseCode() : 0;
622 FString ErrorContent = ResPtr.IsValid() ? ResPtr->GetContentAsString() : TEXT(
"Network connection failed");
623 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
625 InDelegate.ExecuteIfBound(ResponseData,
false);
629 AddNetworkWaitCount(1);
630 Request->ProcessRequest();
634 const FString& Question,
635 const FString& AudioPath,
636 FResponseSpeakingJudesDelegate InDelegate)
638 TMap<FString, FString> Query;
639 Query.Add(TEXT(
"question"), Question);
644 FString AbsoluteAudioPath = FPaths::IsRelative(AudioPath)
645 ? FPaths::Combine(FPaths::ProjectDir(), AudioPath)
647 AbsoluteAudioPath = FPaths::ConvertRelativePathToFull(AbsoluteAudioPath);
650 if (!Form.
AddFile(TEXT(
"audio"), AbsoluteAudioPath))
652 NETWORK_LOG(TEXT(
"[POST] Speaking Questions: file load failed: %s"), *AudioPath);
654 InDelegate.ExecuteIfBound(EmptyResponse,
false);
661 Request->OnProcessRequestComplete().BindLambda(
662 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](FHttpRequestPtr Req, FHttpResponsePtr ResPtr,
bool bWasSuccessful)
664 if (!WeakThis.IsValid() || IsEngineExitRequested())
667 WeakThis->ShowLoadingCircle(
false);
670 if (bWasSuccessful && ResPtr.IsValid())
672 const int32 ResponseCode = ResPtr->GetResponseCode();
674 NETWORK_LOG(TEXT(
"[RES] RequestSpeakingQuestions - Code: %d, Response: %s"), ResponseCode, *ResPtr->GetContentAsString());
676 if (IsResSuccess(ResponseCode))
678 ResponseData.SetFromHttpResponse(ResPtr);
679 ResponseData.PrintData();
680 InDelegate.ExecuteIfBound(ResponseData, true);
684 WeakThis->ShowNetworkErrorPopup(ResponseCode, ResPtr->GetContentAsString());
685 InDelegate.ExecuteIfBound(ResponseData, false);
690 NETWORK_LOG(TEXT(
"[POST] RequestSpeakingQuestions failed - bSuccess: %s, Response valid: %s"),
691 bWasSuccessful ? TEXT(
"true") : TEXT(
"false"),
692 ResPtr.IsValid() ? TEXT(
"true") : TEXT(
"false"));
694 int32 ErrorCode = ResPtr.IsValid() ? ResPtr->GetResponseCode() : 0;
695 FString ErrorContent = ResPtr.IsValid() ? ResPtr->GetContentAsString() : TEXT(
"Network connection failed");
696 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
698 InDelegate.ExecuteIfBound(ResponseData,
false);
702 ShowLoadingCircle(
true);
703 Request->ProcessRequest();
721 Request->OnProcessRequestComplete().BindLambda(
722 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](FHttpRequestPtr Req, FHttpResponsePtr ResPtr,
bool bWasSuccessful)
724 if (!WeakThis.IsValid() || IsEngineExitRequested())
727 WeakThis->AddNetworkWaitCount(-1);
730 if (bWasSuccessful && ResPtr.IsValid())
732 const int32 ResponseCode = ResPtr->GetResponseCode();
734 NETWORK_LOG(TEXT(
"[RES] RequestInterviewHello - Code: %d, Response: %s"), ResponseCode, *ResPtr->GetContentAsString());
736 if (IsResSuccess(ResponseCode))
738 ResponseData.SetFromHttpResponse(ResPtr);
739 ResponseData.PrintData();
740 InDelegate.ExecuteIfBound(ResponseData, true);
744 WeakThis->ShowNetworkErrorPopup(ResponseCode, ResPtr->GetContentAsString());
745 InDelegate.ExecuteIfBound(ResponseData, false);
750 NETWORK_LOG(TEXT(
"[POST] RequestInterviewHello failed - bSuccess: %s, Response valid: %s"),
751 bWasSuccessful ? TEXT(
"true") : TEXT(
"false"),
752 ResPtr.IsValid() ? TEXT(
"true") : TEXT(
"false"));
754 int32 ErrorCode = ResPtr.IsValid() ? ResPtr->GetResponseCode() : 0;
755 FString ErrorContent = ResPtr.IsValid() ? ResPtr->GetContentAsString() : TEXT(
"Network connection failed");
756 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
758 InDelegate.ExecuteIfBound(ResponseData,
false);
762 AddNetworkWaitCount(1);
763 Request->ProcessRequest();
780 Request->SetContentAsString(RequestBody);
781 NETWORK_LOG(TEXT(
"[POST] RequestInterviewAnswer Body: %s"), *RequestBody);
785 NETWORK_LOG(TEXT(
"[POST] RequestInterviewAnswer - Failed to serialize request body"));
790 Request->OnProcessRequestComplete().BindLambda(
791 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](FHttpRequestPtr Req, FHttpResponsePtr ResPtr,
bool bWasSuccessful)
793 if (!WeakThis.IsValid() || IsEngineExitRequested())
796 WeakThis->AddNetworkWaitCount(-1);
799 if (bWasSuccessful && ResPtr.IsValid())
801 const int32 ResponseCode = ResPtr->GetResponseCode();
803 NETWORK_LOG(TEXT(
"[POST] RequestInterviewAnswer - Code: %d, Response: %s"),
804 ResponseCode, *ResPtr->GetContentAsString());
806 if (IsResSuccess(ResponseCode))
808 ResponseData.SetFromHttpResponse(ResPtr);
809 ResponseData.PrintData();
810 InDelegate.ExecuteIfBound(ResponseData, true);
814 WeakThis->ShowNetworkErrorPopup(ResponseCode, ResPtr->GetContentAsString());
815 InDelegate.ExecuteIfBound(ResponseData, false);
820 NETWORK_LOG(TEXT(
"[POST] RequestInterviewAnswer failed - bSuccess: %s, Response valid: %s"),
821 bWasSuccessful ? TEXT(
"true") : TEXT(
"false"),
822 ResPtr.IsValid() ? TEXT(
"true") : TEXT(
"false"));
824 int32 ErrorCode = ResPtr.IsValid() ? ResPtr->GetResponseCode() : 0;
825 FString ErrorContent = ResPtr.IsValid() ? ResPtr->GetContentAsString() : TEXT(
"Network connection failed");
826 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
828 InDelegate.ExecuteIfBound(ResponseData,
false);
832 AddNetworkWaitCount(1);
833 Request->ProcessRequest();
927 Request->OnProcessRequestComplete().BindLambda(
928 [
this, InDelegate](FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
bool bSuccess)
934 if (bSuccess && HttpResponse.IsValid())
936 const int32 ResponseCode = HttpResponse->GetResponseCode();
938 NETWORK_LOG(TEXT(
"[RES] Code: %d, Response: %s"), ResponseCode, *HttpResponse->GetContentAsString());
944 InDelegate.ExecuteIfBound(ResponseData,
true);
949 InDelegate.ExecuteIfBound(ResponseData,
false);
954 NETWORK_LOG(TEXT(
"[GET] RequestReadScenario failed - bSuccess: %s, Response valid: %s"),
955 bSuccess ? TEXT(
"true") : TEXT(
"false"),
956 HttpResponse.IsValid() ? TEXT(
"true") : TEXT(
"false"));
958 int32 ErrorCode = HttpResponse.IsValid() ? HttpResponse->GetResponseCode() : 0;
959 FString ErrorContent = HttpResponse.IsValid() ? HttpResponse->GetContentAsString() : TEXT(
"Network connection failed");
962 InDelegate.ExecuteIfBound(ResponseData,
false);
967 Request->ProcessRequest();
979 Request->SetContentAsString(RequestBody);
983 Request->OnProcessRequestComplete().BindLambda(
984 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](FHttpRequestPtr Req, FHttpResponsePtr ResPtr,
bool bWasSuccessful)
986 if (!WeakThis.IsValid() || IsEngineExitRequested())
989 WeakThis->ShowLoadingCircle(
false);
993 if (bWasSuccessful && ResPtr.IsValid())
995 const int32 ResponseCode = ResPtr->GetResponseCode();
997 NETWORK_LOG(TEXT(
"[POST] RequestQuestResult - Code: %d, Response: %s"),
998 ResponseCode, *ResPtr->GetContentAsString());
1000 if (IsResSuccess(ResponseCode))
1002 ResponseData.SetFromHttpResponse(ResPtr);
1003 ResponseData.PrintData();
1004 InDelegate.ExecuteIfBound(ResponseData, true);
1008 WeakThis->ShowNetworkErrorPopup(ResponseCode, ResPtr->GetContentAsString());
1009 InDelegate.ExecuteIfBound(ResponseData, false);
1014 NETWORK_LOG(TEXT(
"[POST] RequestReadResult failed - bSuccess: %s, Response valid: %s"),
1015 bWasSuccessful ? TEXT(
"true") : TEXT(
"false"),
1016 ResPtr.IsValid() ? TEXT(
"true") : TEXT(
"false"));
1018 int32 ErrorCode = ResPtr.IsValid() ? ResPtr->GetResponseCode() : 0;
1019 FString ErrorContent = ResPtr.IsValid() ? ResPtr->GetContentAsString() : TEXT(
"Network connection failed");
1020 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
1022 InDelegate.ExecuteIfBound(ResponseData,
false);
1026 ShowLoadingCircle(
true);
1027 Request->ProcessRequest();
1046 Request->OnProcessRequestComplete().BindLambda(
1047 [
this, InDelegate](FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
bool bSuccess)
1053 if (bSuccess && HttpResponse.IsValid())
1055 const int32 ResponseCode = HttpResponse->GetResponseCode();
1057 NETWORK_LOG(TEXT(
"[RES] Code: %d, Response: %s"), ResponseCode, *HttpResponse->GetContentAsString());
1063 InDelegate.ExecuteIfBound(ResponseData,
true);
1068 InDelegate.ExecuteIfBound(ResponseData,
false);
1073 NETWORK_LOG(TEXT(
"[RES] RequestReadScenario failed - bSuccess: %s, Response valid: %s"),
1074 bSuccess ? TEXT(
"true") : TEXT(
"false"),
1075 HttpResponse.IsValid() ? TEXT(
"true") : TEXT(
"false"));
1077 int32 ErrorCode = HttpResponse.IsValid() ? HttpResponse->GetResponseCode() : 0;
1078 FString ErrorContent = HttpResponse.IsValid() ? HttpResponse->GetContentAsString() : TEXT(
"Network connection failed");
1081 InDelegate.ExecuteIfBound(ResponseData,
false);
1086 Request->ProcessRequest();
1095 FString RequestBody;
1097 Request->SetContentAsString(RequestBody);
1101 Request->OnProcessRequestComplete().BindLambda(
1102 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](FHttpRequestPtr Req, FHttpResponsePtr ResPtr,
bool bWasSuccessful)
1104 if (!WeakThis.IsValid() || IsEngineExitRequested())
1107 WeakThis->ShowLoadingCircle(
false);
1111 if (bWasSuccessful && ResPtr.IsValid())
1113 const int32 ResponseCode = ResPtr->GetResponseCode();
1115 NETWORK_LOG(TEXT(
"[RES] RequestListenResult - Code: %d, Response: %s"),
1116 ResponseCode, *ResPtr->GetContentAsString());
1118 if (IsResSuccess(ResponseCode))
1120 ResponseData.SetFromHttpResponse(ResPtr);
1121 ResponseData.PrintData();
1122 InDelegate.ExecuteIfBound(ResponseData, true);
1126 WeakThis->ShowNetworkErrorPopup(ResponseCode, ResPtr->GetContentAsString());
1127 InDelegate.ExecuteIfBound(ResponseData, false);
1132 NETWORK_LOG(TEXT(
"[RES] RequestListenResult failed - bSuccess: %s, Response valid: %s"),
1133 bWasSuccessful ? TEXT(
"true") : TEXT(
"false"),
1134 ResPtr.IsValid() ? TEXT(
"true") : TEXT(
"false"));
1136 int32 ErrorCode = ResPtr.IsValid() ? ResPtr->GetResponseCode() : 0;
1137 FString ErrorContent = ResPtr.IsValid() ? ResPtr->GetContentAsString() : TEXT(
"Network connection failed");
1138 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
1140 InDelegate.ExecuteIfBound(ResponseData,
false);
1144 ShowLoadingCircle(
true);
1145 Request->ProcessRequest();
1162 Request->OnProcessRequestComplete().BindLambda(
1163 [
this, InDelegate](FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
bool bSuccess)
1169 if (bSuccess && HttpResponse.IsValid())
1171 const int32 ResponseCode = HttpResponse->GetResponseCode();
1180 InDelegate.ExecuteIfBound(ResponseData,
true);
1185 InDelegate.ExecuteIfBound(ResponseData,
false);
1190 NETWORK_LOG(TEXT(
"[RES] RequestSpeakScenario failed - bSuccess: %s, Response valid: %s"),
1191 bSuccess ? TEXT(
"true") : TEXT(
"false"),
1192 HttpResponse.IsValid() ? TEXT(
"true") : TEXT(
"false"));
1194 int32 ErrorCode = HttpResponse.IsValid() ? HttpResponse->GetResponseCode() : 0;
1195 FString ErrorContent = HttpResponse.IsValid() ? HttpResponse->GetContentAsString() : TEXT(
"Network connection failed");
1198 InDelegate.ExecuteIfBound(ResponseData,
false);
1203 Request->ProcessRequest();
1213 FString RequestBody;
1215 Request->SetContentAsString(RequestBody);
1219 Request->OnProcessRequestComplete().BindLambda(
1220 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](FHttpRequestPtr Req, FHttpResponsePtr ResPtr,
bool bWasSuccessful)
1222 if (!WeakThis.IsValid() || IsEngineExitRequested())
1225 WeakThis->ShowLoadingCircle(
false);
1229 if (bWasSuccessful && ResPtr.IsValid())
1231 const int32 ResponseCode = ResPtr->GetResponseCode();
1233 NETWORK_LOG(TEXT(
"[RES] FResponseSpeakResult - Code: %d, Response: %s"),
1234 ResponseCode, *ResPtr->GetContentAsString());
1236 if (IsResSuccess(ResponseCode))
1238 ResponseData.SetFromHttpResponse(ResPtr);
1239 ResponseData.PrintData();
1240 InDelegate.ExecuteIfBound(ResponseData, true);
1244 WeakThis->ShowNetworkErrorPopup(ResponseCode, ResPtr->GetContentAsString());
1245 InDelegate.ExecuteIfBound(ResponseData, false);
1250 NETWORK_LOG(TEXT(
"[RES] FResponseSpeakResult failed - bSuccess: %s, Response valid: %s"),
1251 bWasSuccessful ? TEXT(
"true") : TEXT(
"false"),
1252 ResPtr.IsValid() ? TEXT(
"true") : TEXT(
"false"));
1254 int32 ErrorCode = ResPtr.IsValid() ? ResPtr->GetResponseCode() : 0;
1255 FString ErrorContent = ResPtr.IsValid() ? ResPtr->GetContentAsString() : TEXT(
"Network connection failed");
1256 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
1258 InDelegate.ExecuteIfBound(ResponseData,
false);
1262 ShowLoadingCircle(
true);
1263 Request->ProcessRequest();
1279 Request->OnProcessRequestComplete().BindLambda(
1280 [
this, InDelegate](FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
bool bSuccess)
1286 if (bSuccess && HttpResponse.IsValid())
1288 const int32 ResponseCode = HttpResponse->GetResponseCode();
1290 NETWORK_LOG(TEXT(
"[RES] RequestEvaluationResult - Code: %d, Response: %s"),
1291 ResponseCode, *HttpResponse->GetContentAsString());
1297 InDelegate.ExecuteIfBound(ResponseData,
true);
1302 InDelegate.ExecuteIfBound(ResponseData,
false);
1307 NETWORK_LOG(TEXT(
"[GET] RequestEvaluationResult failed - bSuccess: %s, Response valid: %s"),
1308 bSuccess ? TEXT(
"true") : TEXT(
"false"),
1309 HttpResponse.IsValid() ? TEXT(
"true") : TEXT(
"false"));
1311 int32 ErrorCode = HttpResponse.IsValid() ? HttpResponse->GetResponseCode() : 0;
1312 FString ErrorContent = HttpResponse.IsValid() ? HttpResponse->GetContentAsString() : TEXT(
"Network connection failed");
1315 InDelegate.ExecuteIfBound(ResponseData,
false);
1320 Request->ProcessRequest();
1330 TMap<FString, FString> Query;
1331 Query.Add(TEXT(
"context"),
Context);
1332 Query.Add(TEXT(
"question"), Question);
1339 Request->OnProcessRequestComplete().BindLambda(
1340 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](
1341 FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
bool bSuccess)
1343 if (!WeakThis.IsValid() || IsEngineExitRequested())
1346 WeakThis->AddNetworkWaitCount(-1);
1349 if (bSuccess && HttpResponse.IsValid())
1351 const int32 ResponseCode = HttpResponse->GetResponseCode();
1353 NETWORK_LOG(TEXT(
"[RES] RequestChatAnswers - Code: %d, Response: %s"),
1354 ResponseCode, *HttpResponse->GetContentAsString());
1356 if (IsResSuccess(ResponseCode))
1358 ResponseData.SetFromHttpResponse(HttpResponse);
1359 ResponseData.PrintData();
1361 InDelegate.ExecuteIfBound(ResponseData, true);
1365 WeakThis->ShowNetworkErrorPopup(ResponseCode, HttpResponse->GetContentAsString());
1366 InDelegate.ExecuteIfBound(ResponseData, false);
1371 NETWORK_LOG(TEXT(
"[POST] RequestChatAnswers failed - bSuccess: %s, Response valid: %s"),
1372 bSuccess ? TEXT(
"true") : TEXT(
"false"),
1373 HttpResponse.IsValid() ? TEXT(
"true") : TEXT(
"false"));
1375 int32 ErrorCode = HttpResponse.IsValid() ? HttpResponse->GetResponseCode() : 0;
1376 FString ErrorContent = HttpResponse.IsValid() ? HttpResponse->GetContentAsString() : TEXT(
"Network connection failed");
1377 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
1379 InDelegate.ExecuteIfBound(ResponseData,
false);
1383 AddNetworkWaitCount(1);
1384 Request->ProcessRequest();
1398 FString AbsoluteAudioPath = FPaths::IsRelative(AudioPath)
1399 ? FPaths::Combine(FPaths::ProjectDir(), AudioPath)
1401 AbsoluteAudioPath = FPaths::ConvertRelativePathToFull(AbsoluteAudioPath);
1408 if (!Form.
AddFile(TEXT(
"audio"), AbsoluteAudioPath))
1410 NETWORK_LOG(TEXT(
"[POST] RequestChatAnswersWithAudio: audio file load failed: %s"), *AudioPath);
1412 InDelegate.ExecuteIfBound(EmptyResponse,
false);
1420 Request->OnProcessRequestComplete().BindLambda(
1421 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](
1422 FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
bool bSuccess)
1424 if (!WeakThis.IsValid() || IsEngineExitRequested())
1427 WeakThis->AddNetworkWaitCount(-1);
1430 if (bSuccess && HttpResponse.IsValid())
1432 const int32 ResponseCode = HttpResponse->GetResponseCode();
1434 NETWORK_LOG(TEXT(
"[RES] RequestChatAnswersWithAudio - Code: %d, Response: %s"),
1435 ResponseCode, *HttpResponse->GetContentAsString());
1437 if (IsResSuccess(ResponseCode))
1439 ResponseData.SetFromHttpResponse(HttpResponse);
1440 ResponseData.PrintData();
1441 InDelegate.ExecuteIfBound(ResponseData, true);
1445 WeakThis->ShowNetworkErrorPopup(ResponseCode, HttpResponse->GetContentAsString());
1446 InDelegate.ExecuteIfBound(ResponseData, false);
1451 NETWORK_LOG(TEXT(
"[POST] RequestChatAnswersWithAudio failed - bSuccess: %s, Response valid: %s"),
1452 bSuccess ? TEXT(
"true") : TEXT(
"false"),
1453 HttpResponse.IsValid() ? TEXT(
"true") : TEXT(
"false"));
1455 int32 ErrorCode = HttpResponse.IsValid() ? HttpResponse->GetResponseCode() : 0;
1456 FString ErrorContent = HttpResponse.IsValid() ? HttpResponse->GetContentAsString() : TEXT(
"Network connection failed");
1457 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
1459 InDelegate.ExecuteIfBound(ResponseData,
false);
1463 AddNetworkWaitCount(1);
1464 Request->ProcessRequest();
1474 TMap<FString, FString> Query;
1475 Query.Add(TEXT(
"system"),
Context);
1476 Query.Add(TEXT(
"question"), Question);
1483 Request->OnProcessRequestComplete().BindLambda(
1484 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](
1485 FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
bool bSuccess)
1487 if (!WeakThis.IsValid() || IsEngineExitRequested())
1490 WeakThis->ShowLoadingCircle(
false);
1493 if (bSuccess && HttpResponse.IsValid())
1495 const int32 ResponseCode = HttpResponse->GetResponseCode();
1497 NETWORK_LOG(TEXT(
"[RES] RequestChatDailys - Code: %d, Response: %s"),
1498 ResponseCode, *HttpResponse->GetContentAsString());
1500 if (IsResSuccess(ResponseCode))
1502 ResponseData.SetFromHttpResponse(HttpResponse);
1503 ResponseData.PrintData();
1505 InDelegate.ExecuteIfBound(ResponseData, true);
1509 WeakThis->ShowNetworkErrorPopup(ResponseCode, HttpResponse->GetContentAsString());
1510 InDelegate.ExecuteIfBound(ResponseData, false);
1515 NETWORK_LOG(TEXT(
"[POST] RequestChatDailys failed - bSuccess: %s, Response valid: %s"),
1516 bSuccess ? TEXT(
"true") : TEXT(
"false"),
1517 HttpResponse.IsValid() ? TEXT(
"true") : TEXT(
"false"));
1519 int32 ErrorCode = HttpResponse.IsValid() ? HttpResponse->GetResponseCode() : 0;
1520 FString ErrorContent = HttpResponse.IsValid() ? HttpResponse->GetContentAsString() : TEXT(
"Network connection failed");
1521 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
1523 InDelegate.ExecuteIfBound(ResponseData,
false);
1527 ShowLoadingCircle(
true);
1528 Request->ProcessRequest();
1542 FString AbsoluteAudioPath = FPaths::IsRelative(AudioPath)
1543 ? FPaths::Combine(FPaths::ProjectDir(), AudioPath)
1545 AbsoluteAudioPath = FPaths::ConvertRelativePathToFull(AbsoluteAudioPath);
1552 if (!Form.
AddFile(TEXT(
"audio"), AbsoluteAudioPath))
1554 NETWORK_LOG(TEXT(
"[POST] RequestChatDailysWithAudio: audio file load failed: %s"), *AudioPath);
1556 InDelegate.ExecuteIfBound(EmptyResponse,
false);
1564 Request->OnProcessRequestComplete().BindLambda(
1565 [WeakThis = TWeakObjectPtr<UKLingoNetworkSystem>(
this), InDelegate](
1566 FHttpRequestPtr HttpRequest, FHttpResponsePtr HttpResponse,
bool bSuccess)
1568 if (!WeakThis.IsValid() || IsEngineExitRequested())
1571 WeakThis->AddNetworkWaitCount(-1);
1574 if (bSuccess && HttpResponse.IsValid())
1576 const int32 ResponseCode = HttpResponse->GetResponseCode();
1578 NETWORK_LOG(TEXT(
"[RES] RequestChatDailysWithAudio - Code: %d, Response: %s"),
1579 ResponseCode, *HttpResponse->GetContentAsString());
1581 if (IsResSuccess(ResponseCode))
1583 ResponseData.SetFromHttpResponse(HttpResponse);
1584 ResponseData.PrintData();
1585 InDelegate.ExecuteIfBound(ResponseData, true);
1589 WeakThis->ShowNetworkErrorPopup(ResponseCode, HttpResponse->GetContentAsString());
1590 InDelegate.ExecuteIfBound(ResponseData, false);
1595 NETWORK_LOG(TEXT(
"[POST] RequestChatDailysWithAudio failed - bSuccess: %s, Response valid: %s"),
1596 bSuccess ? TEXT(
"true") : TEXT(
"false"),
1597 HttpResponse.IsValid() ? TEXT(
"true") : TEXT(
"false"));
1599 int32 ErrorCode = HttpResponse.IsValid() ? HttpResponse->GetResponseCode() : 0;
1600 FString ErrorContent = HttpResponse.IsValid() ? HttpResponse->GetContentAsString() : TEXT(
"Network connection failed");
1601 WeakThis->ShowNetworkErrorPopup(ErrorCode, ErrorContent);
1603 InDelegate.ExecuteIfBound(ResponseData,
false);
1607 AddNetworkWaitCount(1);
1608 Request->ProcessRequest();
APlayerControl 선언에 대한 Doxygen 주석을 제공합니다.
ENetworkLogType
네트워크 요청/응답 로그를 구분하는 타입입니다.
@ Post
HTTP POST 요청을 나타냅니다.
@ WS
WebSocket 메시지를 나타냅니다.
YiSan 전반에서 사용하는 공용 인터페이스를 선언합니다.
#define PRINTLOG(fmt,...)
#define NETWORK_LOG(fmt,...)
네트워크 요청과 응답에 사용되는 구조체 및 설정을 정의합니다.
YiSan 전반에서 사용하는 공용 인터페이스를 선언합니다.
TTS 오디오 데이터를 메모리와 디스크에 캐싱하는 서브시스템을 선언합니다.
KLingo API 요청을 담당하는 서브시스템을 선언합니다.
ULoadingCircleManager 클래스를 선언합니다.
void RequestSpeakingJudges(const FString &Question, const FString &AudioPath, FResponseSpeakingJudesDelegate InDelegate)
Speaking 평가 요청을 전송합니다.
TSharedRef< IHttpRequest, ESPMode::ThreadSafe > SetupHttpRequest(const FString &Url, const FString &Verb)
void RequestListenResult(const FRequestListenResult &Result, FResponseListenResultDelegate InDelegate)
Listen 결과 제출 요청을 전송합니다.
void RequestReadScenario(FResponseReadScenarioDelegate InDelegate)
Read 시나리오 조회 요청을 전송합니다.
void RequestUserToken(const FString &UserName, FResponseUserTokenDelegate InDelegate)
사용자 토큰 발급 요청을 전송합니다.
void RequestUserRegister(const FString &UserName, FResponseUserRegisterDelegate InDelegate)
사용자 등록 요청을 전송합니다.
void RequestChatQuestion(const FString &Context, const FString &Question, FResponseChatAnswersDelegate InDelegate)
Chat 답변을 요청합니다 (텍스트 질문).
void RequestChatAudio(const FString &Context, const FString &AudioPath, FResponseChatAnswersDelegate InDelegate)
Chat 답변을 요청합니다 (음성 질문).
static const TCHAR * GetLogPrefix(ENetworkLogType InLogType)
요청 타입에 맞는 로그 접두사를 반환합니다.
void ShowNetworkErrorPopup(int32 ResponseCode, const FString &ResponseContent)
네트워크 에러 팝업을 표시합니다.
void RequestSpeakResult(const FRequestSpeakResult &Result, FResponseSpeakResultDelegate InDelegate)
Speak 결과 제출 요청을 전송합니다.
void RequestInterviewAnswer(const FRequestInterviewAnswer &Answer, FResponseInterviewAnswerDelegate InDelegate)
인터뷰 답변 제출 요청을 전송합니다.
void RequestUserMe(FResponseUserMeDelegate InDelegate)
현재 사용자 정보를 조회합니다.
void RequestListenScenario(FResponseListenScenarioDelegate InDelegate)
Listen 시나리오 조회 요청을 전송합니다.
virtual void Deinitialize() override
등록된 델리게이트를 정리하고 서브시스템을 종료합니다.
void RequestInterviewHello(FResponseInterviewHelloDelegate InDelegate)
인터뷰 시작 요청을 전송합니다.
void RequestWriteQuestions(FResponseWriteQuestionDelegate InDelegate)
Write 문제 목록을 요청합니다.
void RequestDailyQuestion(const FString &Context, const FString &Question, FResponseChatDailysDelegate InDelegate)
Daily Chat 답변을 요청합니다 (텍스트 질문).
void RequestDailyAudio(const FString &Context, const FString &AudioPath, FResponseChatDailysDelegate InDelegate)
Daily Chat 답변을 요청합니다 (음성 질문).
virtual void Initialize(FSubsystemCollectionBase &Collection) override
HTTP 모듈 초기화 및 네트워크 대기 카운터를 설정합니다.
void RequestEvaluationResult(int32 RoomId, FResponseEvaluationResultDelegate InDelegate)
Evaluation 결과를 조회합니다.
void AddNetworkWaitCount(int Value)
네트워크 처리 대기 카운트를 갱신하고 UI에 통보합니다.
void RequestSpeakScenario(FResponseSpeakScenarioDelegate InDelegate)
Speak 시나리오 조회 요청을 전송합니다.
static bool IsResSuccess(const int InCode)
FString access_token
인증 토큰 (로그인 후 저장)
static void LogNetwork(ENetworkLogType InLogType, const FString &URL, const FString &Body=TEXT(""))
공통 네트워크 로그 메시지를 출력합니다.
void RequestReadResult(const FRequestReadResult &Result, FResponseReadResultDelegate InDelegate)
Read 결과 제출 요청을 전송합니다.
int NetworkWaitCount
처리 중인 요청 수를 집계하는 카운터입니다.
void RequestWriteResult(const FRequestWriteResult &Result, FResponseWriteResultDelegate InDelegate)
Write 결과 제출 요청을 전송합니다.
void ShowLoadingCircle(bool bShow)
LoadingCircle을 표시하거나 숨깁니다.
void RequestWriteSubmit(const TArray< FString > &ImagePathArray, TArray< FString > InTargetText, FResponseWriteSubmitDelegate InDelegate)
Write 제출 요청을 전송합니다.
void RequestListenAudio(const FString &AudioText, FResponseListenAudioDelegate InDelegate)
Listen 음성 생성 요청을 전송합니다.
static int32 GetStageTypeIndex(const EQuestType QuestType)
static class ALingoPlayerState * GetLingoPlayerState(const UObject *WorldContextObject)
static class ALingoGameState * GetLingoGameState(const UObject *WorldContextObject)
전역 로딩 서클의 표시 여부를 관리하는 LocalPlayerSubsystem입니다.
static FString GetFullUrlWithQuery(const FString &Endpoint, const TMap< FString, FString > &QueryParams)
Query 파라미터가 포함된 전체 URL을 반환합니다. 파라미터가 없으면 기본 URL만 반환합니다.
static FString GetFullUrl(const FString &Endpoint)
현재 서버 모드에 맞는 HTTP 엔드포인트 URL을 생성합니다.
static FString listen_result
static FString users_register
static FString wriite_result
static FString chats_daily
static FString speak_result
static FString listenings_audio
static FString interview_hello
static FString writes_submit
Write 답변 제출 엔드포인트입니다. POST /writes/submit
static FString chats_answers
Chat 답변 요청 엔드포인트입니다. POST /chats/answers
static FString speakings_judes
static FString read_result
static FString evaluations_rooms
Evaluation 결과 조회 엔드포인트입니다. GET /evaluations/rooms/{room_id}
static FString interview_answer
static FString scenario
Scenario 조회 엔드포인트입니다.
static FString users_token
bool IsValid() const
구조체 값이 유효한지 여부를 반환합니다.
bool ToJsonString(FString &OutJson) const
구조체를 JSON 문자열로 변환합니다.
bool ToJsonString(FString &OutJson) const
구조체를 JSON 문자열로 변환합니다.
bool ToJsonString(FString &OutJson) const
구조체를 JSON 문자열로 변환합니다.
bool ToJsonString(FString &OutJson) const
구조체를 JSON 문자열로 변환합니다.
bool ToJsonString(FString &OutJson) const
구조체를 JSON 문자열로 변환합니다.
void SetFromHttpResponse(const TSharedPtr< class IHttpResponse, ESPMode::ThreadSafe > &Response)
HTTP 응답을 파싱해 구조체를 채웁니다.
void PrintData() const
디버그 로그에 응답 내용을 출력합니다.
TArray< uint8 > audio_base64
void SetFromHttpResponse(const TSharedPtr< class IHttpResponse, ESPMode::ThreadSafe > &Response)
HTTP 응답을 파싱해 구조체를 채웁니다.
void SetFromHttpResponse(const TSharedPtr< class IHttpResponse, ESPMode::ThreadSafe > &Response)
HTTP 응답을 파싱해 구조체를 채웁니다.
void PrintData() const
디버그 로그에 응답 내용을 출력합니다.
void SetFromHttpResponse(const TSharedPtr< class IHttpResponse, ESPMode::ThreadSafe > &Response)
HTTP 응답을 파싱해 구조체를 채웁니다.
Speaking Questions 응답 구조체입니다.
void SetFromHttpResponse(const TSharedPtr< class IHttpResponse, ESPMode::ThreadSafe > &Response)
HTTP 응답을 파싱해 상태 정보를 갱신합니다.
void PrintData() const
디버그 로그에 응답 내용을 출력합니다.
void SetFromHttpResponse(const TSharedPtr< class IHttpResponse, ESPMode::ThreadSafe > &Response)
HTTP 응답을 파싱해 상태 정보를 갱신합니다.
void PrintData() const
디버그 로그에 응답 내용을 출력합니다.
void PrintData() const
디버그 로그에 응답 내용을 출력합니다.
void SetFromHttpResponse(const TSharedPtr< class IHttpResponse, ESPMode::ThreadSafe > &Response)
HTTP 응답을 파싱해 상태 정보를 갱신합니다.