refactor: HTTP-Methoden umbenennen, um das Suffix 'Async' für asynchrone Operationen hinzuzufügen
This commit is contained in:
parent
8e367e89c4
commit
650f2c58d3
@ -14,7 +14,7 @@ namespace WindreamHub.Legacy.Client.Routes
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SimplifiedResponse<ValidationResponse, object>> IsValidUser()
|
public async Task<SimplifiedResponse<ValidationResponse, object>> IsValidUserAsync()
|
||||||
{
|
{
|
||||||
return await FetchAsync(route: "/IsValidUser", HttpMethod.Get).ThenAsync(res => res.Simplify<ValidationResponse, object>());
|
return await FetchAsync(route: "/IsValidUser", HttpMethod.Get).ThenAsync(res => res.Simplify<ValidationResponse, object>());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,15 +19,15 @@ namespace WindreamHub.Legacy.Client.Routes
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SimplifiedResponse<DocResponse, DocResponse>> Create(HttpContent docCreateBody)
|
public async Task<SimplifiedResponse<DocResponse, DocResponse>> CreateAsync(HttpContent docCreateBody)
|
||||||
=> await FetchAsync(route: "/Create", method: HttpMethod.Post, body: docCreateBody)
|
=> await FetchAsync(route: "/Create", method: HttpMethod.Post, body: docCreateBody)
|
||||||
.ThenAsync(res => res.Simplify<DocResponse, DocResponse>());
|
.ThenAsync(res => res.Simplify<DocResponse, DocResponse>());
|
||||||
|
|
||||||
public async Task<SimplifiedResponse<DocResponse, DocResponse>> Create(DocBody docCreateBody)
|
public async Task<SimplifiedResponse<DocResponse, DocResponse>> CreateAsync(DocBody docCreateBody)
|
||||||
=> await FetchAsync(route: "/Create", method: HttpMethod.Post, body: docCreateBody.Stringify())
|
=> await FetchAsync(route: "/Create", method: HttpMethod.Post, body: docCreateBody.Stringify())
|
||||||
.ThenAsync(res => res.Simplify<DocResponse, DocResponse>());
|
.ThenAsync(res => res.Simplify<DocResponse, DocResponse>());
|
||||||
|
|
||||||
public async Task<SimplifiedResponse<DocResponse, DocResponse>> Upload(string path, long? item_id = null, string item_location = null, string item_name = null, object stream_identity = null, params Flag[] flags)
|
public async Task<SimplifiedResponse<DocResponse, DocResponse>> UploadAsync(string path, long? item_id = null, string item_location = null, string item_name = null, object stream_identity = null, params Flag[] flags)
|
||||||
{
|
{
|
||||||
using (var fileStream = File.OpenRead(path))
|
using (var fileStream = File.OpenRead(path))
|
||||||
{
|
{
|
||||||
@ -60,11 +60,11 @@ namespace WindreamHub.Legacy.Client.Routes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SimplifiedResponse<DocResponse, DocResponse>> Update(DocBody docUpdateBody)
|
public async Task<SimplifiedResponse<DocResponse, DocResponse>> UpdateAsync(DocBody docUpdateBody)
|
||||||
=> await FetchAsync(route: "/Update", method: HttpMethod.Post, body: docUpdateBody.Stringify())
|
=> await FetchAsync(route: "/Update", method: HttpMethod.Post, body: docUpdateBody.Stringify())
|
||||||
.ThenAsync(res => res.Simplify<DocResponse, DocResponse>());
|
.ThenAsync(res => res.Simplify<DocResponse, DocResponse>());
|
||||||
|
|
||||||
public async Task<SimplifiedResponse<DocResponse, DocResponse>> Download(long? item_id = null, string item_location = null, string item_name = null, object stream_identity = null, params Flag[] flags)
|
public async Task<SimplifiedResponse<DocResponse, DocResponse>> DownloadAsync(long? item_id = null, string item_location = null, string item_name = null, object stream_identity = null, params Flag[] flags)
|
||||||
{
|
{
|
||||||
var query = HttpUtility.ParseQueryString(string.Empty);
|
var query = HttpUtility.ParseQueryString(string.Empty);
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ namespace WindreamHub.Legacy.Client.Route
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SimplifiedResponse<SystemDetailsResponse, object>> GetSystemDetails()
|
public async Task<SimplifiedResponse<SystemDetailsResponse, object>> GetSystemDetailsAsync()
|
||||||
=> await FetchAsync(route: "/GetSystemDetails")
|
=> await FetchAsync(route: "/GetSystemDetails")
|
||||||
.ThenAsync(res => res.Simplify<SystemDetailsResponse, object>());
|
.ThenAsync(res => res.Simplify<SystemDetailsResponse, object>());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ namespace WindreamHub.Legacy.Client
|
|||||||
public async Task<bool> AuthenticateAsync(ICredential credential)
|
public async Task<bool> AuthenticateAsync(ICredential credential)
|
||||||
{
|
{
|
||||||
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credential.AuthorizationHeader);
|
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", credential.AuthorizationHeader);
|
||||||
var res = await Authentication.IsValidUser();
|
var res = await Authentication.IsValidUserAsync();
|
||||||
return res.Ok && (res.Data.IsValidUser ?? false);
|
return res.Ok && (res.Data.IsValidUser ?? false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user