-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from gor1kartem/master
GetOwnProfile is fixed, many other changes
- Loading branch information
Showing
23 changed files
with
545 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Net.Http.Headers; | ||
using System.Net.Http.Json; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
using LichessNET.Entities.Enumerations; | ||
using LichessNET.Entities.OAuth; | ||
|
||
namespace LichessNET.API; | ||
|
||
public partial class LichessApiClient | ||
{ | ||
public async Task<Dictionary<string, TokenInfo?>> TestTokensAsync(List<string> tokens) | ||
{ | ||
var tokenBody = string.Join(',', tokens); | ||
var request = GetRequestScaffold("api/token/test"); | ||
var response = await SendRequest(request, content: new StringContent(tokenBody), method: HttpMethod.Post); | ||
Console.WriteLine(await response.Content.ReadAsStringAsync()); | ||
var tokenInfo = await response.Content.ReadFromJsonAsync<Dictionary<string, TokenInfo>>(new JsonSerializerOptions { PropertyNameCaseInsensitive = true}); | ||
return tokenInfo; | ||
} | ||
|
||
public async Task DeleteTokenAsync(string token) | ||
{ | ||
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); | ||
var request = GetRequestScaffold("api/token"); | ||
var response = await SendRequest(request, method: HttpMethod.Delete); | ||
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", GetToken()); | ||
} | ||
} |
Oops, something went wrong.