using System.Collections.Generic; using System.Linq; using Luski.net.Structures.Main; using Luski.net.Structures.Public; namespace Luski.net; public class API { public Server MainServer { get; internal set; } internal List> InternalServers { get; } = new(); public IReadOnlyList> LoadedServers => InternalServers.AsReadOnly(); public Server GetPublicServer(string Domain, string Version = "v1") { IEnumerable> isl = InternalServers.Where(a => (a.Domain == Domain && a.ApiVersion == Version)); if (isl.Any()) return isl.First(); Server s = new() { Domain = Domain, ApiVersion = Version, }; InternalServers.Add(s); return s; } public Server GetMainServer(string Domain, string Version = "v1") { MainServer = new() { Domain = Domain, ApiVersion = Version, }; return MainServer; } }