From 07ffc9386ce1f6149a4f1cf6b8f7af4f947e9354 Mon Sep 17 00:00:00 2001 From: Raymond Lynch Date: Sat, 29 May 2021 21:12:25 -0400 Subject: [PATCH] StyleCop: Remove XivApi This class is internal, deprecated, and unused. So it should be removed. --- Dalamud/Dalamud.csproj | 4 +- Dalamud/XivApi.cs | 106 ----------------------------------------- 2 files changed, 2 insertions(+), 108 deletions(-) delete mode 100644 Dalamud/XivApi.cs diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index 63c642db9..13abbe738 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -1,8 +1,8 @@ - + AnyCPU net472 - 8.0 + 9.0 AnyCPU;x64 diff --git a/Dalamud/XivApi.cs b/Dalamud/XivApi.cs deleted file mode 100644 index 31b6f334b..000000000 --- a/Dalamud/XivApi.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; -using Microsoft.CSharp.RuntimeBinder; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Serilog; - -namespace Dalamud -{ - class XivApi - { - private const string URL = "https://xivapi.com/"; - - private static readonly ConcurrentDictionary cachedResponses = new ConcurrentDictionary(); - - [Obsolete("This class will not be supported anymore in the future. Please migrate to your own version.", true)] - public static async Task GetWorld(int world) - { - var res = await Get("World/" + world); - - return res; - } - - [Obsolete("This class will not be supported anymore in the future. Please migrate to your own version.", true)] - public static async Task GetClassJob(int id) - { - var res = await Get("ClassJob/" + id); - - return res; - } - - [Obsolete("This class will not be supported anymore in the future. Please migrate to your own version.", true)] - public static async Task GetFate(int id) - { - var res = await Get("Fate/" + id); - - return res; - } - - [Obsolete("This class will not be supported anymore in the future. Please migrate to your own version.", true)] - public static async Task GetCharacterSearch(string name, string world) - { - var res = await Get("character/search" + $"?name={name}&server={world}"); - - return res; - } - - [Obsolete("This class will not be supported anymore in the future. Please migrate to your own version.", true)] - public static async Task GetContentFinderCondition(int contentFinderCondition) { - return await Get("ContentFinderCondition/" + contentFinderCondition); - } - - [Obsolete("This class will not be supported anymore in the future. Please migrate to your own version.", true)] - public static async Task Search(string query, string indexes, int limit = 100, bool exact = false) { - query = System.Net.WebUtility.UrlEncode(query); - - var queryString = $"?string={query}&indexes={indexes}&limit={limit}"; - if (exact) - { - queryString += "&string_algo=match"; - } - - return await Get("search" + queryString); - } - - [Obsolete("This class will not be supported anymore in the future. Please migrate to your own version.", true)] - public static async Task GetMarketInfoWorld(int itemId, string worldName) { - return await Get($"market/{worldName}/item/{itemId}", true); - } - - [Obsolete("This class will not be supported anymore in the future. Please migrate to your own version.", true)] - public static async Task GetMarketInfoDc(int itemId, string dcName) { - return await Get($"market/item/{itemId}?dc={dcName}", true); - } - - [Obsolete("This class will not be supported anymore in the future. Please migrate to your own version.", true)] - public static async Task GetItem(uint itemId) { - return await Get($"Item/{itemId}", true); - } - - [Obsolete("This class will not be supported anymore in the future. Please migrate to your own version.", true)] - public static async Task Get(string endpoint, bool noCache = false) - { - Log.Verbose("XIVAPI FETCH: {0}", endpoint); - - if (cachedResponses.TryGetValue(endpoint, out var val) && !noCache) - return val; - - var client = new HttpClient(); - var response = await client.GetAsync(URL + endpoint); - var result = await response.Content.ReadAsStringAsync(); - - var obj = JObject.Parse(result); - - if (!noCache) - cachedResponses.TryAdd(endpoint, obj); - - return obj; - } - } -}