List buyersv1.0.0 · JSON Schema
Returns Buyer profiles with pagination.
1. Paginate Registered Buyers in Backoffice
An admin opens the Backoffice buyers table to browse paginated buyer profiles (GET /api/v1/buyers).
Payload details
- Query parameters:
pageIndex,pageSize. - Response array items:
id(UUID),name(string | null), andaddress(string | null).
Example response
[ { "id": "01960a1b-2c3d-7e4f-8a9b-0c1d2e3f4a01", "name": "Minh Nguyen", "address": "42 Nguyen Hue Blvd, Ho Chi Minh City, Ho Chi Minh" }]Using this example
Returns 200 OK with a JSON array of BuyerDto records and Pagination-Count / Link response headers.
using BookWorm.Chassis.Utilities.Configurations;using BookWorm.Constants.Aspire;using Refit;
public interface IOrderApiClient{ [Get("/api/v1/buyers")] Task<IReadOnlyList<BuyerResponse>> ListBuyersAsync( [Query] int pageIndex = 1, [Query] int pageSize = 20, CancellationToken cancellationToken = default );}
// 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 buyers = await orderApiClient.ListBuyersAsync(1, 20, cancellationToken);import buyersApiClient from "@workspace/api-client/ordering/buyers";import useBuyers from "@workspace/api-hooks/ordering/buyers/useBuyers";
const query = { pageIndex: 1, pageSize: 20 };
// 1. Direct @workspace/api-client (Axios) callconst pagedBuyers = await buyersApiClient.list(query);
// 2. React / TanStack Query hook (@workspace/api-hooks)const { data: buyers, isLoading } = useBuyers(query);1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "title": "BuyerDtoArray",
4 "description": "Buyer list response documented by the Ordering API OpenAPI contract.",
5 "type": "array",
6 "items": {
7 "type": "object",
8 "required": ["id", "name", "address"],
9 "properties": {
10 "id": {
11 "type": "string",
12 "format": "uuid"
13 },
14 "name": {
15 "type": ["string", "null"]
16 },
17 "address": {
18 "type": ["string", "null"]
19 }
20 }
21 }
22}
23