diff --git a/Interfaces/ISkuldAPIClient.cs b/Interfaces/ISkuldAPIClient.cs
index 8629903..7d1ae1b 100644
--- a/Interfaces/ISkuldAPIClient.cs
+++ b/Interfaces/ISkuldAPIClient.cs
@@ -5,117 +5,116 @@ using System;
using System.IO;
using System.Threading.Tasks;
-namespace Skuld.API
+namespace Skuld.API.Client;
+
+public interface ISkuldAPIClient : IDisposable
{
- public interface ISkuldAPIClient : IDisposable
- {
- #region Guild
- ///
- /// Get a guild
- ///
- /// Guild Id
- /// wrapped
- [Get("/guild/{id}")]
- public Task GetGuildAsync([Path] ulong id);
- #endregion Guild
-
- #region User
- ///
- /// Get a user
- ///
- /// User Id
- /// wrapped
- [Get("/user/{id}")]
- public Task GetUserAsync([Path] ulong id);
- #endregion User
-
- #region Experience
- ///
- /// Gets the experience leaderboard
- ///
- /// Guild Id, Accepts 0 for all
- /// %10 offset page
- /// wrapped
- [Get("/experience/{guildId}/{page}")]
- public Task GetExperienceLeaderboardAsync([Path] ulong guildId, [Path] int page = 0);
- #endregion Experience
-
- #region Money
- ///
- /// Gets the money leaderboard
- ///
- /// Guild Id, Accepts 0 for all
- /// %10 offset page
- /// wrapped
- [Get("/money/{guildId}/{page}")]
- public Task GetMoneyLeaderboardAsync([Path] ulong guildId, [Path] int page = 0);
- #endregion Money
-
- #region Profile
- ///
- /// Get a user's profile card
- ///
- /// User Id
- /// of profile card data
- [Get("/image/profile/{id}")]
- public Task GetProfileCardAsync([Path] ulong id);
-
- ///
- /// Get a user's profile card with guild attributes
- ///
- /// User Id
- /// Guild Id
- /// of profile card data
- [Get("/image/profile/{id}/{guildId}")]
- public Task GetProfileCardAsync([Path] ulong id, [Path] ulong guildId);
-
- ///
- /// Preview's a custom background image
- ///
- /// User Id
- /// Background to preview
- /// of profile card data
- [Get("/image/profile/{id}/example")]
- public Task GetExampleProfileCardAsync([Path] ulong id, [Query("previewBackground")] string previewBackground);
-
- #endregion Profile
-
- #region Rank
-
- ///
- /// Get a user's rank card
- ///
- /// User Id
- /// Guild Id
- /// of profile card data
- [Get("/image/rank/{id}/{guildId}")]
- public Task GetRankCardAsync([Path] ulong id, [Path] ulong guildId);
-
- #endregion Rank
-
- #region Leave/Join Card
-
- ///
- /// Get's the join card for a guild
- ///
- /// User Id
- /// Guild Id
- /// of join card
- [Get("/image/join/{id}/{guildId}")]
- public Task GetJoinCardAsync([Path] ulong id, [Path] ulong guildId);
-
- ///
- /// Get's the leave card for a guild
- ///
- /// User Id
- /// Guild Id
- /// of leave card
- [Get("/image/leave/{id}/{guildId}")]
- public Task GetLeaveCardAsync([Path] ulong id, [Path] ulong guildId);
-
- #endregion Leave/Join Card
-
- [Get("/image/magik")]
- public Task GetLiquidRescaledAsync([Query] string image);
- }
-}
+ #region Guild
+ ///
+ /// Get a guild
+ ///
+ /// Guild Id
+ /// wrapped
+ [Get("/guild/{id}")]
+ public Task GetGuildAsync([Path] ulong id);
+ #endregion Guild
+
+ #region User
+ ///
+ /// Get a user
+ ///
+ /// User Id
+ /// wrapped
+ [Get("/user/{id}")]
+ public Task GetUserAsync([Path] ulong id);
+ #endregion User
+
+ #region Experience
+ ///
+ /// Gets the experience leaderboard
+ ///
+ /// Guild Id, Accepts 0 for all
+ /// %10 offset page
+ /// wrapped
+ [Get("/experience/{guildId}/{page}")]
+ public Task GetExperienceLeaderboardAsync([Path] ulong guildId, [Path] int page = 0);
+ #endregion Experience
+
+ #region Money
+ ///
+ /// Gets the money leaderboard
+ ///
+ /// Guild Id, Accepts 0 for all
+ /// %10 offset page
+ /// wrapped
+ [Get("/money/{guildId}/{page}")]
+ public Task GetMoneyLeaderboardAsync([Path] ulong guildId, [Path] int page = 0);
+ #endregion Money
+
+ #region Profile
+ ///
+ /// Get a user's profile card
+ ///
+ /// User Id
+ /// of profile card data
+ [Get("/image/profile/{id}")]
+ public Task GetProfileCardAsync([Path] ulong id);
+
+ ///
+ /// Get a user's profile card with guild attributes
+ ///
+ /// User Id
+ /// Guild Id
+ /// of profile card data
+ [Get("/image/profile/{id}/{guildId}")]
+ public Task GetProfileCardAsync([Path] ulong id, [Path] ulong guildId);
+
+ ///
+ /// Preview's a custom background image
+ ///
+ /// User Id
+ /// Background to preview
+ /// of profile card data
+ [Get("/image/profile/{id}/example")]
+ public Task GetExampleProfileCardAsync([Path] ulong id, [Query("previewBackground")] string previewBackground);
+
+ #endregion Profile
+
+ #region Rank
+
+ ///
+ /// Get a user's rank card
+ ///
+ /// User Id
+ /// Guild Id
+ /// of profile card data
+ [Get("/image/rank/{id}/{guildId}")]
+ public Task GetRankCardAsync([Path] ulong id, [Path] ulong guildId);
+
+ #endregion Rank
+
+ #region Leave/Join Card
+
+ ///
+ /// Get's the join card for a guild
+ ///
+ /// User Id
+ /// Guild Id
+ /// of join card
+ [Get("/image/join/{id}/{guildId}")]
+ public Task GetJoinCardAsync([Path] ulong id, [Path] ulong guildId);
+
+ ///
+ /// Get's the leave card for a guild
+ ///
+ /// User Id
+ /// Guild Id
+ /// of leave card
+ [Get("/image/leave/{id}/{guildId}")]
+ public Task GetLeaveCardAsync([Path] ulong id, [Path] ulong guildId);
+
+ #endregion Leave/Join Card
+
+ [Get("/image/magik")]
+ public Task GetLiquidRescaledAsync([Query] string image);
+}
\ No newline at end of file
diff --git a/Skuld.API.Client.csproj b/Skuld.API.Client.csproj
new file mode 100644
index 0000000..4fc18ec
--- /dev/null
+++ b/Skuld.API.Client.csproj
@@ -0,0 +1,16 @@
+
+
+
+ net6.0
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Skuld.API.csproj b/Skuld.API.csproj
deleted file mode 100644
index f3b2598..0000000
--- a/Skuld.API.csproj
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
- net6.0
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SkuldAPI.cs b/SkuldAPI.cs
index ffd1ddd..67b04f5 100644
--- a/SkuldAPI.cs
+++ b/SkuldAPI.cs
@@ -7,170 +7,169 @@ using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
-namespace Skuld.API
+namespace Skuld.API.Client;
+
+public class SkuldAPI : ISkuldAPIClient, IDisposable
{
- public class SkuldAPI : ISkuldAPIClient, IDisposable
+ public static string WrapperVersion { get; } =
+ typeof(SkuldAPI).GetTypeInfo().Assembly.GetCustomAttribute()?.InformationalVersion ??
+ typeof(SkuldAPI).GetTypeInfo().Assembly.GetName().Version.ToString(3) ??
+ "Unknown";
+
+ private readonly ISkuldAPIClient _api;
+
+ static string ApiBase;
+ static string Token;
+ private bool disposedValue;
+
+ public SkuldAPI()
{
- public static string WrapperVersion { get; } =
- typeof(SkuldAPI).GetTypeInfo().Assembly.GetCustomAttribute()?.InformationalVersion ??
- typeof(SkuldAPI).GetTypeInfo().Assembly.GetName().Version.ToString(3) ??
- "Unknown";
- private readonly ISkuldAPIClient _api;
+ }
- static string ApiBase;
- static string Token;
- private bool disposedValue;
+ public SkuldAPI(string apiBase, string token)
+ {
+ ApiBase = apiBase;
+ Token = token;
- public SkuldAPI()
+ var httpClient = new HttpClient
{
+ BaseAddress = new Uri(ApiBase)
+ };
+ httpClient.DefaultRequestHeaders.Add("User-Agent", $"Skuld.API.Client.Client/v{WrapperVersion} (https://github.com/skuldbot/Skuld)");
+ if (!string.IsNullOrWhiteSpace(Token))
+ {
+ httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {Token}");
}
- public SkuldAPI(string apiBase, string token)
+ JsonSerializerSettings settings = new()
{
- ApiBase = apiBase;
- Token = token;
-
- var httpClient = new HttpClient
- {
- BaseAddress = new Uri(ApiBase)
- };
- httpClient.DefaultRequestHeaders.Add("User-Agent", $"Skuld.API.Client/v{WrapperVersion} (https://github.com/skuldbot/Skuld)");
-
- if (!string.IsNullOrWhiteSpace(Token))
- {
- httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {Token}");
- }
+ Formatting = Formatting.Indented,
+ NullValueHandling = NullValueHandling.Ignore
+ };
- JsonSerializerSettings settings = new()
- {
- Formatting = Formatting.Indented,
- NullValueHandling = NullValueHandling.Ignore
- };
-
- _api = new RestClient(httpClient)
- {
- JsonSerializerSettings = settings
- }.For();
- }
+ _api = new RestClient(httpClient)
+ {
+ JsonSerializerSettings = settings
+ }.For();
+ }
- ///
- /// Get a guild
- ///
- /// Guild Id
- /// wrapped
- public Task GetGuildAsync(ulong id)
- => !string.IsNullOrWhiteSpace(Token) ? _api.GetGuildAsync(id) : null;
-
- ///
- /// Get a user
- ///
- /// User Id
- /// wrapped
- public Task GetUserAsync(ulong id)
- => !string.IsNullOrWhiteSpace(Token) ? _api.GetUserAsync(id) : null;
-
- ///
- /// Get a user's profile card
- ///
- /// User Id
- /// of profile card data
- public Task GetProfileCardAsync(ulong id)
- => !string.IsNullOrWhiteSpace(Token) ? _api.GetProfileCardAsync(id) : null;
-
- ///
- /// Get a user's profile card with guild attributes
- ///
- /// User Id
- /// Guild Id
- /// of profile card data
- public Task GetProfileCardAsync(ulong id, ulong guildId)
- => !string.IsNullOrWhiteSpace(Token) ? _api.GetProfileCardAsync(id, guildId) : null;
-
- ///
- /// Get a user's rank card
- ///
- /// User Id
- /// Guild Id
- /// of profile card data
- public Task GetRankCardAsync(ulong id, ulong guildId)
- => !string.IsNullOrWhiteSpace(Token) ? _api.GetRankCardAsync(id, guildId) : null;
-
- ///
- /// Preview's a custom background image
- ///
- /// User Id
- /// Background to preview
- /// of profile card data
- public Task GetExampleProfileCardAsync(ulong id, string previewBackground)
- => !string.IsNullOrWhiteSpace(Token) ? _api.GetExampleProfileCardAsync(id, previewBackground) : null;
-
- ///
- /// Gets the experience leaderboard
- ///
- /// Guild Id, Accepts 0 for all
- /// %10 offset page
- /// wrapped
- public Task GetExperienceLeaderboardAsync(ulong guildId, int page = 0)
- => !string.IsNullOrWhiteSpace(Token) ? _api.GetExperienceLeaderboardAsync(guildId, page) : null;
-
- ///
- /// Gets the money leaderboard
- ///
- /// Guild Id, Accepts 0 for all
- /// %10 offset page
- /// wrapped
- public Task GetMoneyLeaderboardAsync(ulong guildId, int page = 0)
- => !string.IsNullOrWhiteSpace(Token) ? _api.GetMoneyLeaderboardAsync(guildId, page) : null;
-
- public Task GetLiquidRescaledAsync(string image)
- => !string.IsNullOrWhiteSpace(Token) ? _api.GetLiquidRescaledAsync(image) : null;
-
- ///
- /// Get's the join card for a guild
- ///
- /// User Id
- /// Guild Id
- /// of join card
- public Task GetJoinCardAsync(ulong id, ulong guildId)
- => !string.IsNullOrWhiteSpace(Token) ? _api.GetJoinCardAsync(id, guildId) : null;
-
- ///
- /// Get's the leave card for a guild
- ///
- /// User Id
- /// Guild Id
- /// of leave card
- public Task GetLeaveCardAsync(ulong id, ulong guildId)
- => !string.IsNullOrWhiteSpace(Token) ? _api.GetLeaveCardAsync(id, guildId) : null;
-
- protected virtual void Dispose(bool disposing)
+ ///
+ /// Get a guild
+ ///
+ /// Guild Id
+ /// wrapped
+ public Task GetGuildAsync(ulong id)
+ => !string.IsNullOrWhiteSpace(Token) ? _api.GetGuildAsync(id) : null;
+
+ ///
+ /// Get a user
+ ///
+ /// User Id
+ /// wrapped
+ public Task GetUserAsync(ulong id)
+ => !string.IsNullOrWhiteSpace(Token) ? _api.GetUserAsync(id) : null;
+
+ ///
+ /// Get a user's profile card
+ ///
+ /// User Id
+ /// of profile card data
+ public Task GetProfileCardAsync(ulong id)
+ => !string.IsNullOrWhiteSpace(Token) ? _api.GetProfileCardAsync(id) : null;
+
+ ///
+ /// Get a user's profile card with guild attributes
+ ///
+ /// User Id
+ /// Guild Id
+ /// of profile card data
+ public Task GetProfileCardAsync(ulong id, ulong guildId)
+ => !string.IsNullOrWhiteSpace(Token) ? _api.GetProfileCardAsync(id, guildId) : null;
+
+ ///
+ /// Get a user's rank card
+ ///
+ /// User Id
+ /// Guild Id
+ /// of profile card data
+ public Task GetRankCardAsync(ulong id, ulong guildId)
+ => !string.IsNullOrWhiteSpace(Token) ? _api.GetRankCardAsync(id, guildId) : null;
+
+ ///
+ /// Preview's a custom background image
+ ///
+ /// User Id
+ /// Background to preview
+ /// of profile card data
+ public Task GetExampleProfileCardAsync(ulong id, string previewBackground)
+ => !string.IsNullOrWhiteSpace(Token) ? _api.GetExampleProfileCardAsync(id, previewBackground) : null;
+
+ ///
+ /// Gets the experience leaderboard
+ ///
+ /// Guild Id, Accepts 0 for all
+ /// %10 offset page
+ /// wrapped
+ public Task GetExperienceLeaderboardAsync(ulong guildId, int page = 0)
+ => !string.IsNullOrWhiteSpace(Token) ? _api.GetExperienceLeaderboardAsync(guildId, page) : null;
+
+ ///
+ /// Gets the money leaderboard
+ ///
+ /// Guild Id, Accepts 0 for all
+ /// %10 offset page
+ /// wrapped
+ public Task GetMoneyLeaderboardAsync(ulong guildId, int page = 0)
+ => !string.IsNullOrWhiteSpace(Token) ? _api.GetMoneyLeaderboardAsync(guildId, page) : null;
+
+ public Task GetLiquidRescaledAsync(string image)
+ => !string.IsNullOrWhiteSpace(Token) ? _api.GetLiquidRescaledAsync(image) : null;
+
+ ///
+ /// Get's the join card for a guild
+ ///
+ /// User Id
+ /// Guild Id
+ /// of join card
+ public Task GetJoinCardAsync(ulong id, ulong guildId)
+ => !string.IsNullOrWhiteSpace(Token) ? _api.GetJoinCardAsync(id, guildId) : null;
+
+ ///
+ /// Get's the leave card for a guild
+ ///
+ /// User Id
+ /// Guild Id
+ /// of leave card
+ public Task GetLeaveCardAsync(ulong id, ulong guildId)
+ => !string.IsNullOrWhiteSpace(Token) ? _api.GetLeaveCardAsync(id, guildId) : null;
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposedValue)
{
- if (!disposedValue)
+ if (disposing)
{
- if (disposing)
- {
- // TODO: dispose managed state (managed objects)
- }
-
- // TODO: free unmanaged resources (unmanaged objects) and override finalizer
- // TODO: set large fields to null
- disposedValue = true;
+ // TODO: dispose managed state (managed objects)
}
- }
- // // TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources
- // ~SkuldAPI()
- // {
- // // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
- // Dispose(disposing: false);
- // }
- public void Dispose()
- {
- // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
- Dispose(disposing: true);
- GC.SuppressFinalize(this);
+ // TODO: free unmanaged resources (unmanaged objects) and override finalizer
+ // TODO: set large fields to null
+ disposedValue = true;
}
}
-}
+
+ // // TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources
+ // ~SkuldAPI()
+ // {
+ // // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
+ // Dispose(disposing: false);
+ // }
+ public void Dispose()
+ {
+ // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
+ Dispose(disposing: true);
+ GC.SuppressFinalize(this);
+ }
+}
\ No newline at end of file