mirror of
https://github.com/yawaflua/SPWorlds.git
synced 2025-12-10 04:29:35 +02:00
Add project files.
This commit is contained in:
8
Types/Interfaces/ICard.cs
Normal file
8
Types/Interfaces/ICard.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace SPWorldsApi.Types.Interfaces
|
||||
{
|
||||
public interface ICard
|
||||
{
|
||||
public int Balance { get; set; }
|
||||
public string Webhook { get; set; }
|
||||
}
|
||||
}
|
||||
12
Types/Interfaces/ICity.cs
Normal file
12
Types/Interfaces/ICity.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace SPWorldsApi.Types.Interfaces
|
||||
{
|
||||
public interface ICity
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string description { get; set; }
|
||||
public int x { get; set; }
|
||||
public int z { get; set; }
|
||||
public bool isMayor { get; set; }
|
||||
}
|
||||
}
|
||||
10
Types/Interfaces/IPaymentData.cs
Normal file
10
Types/Interfaces/IPaymentData.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace SPWorldsApi.Types.Interfaces
|
||||
{
|
||||
public interface IPaymentData
|
||||
{
|
||||
public IPaymentItems[] Items { get; set; }
|
||||
public string RedirectUrl { get; set; }
|
||||
public string WebHookUrl { get; set; }
|
||||
public string Data { get; set; }
|
||||
}
|
||||
}
|
||||
10
Types/Interfaces/IPaymentItems.cs
Normal file
10
Types/Interfaces/IPaymentItems.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace SPWorldsApi.Types.Interfaces
|
||||
{
|
||||
public interface IPaymentItems
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int Count { get; set; }
|
||||
public int Price { get; set; }
|
||||
public string? Comment { get; set; }
|
||||
}
|
||||
}
|
||||
29
Types/Interfaces/IUser.cs
Normal file
29
Types/Interfaces/IUser.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using SPWorldsApi.Types.Enums;
|
||||
using SPWorldsApi.Types.Models;
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace SPWorldsApi.Types.Interfaces
|
||||
{
|
||||
public interface IUser
|
||||
{
|
||||
public string Name { get; }
|
||||
public string Uuid { get; }
|
||||
|
||||
|
||||
public static async Task<IUser> CreateUserAsync(string name)
|
||||
{
|
||||
string? uuid;
|
||||
using (System.Net.Http.HttpClient client = new())
|
||||
{
|
||||
uuid = (string?)JsonNode.Parse(await client.GetStringAsync($"https://api.mojang.com/users/profiles/minecraft/{name}"))["id"];
|
||||
}
|
||||
User user = new(name, uuid);
|
||||
return user;
|
||||
}
|
||||
|
||||
public string GetSkinPart(SkinPart skinPart, string size = "64")
|
||||
{
|
||||
return (string)$"https://avatar.spworlds.ru/{skinPart}/{size}/{Name}";
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Types/Interfaces/IUserAccount.cs
Normal file
14
Types/Interfaces/IUserAccount.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace SPWorldsApi.Types.Interfaces
|
||||
{
|
||||
public interface IUserAccount
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string username { get; set; }
|
||||
public string minecraftUUID { get; set; }
|
||||
public string status { get; set; }
|
||||
public List<string> roles { get; set; }
|
||||
public ICity city { get; set; }
|
||||
public List<IUserCard> cards { get; set; }
|
||||
public DateTime createdAt { get; set; }
|
||||
}
|
||||
}
|
||||
10
Types/Interfaces/IUserCard.cs
Normal file
10
Types/Interfaces/IUserCard.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace SPWorldsApi.Types.Interfaces
|
||||
{
|
||||
public interface IUserCard
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string number { get; set; }
|
||||
public int color { get; set; }
|
||||
}
|
||||
}
|
||||
8
Types/Interfaces/IWebhookResponse.cs
Normal file
8
Types/Interfaces/IWebhookResponse.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace SPWorldsApi.Types.Interfaces
|
||||
{
|
||||
public interface IWebhookResponse
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Webhook { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user