Beispiel #1
0
        public static GuildConfig GetGuildFromName(string name)
        {
            GuildConfig ret = new GuildConfig();

            using (HttpClient client = new HttpClient())
            {
                string url      = "https://api.mlab.com/api/1/databases/triplezero/collections/Config.Guild/?apiKey=JmQkm6eGcaYwn_EqePgpNm57-0LcgA0O&q=%7B%22Name%22:%22" + name + "%22%7D";
                string response = client.GetStringAsync(url).Result;
                if (response != "")
                {
                    List <GuildConfig> result = JsonConvert.DeserializeObject <List <GuildConfig> >(response);
                    if (result.Count == 1)
                    {
                        return(result[0]);
                    }
                    else
                    {
                        return(null);
                    }
                }
                return(null);
            }
        }