Use the new Csharp 8 features (pattern matching and using assignments) and cleanup some insignificant resparper complaints
This commit is contained in:
parent
21f813d342
commit
3568b61f38
27 changed files with 217 additions and 250 deletions
|
@ -32,14 +32,16 @@ namespace Geekbot.net.WebApi.Controllers.Callback
|
|||
var accessToken = _globalSettings.GetKey("OAuthToken");
|
||||
var callbackUrl = _globalSettings.GetKey("OAuthCallbackUrl");
|
||||
|
||||
var form = new Dictionary<string, string>();
|
||||
form.Add("client_id", appInfo.Id.ToString());
|
||||
form.Add("client_secret", accessToken);
|
||||
form.Add("grant_type", "authorization_code");
|
||||
form.Add("code", code);
|
||||
form.Add("scope", "identify email guilds");
|
||||
form.Add("redirect_uri", callbackUrl);
|
||||
|
||||
var form = new Dictionary<string, string>
|
||||
{
|
||||
{"client_id", appInfo.Id.ToString()},
|
||||
{"client_secret", accessToken},
|
||||
{"grant_type", "authorization_code"},
|
||||
{"code", code},
|
||||
{"scope", "identify email guilds"},
|
||||
{"redirect_uri", callbackUrl}
|
||||
};
|
||||
|
||||
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));
|
||||
var result = await client.PostAsync("/api/oauth2/token", new FormUrlEncodedContent(form));
|
||||
result.EnsureSuccessStatusCode();
|
||||
|
|
|
@ -8,9 +8,9 @@ namespace Geekbot.net.WebApi.Controllers.Highscores
|
|||
[Required]
|
||||
public ulong GuildId { get; set; }
|
||||
|
||||
public HighscoreTypes Type { get; set; } = HighscoreTypes.messages;
|
||||
public HighscoreTypes Type { get; } = HighscoreTypes.messages;
|
||||
|
||||
[Range(1, 150)]
|
||||
public int Amount { get; set; } = 50;
|
||||
public int Amount { get; } = 50;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue