-
Notifications
You must be signed in to change notification settings - Fork 1
/
EpicCaldera.cs
51 lines (47 loc) · 1.67 KB
/
EpicCaldera.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http.Json;
using System.Web;
namespace EricLauncher
{
public class CalderaRequest
{
public string? account_id { get; set; }
public string? exchange_code { get; set; }
public bool test_mode { get; set; }
public string? epic_app { get; set; }
public bool nvidia { get; set; }
public bool luna { get; set; }
public bool salmon { get; set; }
}
public class CalderaResponse
{
public string? provider { get; set; }
public string? jwt { get; set; }
}
class EpicCaldera
{
public const string CALDERA_HOST = "https://caldera-service-prod.ecosec.on.epicgames.com";
public const string CALDERA_RACP_PATH = "/caldera/api/v1/launcher/racp";
public static async Task<CalderaResponse?> GetCalderaResponse(string accountid, string exchangecode, string app)
{
HttpClient client = new();
client.BaseAddress = new Uri(CALDERA_HOST);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Add("User-Agent", "Caldera/UNKNOWN-UNKNOWN-UNKNOWN");
CalderaRequest req = new CalderaRequest
{
account_id = accountid,
exchange_code = exchangecode,
epic_app = app
};
HttpResponseMessage resp = await client.PostAsJsonAsync(CALDERA_RACP_PATH, req);
return await resp.Content.ReadFromJsonAsync<CalderaResponse>();
}
}
}