spw 2.1.1

dotnet add package spw --version 2.1.1
NuGet\Install-Package spw -Version 2.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="spw" Version="2.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add spw --version 2.1.1
#r "nuget: spw, 2.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install spw as a Cake Addin
#addin nuget:?package=spw&version=2.1.1

// Install spw as a Cake Tool
#tool nuget:?package=spw&version=2.1.1

SpWorldsApiForCS 2.1.1

Это библиотека C# для управлением API SpWorlds. Документация к API тут.

Как начать?

Подключение библиотеки происходит через nuget

nuget
dotnet add package spw --version 2.1.1

Команды

Примечание

Можно использывать асиннхронные и синхронные методы

Деректива подключения

using spw;

Создание класса

SpWorlds sp = new SpWorlds("id", "token");

Правильный token и id

await sp.IsSpWalletAsync();
//or
sp.IsSpwallet();

Возвращает bool

Получить баланс

await sp.GetCardInfoAsync();
//or
sp.GetCardInfo();

Возвращает SPCardUser (Типы)

Получить никнейм по DiscordId

await sp.GetUserAsync("DiscordId");
//or
sp.GetUser("DiscordId");

Возвращает SPUser (Типы)

Отправить АРы

await sp.SendPaymentAsync(amount, "receiver", "message");
//or
sp.SendPayment(amount, "receiver", "message");

Возвращает int (баланс вашей карты после оплаты)

Создать ссылку на оплату

await sp.CreatePaymentAsync(payment); //class SPPayment
//or
sp.CreatePayment(payment); //class SPPayment

Возвращает string(url)

Проверка оплаты

await sp.ValidatorAsync("webhook", "Xbody_hash");
//or
sp.Validator("webhook", "Xbody_hash");

Возвращает bool

Получение аккаунта владельца токена

await sp.GetAccountAsync();
//or
sp.GetAccount();

Возвращает SPAccount (Типы)

Получение карт игрока

await sp.GetCardsAsync(username);
//or
sp.GetCards(username);

Возвращает SPCard[] (Типы)

Установка вебхука для карты

await sp.SetWebhookAsync(webhook);
//or
sp.SetWebhookAsync(webhook);

Возвращает bool

Types

SPAccount

Используется (в return): GetAccount() Содержимое:

int id 
string username 
string status 
string[] roles 
SPCity city 
SPCard[] cards
string createdAt
SPCard

Используется (в return): GetCards(username) Содержимое:

string name 
string number 
SPCardUser

Используется: ** Содержимое:

int balance 
string webhook 
SPCity

Используется (в return): GetAccount() Содержимое:

string id 
string name 
int x 
int y 
bool isMayor
string description
SPItem

Используется (в return): CreatePayment() Содержимое:

string name 
int count 
int amount 
string comment // can be null
SPPayment

Используется: CreatePayment() Содержимое:

SPItem item 
string redirectUrl 
string webhookUrl
string data 
SPTransaction

Используется: После устоновления webhook {SetWebhookAsync(webhook)}, приходят транзакции (для парса) Содержимое:

string id 
string name 
string type 
SPWebhookUser sender
SPWebhookUser receiver
string comment 
string createdAt 
SPUser

Используется: GetCardInfo() Содержимое:

string username 
string uuid //Minecraft uuid
SPWebhookUser
string username 
string number 

Exceptions

BabRequestException

Неправильная форма запроса

UnathorizedException

Неверный token или id

BadGatewayException

spworlds api отключен

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.1 72 4/20/2024
2.1.0 70 4/18/2024
2.0.0 170 1/7/2024
1.1.2 84 1/21/2024
1.1.1 96 1/7/2024
1.1.0 120 10/13/2023
1.0.2 112 9/9/2023
1.0.1 122 9/9/2023
1.0.0 124 9/9/2023