Updates to API Client
This commit is contained in:
@@ -5,117 +5,116 @@ using System;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Skuld.API
|
namespace Skuld.API.Client;
|
||||||
|
|
||||||
|
public interface ISkuldAPIClient : IDisposable
|
||||||
{
|
{
|
||||||
public interface ISkuldAPIClient : IDisposable
|
#region Guild
|
||||||
{
|
/// <summary>
|
||||||
#region Guild
|
/// Get a guild
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Get a guild
|
/// <param name="id">Guild Id</param>
|
||||||
/// </summary>
|
/// <returns><see cref="EventResult"/> wrapped <see cref="Guild"/></returns>
|
||||||
/// <param name="id">Guild Id</param>
|
[Get("/guild/{id}")]
|
||||||
/// <returns><see cref="EventResult{T}"/> wrapped <see cref="Guild"/></returns>
|
public Task<EventResult> GetGuildAsync([Path] ulong id);
|
||||||
[Get("/guild/{id}")]
|
#endregion Guild
|
||||||
public Task<EventResult> GetGuildAsync([Path] ulong id);
|
|
||||||
#endregion Guild
|
|
||||||
|
|
||||||
#region User
|
#region User
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a user
|
/// Get a user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">User Id</param>
|
/// <param name="id">User Id</param>
|
||||||
/// <returns><see cref="EventResult{T}"/> wrapped <see cref="User"/></returns>
|
/// <returns><see cref="EventResult"/> wrapped <see cref="User"/></returns>
|
||||||
[Get("/user/{id}")]
|
[Get("/user/{id}")]
|
||||||
public Task<EventResult> GetUserAsync([Path] ulong id);
|
public Task<EventResult> GetUserAsync([Path] ulong id);
|
||||||
#endregion User
|
#endregion User
|
||||||
|
|
||||||
#region Experience
|
#region Experience
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the experience leaderboard
|
/// Gets the experience leaderboard
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="guildId">Guild Id, Accepts 0 for all</param>
|
/// <param name="guildId">Guild Id, Accepts 0 for all</param>
|
||||||
/// <param name="page">%10 offset page</param>
|
/// <param name="page">%10 offset page</param>
|
||||||
/// <returns><see cref="EventResult{T}"/> wrapped <see cref="UserExperience"/></returns>
|
/// <returns><see cref="EventResult"/> wrapped <see cref="UserExperience"/></returns>
|
||||||
[Get("/experience/{guildId}/{page}")]
|
[Get("/experience/{guildId}/{page}")]
|
||||||
public Task<EventResult> GetExperienceLeaderboardAsync([Path] ulong guildId, [Path] int page = 0);
|
public Task<EventResult> GetExperienceLeaderboardAsync([Path] ulong guildId, [Path] int page = 0);
|
||||||
#endregion Experience
|
#endregion Experience
|
||||||
|
|
||||||
#region Money
|
#region Money
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the money leaderboard
|
/// Gets the money leaderboard
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="guildId">Guild Id, Accepts 0 for all</param>
|
/// <param name="guildId">Guild Id, Accepts 0 for all</param>
|
||||||
/// <param name="page">%10 offset page</param>
|
/// <param name="page">%10 offset page</param>
|
||||||
/// <returns><see cref="EventResult{T}"/> wrapped <see cref="User"/></returns>
|
/// <returns><see cref="EventResult"/> wrapped <see cref="User"/></returns>
|
||||||
[Get("/money/{guildId}/{page}")]
|
[Get("/money/{guildId}/{page}")]
|
||||||
public Task<EventResult> GetMoneyLeaderboardAsync([Path] ulong guildId, [Path] int page = 0);
|
public Task<EventResult> GetMoneyLeaderboardAsync([Path] ulong guildId, [Path] int page = 0);
|
||||||
#endregion Money
|
#endregion Money
|
||||||
|
|
||||||
#region Profile
|
#region Profile
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a user's profile card
|
/// Get a user's profile card
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">User Id</param>
|
/// <param name="id">User Id</param>
|
||||||
/// <returns><see cref="Stream"/> of profile card data</returns>
|
/// <returns><see cref="Stream"/> of profile card data</returns>
|
||||||
[Get("/image/profile/{id}")]
|
[Get("/image/profile/{id}")]
|
||||||
public Task<Stream> GetProfileCardAsync([Path] ulong id);
|
public Task<Stream> GetProfileCardAsync([Path] ulong id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a user's profile card with guild attributes
|
/// Get a user's profile card with guild attributes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">User Id</param>
|
/// <param name="id">User Id</param>
|
||||||
/// <param name="id">Guild Id</param>
|
/// <param name="id">Guild Id</param>
|
||||||
/// <returns><see cref="Stream"/> of profile card data</returns>
|
/// <returns><see cref="Stream"/> of profile card data</returns>
|
||||||
[Get("/image/profile/{id}/{guildId}")]
|
[Get("/image/profile/{id}/{guildId}")]
|
||||||
public Task<Stream> GetProfileCardAsync([Path] ulong id, [Path] ulong guildId);
|
public Task<Stream> GetProfileCardAsync([Path] ulong id, [Path] ulong guildId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Preview's a custom background image
|
/// Preview's a custom background image
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">User Id</param>
|
/// <param name="id">User Id</param>
|
||||||
/// <param name="previewBackground">Background to preview</param>
|
/// <param name="previewBackground">Background to preview</param>
|
||||||
/// <returns><see cref="Stream"/> of profile card data</returns>
|
/// <returns><see cref="Stream"/> of profile card data</returns>
|
||||||
[Get("/image/profile/{id}/example")]
|
[Get("/image/profile/{id}/example")]
|
||||||
public Task<Stream> GetExampleProfileCardAsync([Path] ulong id, [Query("previewBackground")] string previewBackground);
|
public Task<Stream> GetExampleProfileCardAsync([Path] ulong id, [Query("previewBackground")] string previewBackground);
|
||||||
|
|
||||||
#endregion Profile
|
#endregion Profile
|
||||||
|
|
||||||
#region Rank
|
#region Rank
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a user's rank card
|
/// Get a user's rank card
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">User Id</param>
|
/// <param name="id">User Id</param>
|
||||||
/// <param name="guildId">Guild Id</param>
|
/// <param name="guildId">Guild Id</param>
|
||||||
/// <returns><see cref="Stream"/> of profile card data</returns>
|
/// <returns><see cref="Stream"/> of profile card data</returns>
|
||||||
[Get("/image/rank/{id}/{guildId}")]
|
[Get("/image/rank/{id}/{guildId}")]
|
||||||
public Task<Stream> GetRankCardAsync([Path] ulong id, [Path] ulong guildId);
|
public Task<Stream> GetRankCardAsync([Path] ulong id, [Path] ulong guildId);
|
||||||
|
|
||||||
#endregion Rank
|
#endregion Rank
|
||||||
|
|
||||||
#region Leave/Join Card
|
#region Leave/Join Card
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get's the join card for a guild
|
/// Get's the join card for a guild
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">User Id</param>
|
/// <param name="id">User Id</param>
|
||||||
/// <param name="guildId">Guild Id</param>
|
/// <param name="guildId">Guild Id</param>
|
||||||
/// <returns><see cref="Stream"/> of join card</returns>
|
/// <returns><see cref="Stream"/> of join card</returns>
|
||||||
[Get("/image/join/{id}/{guildId}")]
|
[Get("/image/join/{id}/{guildId}")]
|
||||||
public Task<Stream> GetJoinCardAsync([Path] ulong id, [Path] ulong guildId);
|
public Task<Stream> GetJoinCardAsync([Path] ulong id, [Path] ulong guildId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get's the leave card for a guild
|
/// Get's the leave card for a guild
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">User Id</param>
|
/// <param name="id">User Id</param>
|
||||||
/// <param name="guildId">Guild Id</param>
|
/// <param name="guildId">Guild Id</param>
|
||||||
/// <returns><see cref="Stream"/> of leave card</returns>
|
/// <returns><see cref="Stream"/> of leave card</returns>
|
||||||
[Get("/image/leave/{id}/{guildId}")]
|
[Get("/image/leave/{id}/{guildId}")]
|
||||||
public Task<Stream> GetLeaveCardAsync([Path] ulong id, [Path] ulong guildId);
|
public Task<Stream> GetLeaveCardAsync([Path] ulong id, [Path] ulong guildId);
|
||||||
|
|
||||||
#endregion Leave/Join Card
|
#endregion Leave/Join Card
|
||||||
|
|
||||||
[Get("/image/magik")]
|
[Get("/image/magik")]
|
||||||
public Task<Stream> GetLiquidRescaledAsync([Query] string image);
|
public Task<Stream> GetLiquidRescaledAsync([Query] string image);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
16
Skuld.API.Client.csproj
Normal file
16
Skuld.API.Client.csproj
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="RestEase" Version="1.5.7" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\submodules\Skuld.Core\Skuld.Core\Skuld.Core.csproj" />
|
||||||
|
<ProjectReference Include="..\..\submodules\Skuld.Models\Skuld.Models\Skuld.Models.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="RestEase" Version="1.5.5" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Skuld.Models\Skuld.Models\Skuld.Models.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
297
SkuldAPI.cs
297
SkuldAPI.cs
@@ -7,170 +7,169 @@ using System.Net.Http;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
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<AssemblyInformationalVersionAttribute>()?.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<AssemblyInformationalVersionAttribute>()?.InformationalVersion ??
|
|
||||||
typeof(SkuldAPI).GetTypeInfo().Assembly.GetName().Version.ToString(3) ??
|
|
||||||
"Unknown";
|
|
||||||
|
|
||||||
private readonly ISkuldAPIClient _api;
|
}
|
||||||
|
|
||||||
static string ApiBase;
|
public SkuldAPI(string apiBase, string token)
|
||||||
static string Token;
|
{
|
||||||
private bool disposedValue;
|
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;
|
Formatting = Formatting.Indented,
|
||||||
Token = token;
|
NullValueHandling = NullValueHandling.Ignore
|
||||||
|
};
|
||||||
|
|
||||||
var httpClient = new HttpClient
|
_api = new RestClient(httpClient)
|
||||||
{
|
{
|
||||||
BaseAddress = new Uri(ApiBase)
|
JsonSerializerSettings = settings
|
||||||
};
|
}.For<ISkuldAPIClient>();
|
||||||
httpClient.DefaultRequestHeaders.Add("User-Agent", $"Skuld.API.Client/v{WrapperVersion} (https://github.com/skuldbot/Skuld)");
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Token))
|
/// <summary>
|
||||||
|
/// Get a guild
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Guild Id</param>
|
||||||
|
/// <returns><see cref="EventResult"/> wrapped <see cref="Guild"/></returns>
|
||||||
|
public Task<EventResult> GetGuildAsync(ulong id)
|
||||||
|
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetGuildAsync(id) : null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">User Id</param>
|
||||||
|
/// <returns><see cref="EventResult"/> wrapped <see cref="User"/></returns>
|
||||||
|
public Task<EventResult> GetUserAsync(ulong id)
|
||||||
|
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetUserAsync(id) : null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a user's profile card
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">User Id</param>
|
||||||
|
/// <returns><see cref="Stream"/> of profile card data</returns>
|
||||||
|
public Task<Stream> GetProfileCardAsync(ulong id)
|
||||||
|
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetProfileCardAsync(id) : null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a user's profile card with guild attributes
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">User Id</param>
|
||||||
|
/// <param name="id">Guild Id</param>
|
||||||
|
/// <returns><see cref="Stream"/> of profile card data</returns>
|
||||||
|
public Task<Stream> GetProfileCardAsync(ulong id, ulong guildId)
|
||||||
|
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetProfileCardAsync(id, guildId) : null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a user's rank card
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">User Id</param>
|
||||||
|
/// <param name="guildId">Guild Id</param>
|
||||||
|
/// <returns><see cref="Stream"/> of profile card data</returns>
|
||||||
|
public Task<Stream> GetRankCardAsync(ulong id, ulong guildId)
|
||||||
|
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetRankCardAsync(id, guildId) : null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Preview's a custom background image
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">User Id</param>
|
||||||
|
/// <param name="previewBackground">Background to preview</param>
|
||||||
|
/// <returns><see cref="Stream"/> of profile card data</returns>
|
||||||
|
public Task<Stream> GetExampleProfileCardAsync(ulong id, string previewBackground)
|
||||||
|
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetExampleProfileCardAsync(id, previewBackground) : null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the experience leaderboard
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="guildId">Guild Id, Accepts 0 for all</param>
|
||||||
|
/// <param name="page">%10 offset page</param>
|
||||||
|
/// <returns><see cref="EventResult"/> wrapped <see cref="UserExperience"/></returns>
|
||||||
|
public Task<EventResult> GetExperienceLeaderboardAsync(ulong guildId, int page = 0)
|
||||||
|
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetExperienceLeaderboardAsync(guildId, page) : null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the money leaderboard
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="guildId">Guild Id, Accepts 0 for all</param>
|
||||||
|
/// <param name="page">%10 offset page</param>
|
||||||
|
/// <returns><see cref="EventResult"/> wrapped <see cref="User"/></returns>
|
||||||
|
public Task<EventResult> GetMoneyLeaderboardAsync(ulong guildId, int page = 0)
|
||||||
|
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetMoneyLeaderboardAsync(guildId, page) : null;
|
||||||
|
|
||||||
|
public Task<Stream> GetLiquidRescaledAsync(string image)
|
||||||
|
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetLiquidRescaledAsync(image) : null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get's the join card for a guild
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">User Id</param>
|
||||||
|
/// <param name="guildId">Guild Id</param>
|
||||||
|
/// <returns><see cref="Stream"/> of join card</returns>
|
||||||
|
public Task<Stream> GetJoinCardAsync(ulong id, ulong guildId)
|
||||||
|
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetJoinCardAsync(id, guildId) : null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get's the leave card for a guild
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">User Id</param>
|
||||||
|
/// <param name="guildId">Guild Id</param>
|
||||||
|
/// <returns><see cref="Stream"/> of leave card</returns>
|
||||||
|
public Task<Stream> GetLeaveCardAsync(ulong id, ulong guildId)
|
||||||
|
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetLeaveCardAsync(id, guildId) : null;
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (!disposedValue)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
{
|
{
|
||||||
httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {Token}");
|
// TODO: dispose managed state (managed objects)
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonSerializerSettings settings = new()
|
// TODO: free unmanaged resources (unmanaged objects) and override finalizer
|
||||||
{
|
// TODO: set large fields to null
|
||||||
Formatting = Formatting.Indented,
|
disposedValue = true;
|
||||||
NullValueHandling = NullValueHandling.Ignore
|
|
||||||
};
|
|
||||||
|
|
||||||
_api = new RestClient(httpClient)
|
|
||||||
{
|
|
||||||
JsonSerializerSettings = settings
|
|
||||||
}.For<ISkuldAPIClient>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get a guild
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">Guild Id</param>
|
|
||||||
/// <returns><see cref="EventResult{T}"/> wrapped <see cref="Guild"/></returns>
|
|
||||||
public Task<EventResult> GetGuildAsync(ulong id)
|
|
||||||
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetGuildAsync(id) : null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get a user
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">User Id</param>
|
|
||||||
/// <returns><see cref="EventResult{T}"/> wrapped <see cref="User"/></returns>
|
|
||||||
public Task<EventResult> GetUserAsync(ulong id)
|
|
||||||
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetUserAsync(id) : null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get a user's profile card
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">User Id</param>
|
|
||||||
/// <returns><see cref="Stream"/> of profile card data</returns>
|
|
||||||
public Task<Stream> GetProfileCardAsync(ulong id)
|
|
||||||
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetProfileCardAsync(id) : null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get a user's profile card with guild attributes
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">User Id</param>
|
|
||||||
/// <param name="id">Guild Id</param>
|
|
||||||
/// <returns><see cref="Stream"/> of profile card data</returns>
|
|
||||||
public Task<Stream> GetProfileCardAsync(ulong id, ulong guildId)
|
|
||||||
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetProfileCardAsync(id, guildId) : null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get a user's rank card
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">User Id</param>
|
|
||||||
/// <param name="guildId">Guild Id</param>
|
|
||||||
/// <returns><see cref="Stream"/> of profile card data</returns>
|
|
||||||
public Task<Stream> GetRankCardAsync(ulong id, ulong guildId)
|
|
||||||
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetRankCardAsync(id, guildId) : null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Preview's a custom background image
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">User Id</param>
|
|
||||||
/// <param name="previewBackground">Background to preview</param>
|
|
||||||
/// <returns><see cref="Stream"/> of profile card data</returns>
|
|
||||||
public Task<Stream> GetExampleProfileCardAsync(ulong id, string previewBackground)
|
|
||||||
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetExampleProfileCardAsync(id, previewBackground) : null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the experience leaderboard
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="guildId">Guild Id, Accepts 0 for all</param>
|
|
||||||
/// <param name="page">%10 offset page</param>
|
|
||||||
/// <returns><see cref="EventResult{T}"/> wrapped <see cref="UserExperience"/></returns>
|
|
||||||
public Task<EventResult> GetExperienceLeaderboardAsync(ulong guildId, int page = 0)
|
|
||||||
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetExperienceLeaderboardAsync(guildId, page) : null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the money leaderboard
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="guildId">Guild Id, Accepts 0 for all</param>
|
|
||||||
/// <param name="page">%10 offset page</param>
|
|
||||||
/// <returns><see cref="EventResult{T}"/> wrapped <see cref="User"/></returns>
|
|
||||||
public Task<EventResult> GetMoneyLeaderboardAsync(ulong guildId, int page = 0)
|
|
||||||
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetMoneyLeaderboardAsync(guildId, page) : null;
|
|
||||||
|
|
||||||
public Task<Stream> GetLiquidRescaledAsync(string image)
|
|
||||||
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetLiquidRescaledAsync(image) : null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get's the join card for a guild
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">User Id</param>
|
|
||||||
/// <param name="guildId">Guild Id</param>
|
|
||||||
/// <returns><see cref="Stream"/> of join card</returns>
|
|
||||||
public Task<Stream> GetJoinCardAsync(ulong id, ulong guildId)
|
|
||||||
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetJoinCardAsync(id, guildId) : null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get's the leave card for a guild
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">User Id</param>
|
|
||||||
/// <param name="guildId">Guild Id</param>
|
|
||||||
/// <returns><see cref="Stream"/> of leave card</returns>
|
|
||||||
public Task<Stream> GetLeaveCardAsync(ulong id, ulong guildId)
|
|
||||||
=> !string.IsNullOrWhiteSpace(Token) ? _api.GetLeaveCardAsync(id, guildId) : null;
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (!disposedValue)
|
|
||||||
{
|
|
||||||
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: 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: 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user