refacto BlogPost
This commit is contained in:
parent
84f3ffa9c2
commit
e35bc273a3
17 changed files with 177 additions and 203 deletions
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Yavsc.Abstract.Identity.Security;
|
||||
using Yavsc.Api.Client.Dtos;
|
||||
|
||||
namespace Yavsc.Api.Client;
|
||||
|
|
@ -10,7 +11,7 @@ namespace Yavsc.Api.Client;
|
|||
/// <summary>
|
||||
/// HTTP client for <c>/api/blogacl</c> on the Yavsc Blogs server.
|
||||
///
|
||||
/// <para>Each <see cref="CircleAuthorizationDto"/> grants a single
|
||||
/// <para>Each <see cref="CircleAuthorization"/> grants a single
|
||||
/// <c>Circle</c> access to a single <c>BlogPostDto</c>. The server
|
||||
/// scopes every endpoint to the caller's uid: only the author of
|
||||
/// the underlying blog post can list, create, modify, or delete
|
||||
|
|
@ -32,16 +33,16 @@ public sealed class BlogAclApiClient
|
|||
api.Http.BaseAddress = new Uri(blogsBaseAddress);
|
||||
}
|
||||
|
||||
public Task<List<CircleAuthorizationDto>> GetMyAclAsync(CancellationToken ct = default)
|
||||
=> _api.CallAsync<List<CircleAuthorizationDto>>(HttpMethod.Get, Path, ct: ct);
|
||||
public Task<List<CircleAuthorization>> GetMyAclAsync(CancellationToken ct = default)
|
||||
=> _api.CallAsync<List<CircleAuthorization>>(HttpMethod.Get, Path, ct: ct);
|
||||
|
||||
public Task<CircleAuthorizationDto?> GetAclAsync(long circleId, CancellationToken ct = default)
|
||||
=> _api.CallAsync<CircleAuthorizationDto?>(HttpMethod.Get, $"{Path}/{circleId}", ct: ct);
|
||||
public Task<CircleAuthorization?> GetAclAsync(long circleId, CancellationToken ct = default)
|
||||
=> _api.CallAsync<CircleAuthorization?>(HttpMethod.Get, $"{Path}/{circleId}", ct: ct);
|
||||
|
||||
public Task<CircleAuthorizationDto?> GrantAsync(CircleAuthorizationDto acl, CancellationToken ct = default)
|
||||
=> _api.CallAsync<CircleAuthorizationDto?>(HttpMethod.Post, Path, body: acl, ct: ct);
|
||||
public Task<CircleAuthorization?> GrantAsync(CircleAuthorization acl, CancellationToken ct = default)
|
||||
=> _api.CallAsync<CircleAuthorization?>(HttpMethod.Post, Path, body: acl, ct: ct);
|
||||
|
||||
public Task UpdateAclAsync(long circleId, CircleAuthorizationDto acl, CancellationToken ct = default)
|
||||
public Task UpdateAclAsync(long circleId, CircleAuthorization acl, CancellationToken ct = default)
|
||||
=> _api.CallAsync(HttpMethod.Put, $"{Path}/{circleId}", body: acl, ct: ct);
|
||||
|
||||
public Task RevokeAsync(long circleId, CancellationToken ct = default)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue