Fix endpoints not rendering objects correctly

This commit is contained in:
Daniel_I_Am 2020-08-24 22:19:46 +02:00
parent f56e9c7e42
commit 95388d65e5
No known key found for this signature in database
GPG Key ID: 80C428FCC9743E84

View File

@ -60,12 +60,7 @@ namespace ChaosBot.WebServer.App
string responseString = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
DiscordUserResponse userResponse = JsonConvert.DeserializeObject<DiscordUserResponse>(responseString);
return Json(new
{
id = userResponse.id,
username = $"{userResponse.username}#{userResponse.discriminator}",
avatar = userResponse.avatar
});
return Json(userResponse);
}
[HttpGet("guilds")]
@ -90,40 +85,39 @@ namespace ChaosBot.WebServer.App
internal class DiscordOauthResponse
{
public string error = null;
public string error_description = null;
public string access_token = null;
public int expires_in = 0;
public string refresh_token = null;
public string scope = null;
public string token_type = null;
public string error { get; set; } = null;
public string error_description { get; set; } = null;
public string access_token { get; set; } = null;
public int expires_in { get; set; } = 0;
public string refresh_token { get; set; } = null;
public string scope { get; set; } = null;
public string token_type { get; set; } = null;
}
public class DiscordUserResponse
{
public string id;
public string username;
public string discriminator;
public string avatar = null;
public bool bot = false;
public bool system = false;
public bool mfa_enabled = false;
public string locale = null;
public bool verified = false;
public string email = null;
public int flags = 0;
public int premium_type = 0;
public int public_flags = 0;
public string id { get; set; }
public string username { get; set; }
public string discriminator { get; set; }
public string avatar { get; set; } = null;
public bool bot { get; set; } = false;
public bool system { get; set; } = false;
public bool mfa_enabled { get; set; } = false;
public string locale { get; set; } = null;
public bool verified { get; set; } = false;
public string email { get; set; } = null;
public int flags { get; set; } = 0;
public int premium_type { get; set; } = 0;
public int public_flags { get; set; } = 0;
}
public class DiscordGuildResponse
{
public string id;
public string name;
public string icon;
public bool owner;
public int permissions;
public int permissions_new;
public string id { get; set; }
public string name { get; set; }
public string icon { get; set; }
public bool owner { get; set; }
public int permissions { get; set; }
public int permissions_new { get; set; }
}
}