UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DownloadService.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "CoreMinimal.h"
5#include "Containers/Ticker.h"
7
8namespace BuildPatchServices
9{
10 class IDownloadServiceStat;
11 class IInstallerAnalytics;
12 class IHttpManager;
13 class IFileSystem;
14
19 {
20 public:
21 virtual ~IDownload() {}
22
27 virtual bool RequestSuccessful() const = 0;
28
33 virtual bool ResponseSuccessful() const = 0;
34
39 virtual int32 GetResponseCode() const = 0;
40
45 virtual const TArray<uint8>& GetData() const = 0;
46 };
48
55
61 DECLARE_DELEGATE_TwoParams(FDownloadCompleteDelegate, int32 /* RequestId */, const FDownloadRef& /* Download */);
62
67 {
68 public:
69 virtual ~IDownloadService() {}
70
78 virtual int32 RequestFile(const FString& FileUri, const FDownloadCompleteDelegate& OnCompleteDelegate, const FDownloadProgressDelegate& OnProgressDelegate) = 0;
79
81 virtual int32 RequestFileWithHeaders(const FString& FileUri, const TMap<FString, FString>& RequestHeaders, const FDownloadCompleteDelegate& OnCompleteDelegate, const FDownloadProgressDelegate& OnProgressDelegate) = 0;
82
87 virtual void RequestCancel(int32 RequestId) = 0;
88
93 virtual void RequestAbandon(int32 RequestId) = 0;
94 };
95
100 {
101 public:
110 static IDownloadService* Create(IHttpManager* HttpManager, IFileSystem* FileSystem, IDownloadServiceStat* DownloadServiceStat, IInstallerAnalytics* InstallerAnalytics);
111 };
112
118 {
119 public:
121
126 {
127 // The id for the request that was made.
129 // The uri used when making the request.
130 FString Uri;
131 // Whether the request completed successfully.
133 // The response code for the request.
135 // The timing record.
137 };
138
144 virtual void OnDownloadStarted(int32 RequestId, const FString& Uri) = 0;
145
151 virtual void OnDownloadProgress(int32 RequestId, uint64 BytesReceived) = 0;
152
158 };
159}
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DELEGATE_TwoParams(DelegateName, Param1Type, Param2Type)
Definition DelegateCombinations.h:57
Definition DownloadService.h:100
Definition DownloadService.h:118
virtual void OnDownloadStarted(int32 RequestId, const FString &Uri)=0
virtual ~IDownloadServiceStat()
Definition DownloadService.h:120
virtual void OnDownloadProgress(int32 RequestId, uint64 BytesReceived)=0
virtual void OnDownloadComplete(const FDownloadRecord &DownloadRecord)=0
Definition DownloadService.h:67
virtual ~IDownloadService()
Definition DownloadService.h:69
virtual int32 RequestFile(const FString &FileUri, const FDownloadCompleteDelegate &OnCompleteDelegate, const FDownloadProgressDelegate &OnProgressDelegate)=0
virtual int32 RequestFileWithHeaders(const FString &FileUri, const TMap< FString, FString > &RequestHeaders, const FDownloadCompleteDelegate &OnCompleteDelegate, const FDownloadProgressDelegate &OnProgressDelegate)=0
virtual void RequestAbandon(int32 RequestId)=0
virtual void RequestCancel(int32 RequestId)=0
Definition DownloadService.h:19
virtual bool ResponseSuccessful() const =0
virtual ~IDownload()
Definition DownloadService.h:21
virtual int32 GetResponseCode() const =0
virtual const TArray< uint8 > & GetData() const =0
virtual bool RequestSuccessful() const =0
Definition FileSystem.h:51
Definition HttpManager.h:15
Definition InstallerAnalytics.h:17
TSharedRef< IDownload, ESPMode::ThreadSafe > FDownloadRef
Definition DownloadService.h:47
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition SharedPointer.h:153
Definition BuildPatchFileConstructor.h:28
ISpeedRecorder::FRecord SpeedRecord
Definition DownloadService.h:136
FString Uri
Definition DownloadService.h:130
int32 ResponseCode
Definition DownloadService.h:134
int32 RequestId
Definition DownloadService.h:128
bool bSuccess
Definition DownloadService.h:132
Definition SpeedRecorder.h:18