A rhythm game net ranking service built on ATproto.
1using Godot;
2using Godot.Collections;
3public struct HttpResult {
4 public HttpRequest.Result Result { get; init; }
5 public int Status { get; init; }
6 public Dictionary<string, string> Headers { get; init; }
7 public string Body { get; init; }
8
9 public HttpResult(Variant[] result) {
10 Result = (HttpRequest.Result) result[0].AsInt64();
11 Status = result[1].AsInt32();
12 Headers = HeadersToDict(result[2].AsStringArray());
13 Body = result[3].AsByteArray().GetStringFromUtf8();
14 }
15
16 private static Dictionary<string, string> HeadersToDict(string[] headers) {
17 Dictionary<string, string> ret = new();
18 foreach (string s in headers) {
19 string[] split = s.Split(":");
20 ret[split[0]] = split[1].StripEdges();
21 }
22 return ret;
23 }
24}