Added userinfo endpoint usage and api now properly creates necessary claims to start doing database stuff
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using WebAPI.Data.Dto;
|
||||
|
||||
namespace WebAPI.Data
|
||||
{
|
||||
@@ -46,7 +47,7 @@ namespace WebAPI.Data
|
||||
return JsonConvert.DeserializeObject<T>(responsedata);
|
||||
}
|
||||
|
||||
public async Task<T> SendGet<T>(string endpoint, IEnumerable includeParameters, bool client=false)
|
||||
private async Task<T> SendGet<T>(string endpoint, IEnumerable includeParameters, bool client=false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -61,7 +62,7 @@ namespace WebAPI.Data
|
||||
|
||||
}
|
||||
|
||||
public async Task<T> SendPost<T>(string endpoint, object obj, IEnumerable includeParameters, bool client = false)
|
||||
private async Task<T> SendPost<T>(string endpoint, object obj, IEnumerable includeParameters, bool client = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -75,5 +76,19 @@ namespace WebAPI.Data
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<PterodactylCreateUserResponse> SendPterodactylUserCreate(string username, string email,
|
||||
string firstname, string lastname, string externalId)
|
||||
{
|
||||
var requestObj = new PterodactylCreateUserRequest()
|
||||
{
|
||||
Email = email,
|
||||
ExternalId = externalId,
|
||||
FirstName = firstname,
|
||||
LastName = lastname,
|
||||
Username = username
|
||||
};
|
||||
return await SendPost<PterodactylCreateUserResponse>("users", requestObj, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user