Files
UnrealEngine/Engine/Source/Developer/Horde/Public/HordeHttpClient.h
2025-05-18 13:04:45 +08:00

39 lines
912 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Containers/UnrealString.h"
#include "Interfaces/IHttpRequest.h"
#include "Interfaces/IHttpResponse.h"
class HORDE_API FHordeHttpClient
{
public:
FHordeHttpClient(FString InServerUrl);
~FHordeHttpClient();
bool Login(bool bUnattended, FFeedbackContext* Warn = nullptr);
bool LoginWithOidc(const TCHAR* Profile, bool bUnattended, FFeedbackContext* Warn = nullptr);
bool LoginWithEnvironmentVariable();
TSharedRef<IHttpRequest> CreateRequest(const TCHAR* Verb, const TCHAR* Path);
TSharedRef<IHttpResponse> Get(const TCHAR* Path);
template<typename T>
T Get(const TCHAR* Path)
{
T Result;
Result.FromJson(Get(Path)->GetContentAsString());
return Result;
}
static TSharedRef<IHttpResponse> ExecuteRequest(TSharedRef<IHttpRequest> Request);
private:
FString ServerUrl;
FString Token;
};