Update buyer addressv1.0.0 · JSON Schema
Updates the authenticated Buyer's address using the supplied street, city, and province.
1. Update the Authenticated Buyer’s Shipping Address
An authenticated customer updates their saved street, city, and province in Ordering API (PATCH /api/v1/buyers/address).
Payload details
street: Required street address line.city: Required city name.province: Required province or state name.
Example payload
{ "street": "120 Le Loi Blvd", "city": "Ho Chi Minh City", "province": "Ho Chi Minh"}Using this example
Returns 200 OK with the updated Buyer JSON payload reflecting the new shipping address.
using BookWorm.Chassis.Utilities.Configurations;using BookWorm.Constants.Aspire;using Refit;
public interface IOrderApiClient{ [Patch("/api/v1/buyers/address")] Task<BuyerResponse> UpdateAddressAsync( [Body] UpdateAddressRequest request, CancellationToken cancellationToken = default );}
public sealed record UpdateAddressRequest(string Street, string City, string Province);
// DI registration following BookWorm.Chassis Refit patternbuilder.Services .AddRefitGeneratedClient<IOrderApiClient>(settings, Services.Ordering) .ConfigureHttpClient(client => client.BaseAddress = new($"https+http://{Services.Ordering}")) .ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler { PooledConnectionLifetime = TimeSpan.FromMinutes(5) } );
// Typed invocationvar buyer = await orderApiClient.UpdateAddressAsync( new("120 Le Loi Blvd", "Ho Chi Minh City", "Ho Chi Minh"), cancellationToken);import buyersApiClient from "@workspace/api-client/ordering/buyers";import useUpdateBuyerAddress from "@workspace/api-hooks/ordering/buyers/useUpdateBuyerAddress";
// 1. Direct @workspace/api-client (Axios) callconst updatedBuyer = await buyersApiClient.updateAddress({ street: "120 Le Loi Blvd", city: "Ho Chi Minh City", province: "Ho Chi Minh",});
// 2. React / TanStack Query hook (@workspace/api-hooks)const { mutate: updateAddress, isPending } = useUpdateBuyerAddress({ onSuccess: (buyer) => { console.log(`Updated address for buyer ${buyer.id}`); },});
updateAddress({ street: "120 Le Loi Blvd", city: "Ho Chi Minh City", province: "Ho Chi Minh",});1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "title": "UpdateAddressCommand",
4 "description": "Address fields required to update the authenticated Buyer's address.",
5 "type": "object",
6 "required": ["street", "city", "province"],
7 "properties": {
8 "street": {
9 "type": "string"
10 },
11 "city": {
12 "type": "string"
13 },
14 "province": {
15 "type": "string"
16 }
17 }
18}
19