5#include "VaRest/Public/VaRestSubsystem.h"
9#include "HeadMountedDisplayFunctionLibrary.h"
10#include "GenericPlatform/GenericPlatformMisc.h"
14#define Log(pmt, ...) UE_LOG(LogApexAPI, Log, TEXT(pmt), ##__VA_ARGS__)
15#define Warn(pmt, ...) UE_LOG(LogApexAPI, Warning, TEXT(pmt), ##__VA_ARGS__)
16#define Error(pmt, ...) UE_LOG(LogApexAPI, Error, TEXT(pmt), ##__VA_ARGS__)
17#define Fatal(pmt, ...) UE_LOG(LogApexAPI, Fatal, TEXT(pmt), ##__VA_ARGS__)
21 , ApexSettings(nullptr)
22 , LaunchToken(TEXT(
""))
39 Fatal(
"No URL available. Please set the Server URI in the settings.");
43 URL.RemoveFromEnd(
"/");
44 if (!
URL.Contains(
"https://"))
46 if (
URL.Contains(
"http://"))
48 URL =
URL.Replace(TEXT(
"http://"), TEXT(
""));
51 URL.InsertAt(0,
"https://");
63 FString URLBody, URLScheme;
92 Super::Initialize(Collection);
99 DeviceModel = UHeadMountedDisplayFunctionLibrary::GetHMDDeviceName().ToString();
101 if (
DeviceModel.Equals(
"None", ESearchCase::IgnoreCase))
105 DeviceId = FGenericPlatformMisc::GetDeviceId();
108 DeviceId = FGenericPlatformMisc::GetDeviceMakeAndModel();
119 ApexSocket->OnApexAuthenticateComplete().AddLambda([&](UVaRestJsonObject* LoginJsonObject) ->
void {
HandleLogin(LoginJsonObject); });
126 if (!IntentData.IsEmpty())
128 Log(
"Parsing data from intent. Most likely was passed by URL.");
140 Log(
"Failed to find token.");
150 Log(
"Failed to find return target.");
160 Log(
"Failed to find return type.");
170 Log(
"Failed to find return params.");
174 FString PassedLaunchToken;
175 if (FParse::Value(FCommandLine::Get(), TEXT(
"-PIXO_TOKEN="), PassedLaunchToken))
177 Log(
"Token found: %s.", *PassedLaunchToken);
185 Log(
"Found intent data: %s", *InIntentData);
187 FString SplitPoint =
"?";
188 if (InIntentData.Split(SplitPoint, &URI, &Data))
190 Log(
"Grabbing data from full intent: %s", *Data);
191 TArray<FString> DataParts;
192 if (Data.ParseIntoArray(DataParts, TEXT(
"&")) > 0)
194 Log(
"Parsed into array.");
195 for (FString DataPart : DataParts)
197 Log(
"Intent part: %s", *DataPart);
198 if (DataPart.Contains(
"pixotoken"))
200 LaunchToken = DataPart.Replace(TEXT(
"pixotoken="), TEXT(
""));
204 if (DataPart.Contains(
"returntarget"))
206 ReturnTarget = DataPart.Replace(TEXT(
"returntarget="), TEXT(
""));
210 if (DataPart.Contains(
"targettype"))
216 if (DataPart.Contains(
"optional"))
243 Warn(
"Web Socket already connected.");
258 Log(
"UApexAPI::SetExitTarget");
265 Log(
"UApexAPI::SetExitParameters");
271 Log(
"UApexAPI::ExitApplication %s %s", *InReturnTarget, *InReturnTargetType);
275 FString Parameters =
"";
283 if (!InReturnTarget.IsEmpty())
285 Parameters +=
"&returntarget=" + InReturnTarget;
288 if (!InReturnTargetType.IsEmpty())
290 Parameters +=
"&targettype=" + InReturnTargetType;
298 if (Parameters.IsEmpty() ==
false)
300 ReturnURL +=
"?" + Parameters;
302 Log(
"Custom Target: %s", *ReturnURL);
307 TArray<FString> Keys, Values;
308 Keys.Add(
"pixotoken");
313 Keys.Add(
"optional");
317 if (!InReturnTarget.IsEmpty())
319 Keys.Add(
"returntarget");
320 Values.Add(InReturnTarget);
323 if (!InReturnTargetType.IsEmpty())
325 Keys.Add(
"targettype");
326 Values.Add(InReturnTargetType);
333 if (
URL.Contains(
"apexsa.") ||
URL.Contains(
"saudi."))
335 FString ReturnURL =
"pixovr://com.PixoVR.SA_TrainingAcademy?" + Parameters;
336 Log(
"Training Hub: %s", *ReturnURL);
341 FString ReturnURL =
"pixovr://com.PixoVR.PixoHub?" + Parameters;
342 Log(
"Hub App: %s", *ReturnURL);
349 UVaRestRequestJSON* Request =
VaRestSubsystem->ConstructVaRestRequestExt(EVaRestRequestVerb::GET, EVaRestRequestContentType::none);
350 FString RequestURL =
URL +
"/ping";
351 Request->SetURL(RequestURL);
353 Request->OnStaticRequestComplete.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnPingComplete(Request); });
354 Request->OnStaticRequestFail.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnPingFail(Request); });
356 Request->ExecuteProcessRequest();
361 Log(
"On Ping Completed!");
368 Log(
"On Ping Failed!");
370 UVaRestJsonObject* ResponseObject = Request->GetResponseObject();
373 APEXFailedRequest.
FromJsonObject(ResponseObject->GetRootObject());
382 UVaRestRequestJSON* Request =
VaRestSubsystem->ConstructVaRestRequestExt(EVaRestRequestVerb::GET, EVaRestRequestContentType::none);
383 FString RequestURL =
URL +
"/v2/auth/validate-signature";
386 RequestURL = RequestURL.Replace(TEXT(
"modules."), TEXT(
""));
388 Request->SetURL(RequestURL);
389 Request->SetHeader(
"Authorization: Bearer",
LaunchToken);
391 Request->OnStaticRequestComplete.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnLoginComplete(Request); });
392 Request->OnStaticRequestFail.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnLoginFail(Request); });
394 Request->ExecuteProcessRequest();
399 Log(
"UApexAPI::FilloutLaunchToken");
403void UApexAPI::Login(
const FString& InUserName,
const FString& InPassword,
bool bShouldLogout)
410 UVaRestRequestJSON* Request =
VaRestSubsystem->ConstructVaRestRequestExt(EVaRestRequestVerb::POST, EVaRestRequestContentType::json);
411 FString RequestURL =
URL +
"/login";
412 Request->SetURL(RequestURL);
414 UVaRestJsonObject* LoginJson =
VaRestSubsystem->ConstructVaRestJsonObject();
415 LoginJson->SetField(
"login",
VaRestSubsystem->ConstructJsonValueString(InUserName));
416 LoginJson->SetField(
"password",
VaRestSubsystem->ConstructJsonValueString(InPassword));
418 Request->SetRequestObject(LoginJson);
420 Request->OnStaticRequestComplete.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnLoginComplete(Request); });
421 Request->OnStaticRequestFail.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnLoginFail(Request); });
423 Request->ExecuteProcessRequest();
439 bool FailedResponse =
true;
440 if (Request->GetResponseCode() == 200)
442 if (!Request->GetResponseObject()->GetRootObject()->HasField(
"Error"))
444 FailedResponse =
false;
457 Log(
"Login failed with response code %i", Request->GetResponseCode());
459 UVaRestJsonObject* ResponseObject = Request->GetResponseObject();
462 APEXFailedRequest.
FromJsonObject(ResponseObject->GetRootObject());
471 Log(
"Login Completed!");
474 Warn(
"Replacing the current login.");
485 if (RootJsonObject->HasField(
"User"))
487 return RootJsonObject->GetObjectField(
"User").ToSharedRef();
490 return RootJsonObject;
495 const UVaRestRequestJSON* DummyRequestJSON =
VaRestSubsystem->ConstructVaRestRequest();
507 APEXFailedRequest.
Error =
true;
508 APEXFailedRequest.
Message =
"No user currently logged in.";
510 UVaRestJsonObject* ResponseObject = DummyRequestJSON->GetResponseObject();
511 ResponseObject->SetBoolField(
"Error", APEXFailedRequest.
Error);
512 ResponseObject->SetStringField(
"Message", APEXFailedRequest.
Message);
521 bool FailedResponse =
true;
522 if (Request->GetResponseCode() == 200)
524 if (!Request->GetResponseObject()->GetRootObject()->HasField(
"Error"))
539 Log(
"Logout failed with response code %i", Request->GetResponseCode());
541 UVaRestJsonObject* ResponseObject = Request->GetResponseObject();
544 APEXFailedRequest.
FromJsonObject(ResponseObject->GetRootObject());
552 UVaRestRequestJSON* Request =
VaRestSubsystem->ConstructVaRestRequestExt(EVaRestRequestVerb::GET, EVaRestRequestContentType::none);
554 FString OptionalParameters = TEXT(
"");
556 if (!SerialNumber.IsEmpty())
558 OptionalParameters =
"?serial=" + SerialNumber;
559 Log(
"Serial number: %s", *SerialNumber);
562 FStringFormatOrderedArguments FormatArguments;
563 FormatArguments.Add(FStringFormatArg(
URL));
565 FormatArguments.Add(FStringFormatArg(InModuleId));
566 FormatArguments.Add(FStringFormatArg(OptionalParameters));
568 FString AccessURL = FString::Format(TEXT(
"{0}/access/user/{1}/module/{2}{3}"), FormatArguments);
569 Request->SetURL(AccessURL);
572 Request->OnStaticRequestComplete.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnUserVerificationComplete(Request); });
573 Request->OnStaticRequestFail.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnUserVerificationFail(Request); });
575 Request->ExecuteProcessRequest();
580 bool FailedResponse =
true;
581 if (Request->GetResponseCode() == 200)
583 UVaRestJsonObject* ResponseObject = Request->GetResponseObject();
584 if (!ResponseObject->GetRootObject()->HasField(
"error"))
586 Log(
"User Verification Completed!");
588 if (ResponseObject->HasField(
"access"))
590 FailedResponse = !ResponseObject->GetBoolField(
"access");
593 if (FailedResponse ==
false)
609 Log(
"User module access verification failed with response code %i", Request->GetResponseCode());
611 UVaRestJsonObject* ResponseObject = Request->GetResponseObject();
613 if (Request->GetResponseCode() == 200)
615 if (ResponseObject->GetRootObject()->HasField(
"access"))
617 APEXFailedRequest.
Error =
true;
618 APEXFailedRequest.
Message =
"User does not have access to this module.";
622 APEXFailedRequest.
FromJsonObject(ResponseObject->GetRootObject());
634 Error(
"Cannot join session with no active login.");
638 if (!InScenarioId.IsEmpty())
649 Error(
"Session is already in progress. The previous session didn't complete or a new session was started during an active session.");
670 Activity.
ID = FString::Format(TEXT(
"https://pixovr.com/xapi/objects/{0}/{1}"), IdFormat);
678 if (!InContextExtension.
IsEmpty())
680 ContextExtension.
Clone(InContextExtension);
683 Context.Extensions = ContextExtension;
685 Context.Extensions.AddString(
"device_id",
DeviceId);
686 Context.Extensions.AddString(
"device_model",
DeviceModel);
690 Context.Extensions.AddString(
"multiplayer",
"true");
693 Statement.
Actor = Actor;
694 Statement.
Verb = Verb;
695 Statement.
Target = Activity;
706 UVaRestRequestJSON* Request =
VaRestSubsystem->ConstructVaRestRequestExt(EVaRestRequestVerb::POST, EVaRestRequestContentType::json);
707 FString RequestURL =
URL +
"/event";
708 Request->SetURL(RequestURL);
711 UVaRestJsonObject* JoinSessionJson =
VaRestSubsystem->ConstructVaRestJsonObject();
712 JoinSessionJson->SetRootObject(JoinData.
ToJsonObject());
714 Request->SetRequestObject(JoinSessionJson);
716 Request->OnStaticRequestComplete.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnJoinSessionComplete(Request); });
717 Request->OnStaticRequestFail.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnJoinSessionFail(Request); });
719 Request->ExecuteProcessRequest();
726 Log(
"Session was successfully joined.");
727 if (Request->GetResponseCode() == 200)
729 UVaRestJsonObject* ResponseObject = Request->GetResponseObject();
743 Log(
"Failed to join session. %d", Request->GetResponseCode());
747 UVaRestJsonObject* ResponseObject = Request->GetResponseObject();
750 APEXFailedRequest.
FromJsonObject(ResponseObject->GetRootObject());
760 Error(
"Cannot complete session with no active login.");
766 Error(
"No current session in progress.");
795 Context.Extensions.AddString(
"device_id",
DeviceId);
796 Context.Extensions.AddString(
"device_model",
DeviceModel);
812 Statement.
Actor = Actor;
813 Statement.
Verb = Verb;
814 Statement.
Target = Activity;
816 Statement.
Result = Result;
827 UVaRestRequestJSON* Request =
VaRestSubsystem->ConstructVaRestRequestExt(EVaRestRequestVerb::POST, EVaRestRequestContentType::json);
828 FString RequestURL =
URL +
"/event";
829 Request->SetURL(RequestURL);
832 UVaRestJsonObject* CompleteSessionJson =
VaRestSubsystem->ConstructVaRestJsonObject();
833 CompleteSessionJson->SetRootObject(SessionData.
ToJsonObject());
835 Request->SetRequestObject(CompleteSessionJson);
837 Request->OnStaticRequestComplete.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnCompleteSessionComplete(Request); });
838 Request->OnStaticRequestFail.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnCompleteSessionFail(Request); });
840 Request->ExecuteProcessRequest();
847 Log(
"Session complete!");
856 Warn(
"Failed to complete session. %d", Request->GetResponseCode());
858 UVaRestJsonObject* ResponseObject = Request->GetResponseObject();
861 APEXFailedRequest.
FromJsonObject(ResponseObject->GetRootObject());
872 Error(
"Cannot complete session with no active login.");
878 Error(
"No current session in progress.");
884 Error(
"No event data to send.");
890 Warn(
"Actor data should not be filled out.");
895 Error(
"Verb missing from eventStatement.");
899 if (EventStatement.
Verb.
ID.IsEmpty())
901 Error(
"Verb ID missing from eventStatement.");
907 Error(
"Object (target) missing from eventStatement.");
929 UVaRestRequestJSON* Request =
VaRestSubsystem->ConstructVaRestRequestExt(EVaRestRequestVerb::POST, EVaRestRequestContentType::json);
930 FString RequestURL =
URL +
"/event";
931 Request->SetURL(RequestURL);
934 UVaRestJsonObject* CompleteSessionJson =
VaRestSubsystem->ConstructVaRestJsonObject();
935 CompleteSessionJson->SetRootObject(Event.
ToJsonObject());
937 Request->SetRequestObject(CompleteSessionJson);
939 Request->OnStaticRequestComplete.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnSendSessionEventComplete(Request); });
940 Request->OnStaticRequestFail.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnSendSessionEventFail(Request); });
942 Request->ExecuteProcessRequest();
949 Log(
"Session event was sent successfully.");
956 Warn(
"Failed to send session event. %d", Request->GetResponseCode());
958 UVaRestJsonObject* ResponseObject = Request->GetResponseObject();
961 APEXFailedRequest.
FromJsonObject(ResponseObject->GetRootObject());
979 return FetchTopTen(UserId, -1.f, Scenario, OrgUnit);
984 return FetchTopTen(-1, TimePriorToToday, Scenario, OrgUnit);
991 Error(
"Cannot complete session with no active login.");
995 UVaRestRequestJSON* Request =
VaRestSubsystem->ConstructVaRestRequestExt(EVaRestRequestVerb::GET, EVaRestRequestContentType::none);
996 FString URLFormat =
"{url}/analytics/top10/module/{moduleId}";
997 FStringFormatNamedArguments FormatArguments;
1001 URLFormat +=
"/user/{userId}";
1004 FString DataQueryFormat =
"?";
1006 if (!Scenario.IsEmpty())
1008 DataQueryFormat +=
"scenario={moduleId}/{scenario}&";
1011 if (TimePriorToToday > 0.0f)
1013 DataQueryFormat +=
"dateRange={dateRange}&";
1018 DataQueryFormat +=
"orgUnit={orgUnit}&";
1021 if (DataQueryFormat.EndsWith(
"&"))
1023 DataQueryFormat.RemoveFromEnd(
"&");
1026 URLFormat += DataQueryFormat;
1028 FormatArguments.Add(
"url", FStringFormatArg(
URL));
1029 FormatArguments.Add(
"moduleId", FStringFormatArg(
LoadedModuleId));
1030 FormatArguments.Add(
"userId", FStringFormatArg(UserId));
1031 FormatArguments.Add(
"dateRange", FStringFormatArg(TimePriorToToday));
1032 FormatArguments.Add(
"scenario", FStringFormatArg(Scenario));
1033 FormatArguments.Add(
"orgUnit", FStringFormatArg(OrgUnit));
1034 FString AnalyticsURL = FString::Format(*URLFormat, FormatArguments);
1035 Request->SetURL(AnalyticsURL);
1038 Request->OnStaticRequestComplete.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnTopTenComplete(Request); });
1039 Request->OnStaticRequestFail.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
OnTopTenFail(Request); });
1041 Request->ExecuteProcessRequest();
1048 bool FailedResponse =
true;
1049 if (Request->GetResponseCode() == 200)
1051 UVaRestJsonObject* ResponseObject = Request->GetResponseObject();
1052 if (ResponseObject->HasField(
"error"))
1054 if (UVaRestJsonValue* ErrorField = ResponseObject->GetField(
"error"))
1056 if (ErrorField->GetType() == EVaJson::Boolean && !ErrorField->AsBool())
1058 Log(
"Successfully fetched top ten data!");
1061 FailedResponse =
false;
1064 FetchedTopTenData.
FromJsonObject(ResponseObject->GetRootObject());
1081 Log(
"Fetch Top Ten failed with response code %i", Request->GetResponseCode());
1083 UVaRestJsonObject* ResponseObject = Request->GetResponseObject();
1086 APEXFailedRequest.
FromJsonObject(ResponseObject->GetRootObject());
1096 Error(
"Trying to send heartbeat without a valid session.");
1105 UVaRestRequestJSON* Request =
VaRestSubsystem->ConstructVaRestRequestExt(EVaRestRequestVerb::POST, EVaRestRequestContentType::json);
1106 FString RequestURL =
URL.Replace(TEXT(
"modules."), TEXT(
"")) +
"/heartbeat/pulse";
1107 Request->SetURL(RequestURL);
1110 UVaRestJsonObject* HeartbeatJson =
VaRestSubsystem->ConstructVaRestJsonObject();
1111 HeartbeatJson->SetRootObject(HeartbeatEvent.
ToJsonObject());
1113 Request->SetRequestObject(HeartbeatJson);
1115 Request->OnStaticRequestComplete.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
Log(
"Heartbeat sent.") });
1116 Request->OnStaticRequestFail.AddLambda([&](UVaRestRequestJSON* Request) ->
void {
Log(
"Failed to send heartbeat.") });
1118 Request->ExecuteProcessRequest();
DEFINE_LOG_CATEGORY_STATIC(LogApexAPI, Log, All)
static bool IsAvailable()
UApexSDKSettings * GetSettings() const
static FApexSDKModule & Get()
bool SendSessionEvent(const FXAPIStatement &InStatement)
UFUNCTION(BlueprintCallable, Category = "Apex|API")
bool FetchTopTenByTimeRange(float TimePriorToToday, FString Scenario, int OrgUnit)
UFUNCTION(BlueprintCallable, Category = "Apex|API")
void OnLogoutComplete(const class UVaRestRequestJSON *Request)
bool IsLoggedIn()
UFUNCTION(BlueprintPure, BlueprintCallable, Category = "Apex|API")
void Login(const FString &InUserName, const FString &InPassword, bool bShouldLogout=true)
UFUNCTION(BlueprintCallable, Category = "Apex|API")
bool bWebSocketEnabled
UPROPERTY(BlueprintReadOnly)
bool CompleteSession(const FSessionData &InSessionData)
UFUNCTION(BlueprintCallable, Category = "Apex|API")
FString ReturnTargetType
UPROPERTY(BlueprintReadOnly)
class UVaRestSubsystem * VaRestSubsystem
FOnStaticApexRequestFail OnStaticRequestFail
FString ReturnParameters
UPROPERTY(BlueprintReadOnly)
bool JoinSession(FString InScenarioId, const FXAPIExtension &InContextExtension, bool bIsMultiplayer=false)
UFUNCTION(BlueprintCallable, Category = "Apex|API")
void ExitApplication(const FString &InReturnTarget, const FString &InReturnTargetType)
UFUNCTION(BlueprintCallable, Category = "Apex|API")
FString Platform
UPROPERTY(BlueprintReadOnly)
void Ping()
UFUNCTION(BlueprintCallable, Category = "Apex|API")
class UPixoLauncherSubsystem * LauncherSubsystem
bool FetchTopTenByUser(int UserId, FString Scenario, int OrgUnit)
UFUNCTION(BlueprintCallable, Category = "Apex|API", meta=(DisplayName = "Fetch Top Ten By User"))
FOnStaticApexRequestComplete OnStaticRequestComplete
void OnTopTenFail(const class UVaRestRequestJSON *Request)
FOnStaticApexAuthCodeRetrieved OnStaticAuthorizationCodeRetrieved
void OnLoginComplete(const class UVaRestRequestJSON *Request)
void SetExitParameters(const FString &SetExitTarget)
UFUNCTION(BlueprintCallable, Category = "Apex|SDK")
void OnJoinSessionComplete(const class UVaRestRequestJSON *Request)
bool IsWebSocketConnected()
UFUNCTION(BlueprintCallable, Category = "Apex|API")
FOnApexRequestComplete OnRequestComplete
UPROPERTY(BlueprintAssignable, Category = "Apex|Event")
void HandleLogin(class UVaRestJsonObject *LoginJsonObject)
void ConnectWebSocketService()
UFUNCTION(BlueprintCallable, Category = "Apex|API", meta = (Tooltip = "This function only needs to be...
FTimerHandle HeartbeatHandle
bool HasLaunchAuthToken()
UFUNCTION(BlueprintPure, BlueprintCallable, Category = "Apex|API")
FGuid CurrentSessionGuid
UPROPERTY(BlueprintReadOnly)
void OnJoinSessionFail(const class UVaRestRequestJSON *Request)
FString ModuleVersion
UPROPERTY(BlueprintReadOnly)
FOnApexTopTenDataFail OnFetchTopTenFail
UPROPERTY(BlueprintAssignable, Category = "Apex|Event")
FOnApexWebSocketConnectFailed OnWebSocketConnectFailed
UPROPERTY(BlueprintAssignable, Category = "Apex|Event")
FOnApexRequestFail OnRequestFail
UPROPERTY(BlueprintAssignable, Category = "Apex|Event")
void SetupModuleSettings()
FOnApexWebSocketConnected OnWebSocketConnected
UPROPERTY(BlueprintAssignable, Category = "Apex|Event")
void OnSendSessionEventFail(const class UVaRestRequestJSON *Request)
void OnPingFail(const class UVaRestRequestJSON *Request)
void FilloutLaunchToken()
UFUNCTION(BlueprintCallable, Category = "Apex|API")
void OnLogoutFail(const class UVaRestRequestJSON *Request)
void OnSendSessionEventComplete(const class UVaRestRequestJSON *Request)
FOnStaticApexWebSocketDisconnected OnStaticWebSocketDisconnected
void RequestAuthorizationCode()
UFUNCTION(BlueprintCallable, Category = "Apex|API")
FOnApexTopTenDataComplete OnFetchTopTenComplete
UPROPERTY(BlueprintAssignable, Category = "Apex|Event")
virtual void Initialize(FSubsystemCollectionBase &Collection) override
void SetExitTarget(const FString &InExitTarget, const FString &InExitTargetType)
UFUNCTION(BlueprintCallable, Category = "Apex|SDK")
void Logout()
UFUNCTION(BlueprintCallable, Category = "Apex|API")
FString WebSocketURL
The API Websocket URL.
FString ScenarioId
UPROPERTY(BlueprintReadOnly)
FOnStaticApexTopTenDataFail OnStaticFetchTopTenFail
TUniquePtr< ApexWebSocket > ApexSocket
FUserSessionData CurrentActiveLogin
UPROPERTY(BlueprintReadOnly)
void VerifyModuleAccess(int InModuleId)
UFUNCTION(BlueprintCallable, Category = "Apex|API")
bool FetchTopTen(FString Scenario, int OrgUnit)
UFUNCTION(BlueprintCallable, Category = "Apex|API")
void ParseIntentData(const FString &InIntentData)
class UApexSDKSettings * ApexSettings
FOnStaticApexTopTenDataComplete OnStaticFetchTopTenComplete
void OnUserVerificationComplete(const class UVaRestRequestJSON *Request)
FString DeviceModel
UPROPERTY(BlueprintReadOnly)
FOnApexAuthCodeRetrieved OnAuthorizationCodeRetrieved
UPROPERTY(BlueprintAssignable, Category = "Apex|Event")
void OnTopTenComplete(const class UVaRestRequestJSON *Request)
void OnPingComplete(const class UVaRestRequestJSON *Request)
TSharedRef< FJsonObject > GetUserJsonObject(TSharedRef< FJsonObject > &RootJsonObject)
int LoadedModuleId
UPROPERTY(BlueprintReadWrite, Meta=(DisplayName="Module Id"))
void LoginWithAuthToken()
UFUNCTION(BlueprintCallable, Category = "Apex|API")
FOnApexWebSocketDisconnected OnWebSocketDisconnected
UPROPERTY(BlueprintAssignable, Category = "Apex|Event")
FString DeviceId
UPROPERTY(BlueprintReadOnly)
void OnUserVerificationFail(const class UVaRestRequestJSON *Request)
void OnLoginFail(const class UVaRestRequestJSON *Request)
bool bSessionInProgress
UPROPERTY(BlueprintReadOnly)
void OnCompleteSessionFail(const class UVaRestRequestJSON *Request)
FString ReturnTarget
UPROPERTY(BlueprintReadOnly)
FOnStaticApexWebSocketConnectFailed OnStaticWebSocketConnectFailed
FOnStaticApexWebSocketConnected OnStaticWebSocketConnected
void OnCompleteSessionComplete(const class UVaRestRequestJSON *Request)
bool FetchTopTenByCurrentUser(FString Scenario)
UFUNCTION(BlueprintCallable, Category = "Apex|API", meta = (DisplayName = "Fetch Top Ten By User"))
bool CheckModuleVersion()
FString ModuleVersion
UPROPERTY(Config, EditAnywhere, Category = "Apex", meta = (DisplayName = "Module Version"))
int ModuleId
UPROPERTY(Config, EditAnywhere, Category = "Apex", meta = (DisplayName = "Module ID"))
FString ServerURI
UPROPERTY(Config, EditAnywhere, Category = "Apex")
UCLASS(BlueprintType, Blueprintable, DisplayName = "PixoVR Launcher")
FString GetDeviceSerialNumber()
UFUNCTION(BlueprintCallable, Category = "PixoVR|Launcher")
bool LaunchApplication(const FString &ApplicationName, const TArray< FString > &ExtraKey, const TArray< FString > &ExtraValue)
UFUNCTION(BlueprintCallable, Category = "PixoVR|Launcher")
FString GetApplicationExtra(const FString &ExtraKey)
UFUNCTION(BlueprintCallable, Category = "PixoVR|Launcher")
FString GetIntentData()
UFUNCTION(BlueprintCallable, Category = "PixoVR|Launcher")
void OpenURL(const FString &URL)
UFUNCTION(BlueprintCallable, Category = "PixoVR|Launcher")
static const FString PIXOVR_SESSION_JOINED
static const FString PIXOVR_SESSION_EVENT
static const FString PIXOVR_SESSION_COMPLETE
static const FString MODULE_IDS
static const FString COMPLETED_SESSION
static const FString JOINED_SESSION
FString Message
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Failed Request")
bool Error
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Failed Request")
virtual void FromJsonObject(const TSharedPtr< FJsonObject > &JObject) override
FString Uuid
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Complete Session")
int ModuleId
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Complete Session")
FString DeviceId
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Complete Session")
FXAPIStatement JsonData
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Complete Session")
FString EventType
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Complete Session")
virtual TSharedPtr< FJsonObject > ToJsonObject() const override
virtual TSharedPtr< FJsonObject > ToJsonObject() const override
int SessionId
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR|Hearbeat Event")
virtual TSharedPtr< FJsonObject > ToJsonObject() const
FString IpAddress
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Join Session")
FString DeviceId
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Join Session")
int ModuleId
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Join Session")
FXAPIStatement JsonData
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Join Session")
FString Uuid
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Join Session")
FString EventType
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Join Session")
virtual void FromJsonObject(const TSharedPtr< FJsonObject > &JObject) override
int SessionId
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR|Platform|Session")
bool Complete
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Data")
float Score
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Data")
float ScoreMin
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Data")
float ScoreScaled
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Data")
float ScoreMax
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Data")
int Duration
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Data")
FXAPIExtension AdditionalContextData
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Data")
FXAPIExtension AdditionalResultData
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Data")
bool Success
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Data")
virtual TSharedPtr< FJsonObject > ToJsonObject() const override
FString DeviceId
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Event")
FXAPIStatement JsonData
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Event")
int ModuleId
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Event")
FString EventType
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Event")
FString Uuid
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|Session Event")
virtual void FromJsonObject(const TSharedPtr< FJsonObject > &JObject) override
virtual void FromJsonObject(const TSharedPtr< FJsonObject > &JObject) override
int ID
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|User Session Data")
FString FirstName
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|User Session Data")
int OrgUnit
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|User Session Data")
FString Email
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|User Session Data")
FString LastName
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|User Session Data")
FString SessionToken
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|User Session Data")
FString ID
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Activity")
virtual bool IsEmpty() const override
virtual bool IsEmpty() const override
FString MBox
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Agent")
FString Name
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Agent")
FString Revision
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Context")
FGuid Registration
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Context")
FXAPIExtension Extensions
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Context")
FString Platform
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Context")
void Clone(const FXAPIExtension &InExtension)
TSharedPtr< FJsonValue > & AddString(FString InKey, const FString &InValue)
TSharedPtr< FJsonValue > & AddCustomString(FString InKey, const FString &InValue)
virtual bool IsEmpty() const override
FString Add(FString InLanguage, FString InValue)
TOptional< FTimespan > Duration
FXAPIScore Score
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Result")
TOptional< bool > Success
TOptional< bool > Completion
FXAPIExtension Extensions
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Result")
FOptionalFloat Max
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Score")
FOptionalFloat Min
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Score")
FOptionalFloat Scaled
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Score")
FOptionalFloat Raw
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Score")
FXAPIAgent Actor
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Statement")
FXAPIResult Result
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Statement")
FXAPIContext Context
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Statement")
FXAPIVerb Verb
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Statement")
FXAPIActivity Target
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Statement")
virtual bool IsEmpty() const override
FString ID
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Verb")
FXAPILanguageMap Display
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Apex|XAPI|Verb")
virtual bool IsEmpty() const override