feat(api-client): add Yavsc.Api.Client with Blog + Circle + BlogAcl clients
Creates the high-level HTTP client library the PostIt UI will consume to manage blog posts, circles, and per-post ACLs. Clients in this commit: - BlogApiClient (moved from PostIt/Services; same public surface, now depends on IYavscApiClient instead of the concrete class). - CircleApiClient (new): GET/POST/PUT/DELETE /api/circle. Takes the blogs base URL explicitly in its constructor so it doesn't need to know about PostIt's Settings type. - BlogAclApiClient (new): GET/POST/PUT/DELETE /api/blogacl. Same conventions as CircleApiClient. DTOs (Yavsc.Api.Client.Dtos): - CircleDto: id, name, ownerId, public. Stops short of the navigation properties on the server-side Circle (Owner, Members), which depend on ApplicationUser and other server types we don't want to drag into the client. - CircleAuthorizationDto: circleId, blogPostId, comment. Same reason: the server entity has Target and Allowed navigation properties the client never needs. The clients now require the caller to pass the blogs base URL explicitly in the constructor (previously the BlogApiClient sniffed it off YavscApiClient.Settings.BlogsApiUrl, but that field is PostIt-specific). The one production call site (App.axaml.cs) and four test call sites are updated to pass the URL. Build + 51/51 tests green. The IYavscApiClient abstraction was landed in the previous commit so this one could be a pure addition + relocation.
This commit is contained in:
parent
6ca8191462
commit
46de7b3447
11 changed files with 171 additions and 12 deletions
23
src/Yavsc.Api.Client/Dtos/CircleDto.cs
Normal file
23
src/Yavsc.Api.Client/Dtos/CircleDto.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
namespace Yavsc.Api.Client.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// Wire format for <c>GET /api/circle</c> and friends.
|
||||
///
|
||||
/// <para>Field names match the JSON the server emits (camelCase via
|
||||
/// the default <see cref="System.Text.Json"/> policy), so no
|
||||
/// <c>[JsonPropertyName]</c> attributes are required.</para>
|
||||
///
|
||||
/// <para>Mirrors the server-side <c>Yavsc.Models.Relationship.Circle</c>
|
||||
/// EF entity but stops short of the navigation properties
|
||||
/// (<c>Owner</c>, <c>Members</c>) which depend on
|
||||
/// <c>ApplicationUser</c> and other server-only types. The client
|
||||
/// only ever needs the id, name, and owner of a circle to drive
|
||||
/// the UI.</para>
|
||||
/// </summary>
|
||||
public sealed class CircleDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string OwnerId { get; set; } = string.Empty;
|
||||
public bool Public { get; set; }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue