Add project files.

This commit is contained in:
Dima yawaflua Andreev
2024-06-22 23:21:48 +03:00
parent bc437be3dc
commit 7d6932fdc6
26 changed files with 626 additions and 0 deletions

View 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
View 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; }
}
}

View 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; }
}
}

View 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
View 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}";
}
}
}

View 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; }
}
}

View 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; }
}
}

View File

@@ -0,0 +1,8 @@
namespace SPWorldsApi.Types.Interfaces
{
public interface IWebhookResponse
{
public int Id { get; set; }
public string Webhook { get; set; }
}
}