about summary refs log tree commit diff
path: root/LibMatrix/Homeservers/FederationClient.cs
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2024-02-09 16:32:46 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2024-02-09 16:32:46 +0100
commit4ef9ae4b396b0eb37036d4008e8cb40e468dbe73 (patch)
tree6bb4d25754fefc52333a5fc44dd721c333314240 /LibMatrix/Homeservers/FederationClient.cs
parentConsistently use EventId for event types (diff)
downloadLibMatrix-4ef9ae4b396b0eb37036d4008e8cb40e468dbe73.tar.xz
Apply syntax style to LibMatrix
Diffstat (limited to 'LibMatrix/Homeservers/FederationClient.cs')
-rw-r--r--LibMatrix/Homeservers/FederationClient.cs17
1 files changed, 6 insertions, 11 deletions
diff --git a/LibMatrix/Homeservers/FederationClient.cs b/LibMatrix/Homeservers/FederationClient.cs
index 6001862..288b6b5 100644
--- a/LibMatrix/Homeservers/FederationClient.cs
+++ b/LibMatrix/Homeservers/FederationClient.cs
@@ -23,33 +23,28 @@ public class FederationClient(string baseUrl) {
     public static async Task<FederationClient> Create(string baseUrl, string? proxy = null) {
         var homeserver = new FederationClient(baseUrl);
         homeserver.WellKnownUris = await new HomeserverResolverService().ResolveHomeserverFromWellKnown(baseUrl);
-        if(string.IsNullOrWhiteSpace(proxy) && string.IsNullOrWhiteSpace(homeserver.WellKnownUris.Client))
+        if (string.IsNullOrWhiteSpace(proxy) && string.IsNullOrWhiteSpace(homeserver.WellKnownUris.Client))
             Console.WriteLine($"Failed to resolve homeserver client URI for {baseUrl}");
-        if(string.IsNullOrWhiteSpace(proxy) && string.IsNullOrWhiteSpace(homeserver.WellKnownUris.Server))
+        if (string.IsNullOrWhiteSpace(proxy) && string.IsNullOrWhiteSpace(homeserver.WellKnownUris.Server))
             Console.WriteLine($"Failed to resolve homeserver server URI for {baseUrl}");
 
         if (!string.IsNullOrWhiteSpace(homeserver.WellKnownUris.Server))
-            homeserver.HttpClient = new() {
+            homeserver.HttpClient = new MatrixHttpClient {
                 BaseAddress = new Uri(proxy ?? homeserver.WellKnownUris.Server ?? throw new InvalidOperationException($"Failed to resolve homeserver server URI for {baseUrl}")),
                 Timeout = TimeSpan.FromSeconds(120)
             };
 
-        if (proxy is not null) {
-            homeserver.HttpClient.DefaultRequestHeaders.Add("MXAE_UPSTREAM", baseUrl);
-        }
+        if (proxy is not null) homeserver.HttpClient.DefaultRequestHeaders.Add("MXAE_UPSTREAM", baseUrl);
 
         return homeserver;
     }
-    
+
     public string BaseUrl { get; } = baseUrl;
 
     public MatrixHttpClient HttpClient { get; set; } = null!;
     public HomeserverResolverService.WellKnownUris WellKnownUris { get; set; } = null!;
 
-    public async Task<ServerVersionResponse> GetServerVersionAsync() {
-        return await HttpClient.GetFromJsonAsync<ServerVersionResponse>("/_matrix/federation/v1/version");
-    }
-
+    public async Task<ServerVersionResponse> GetServerVersionAsync() => await HttpClient.GetFromJsonAsync<ServerVersionResponse>("/_matrix/federation/v1/version");
 }
 
 public class ServerVersionResponse {