List feedbacksv1.0.0 · JSON Schema
Returns feedback for a book with pagination, sorting, and validation responses.
1. Paginate Reviews for a Specific Book
The storefront book detail page queries Rating API for paginated reviews of “The Left Hand of Darkness” ordered by rating descending.
Payload details
- Query parameters:
bookId(required book UUID),pageIndex,pageSize,orderBy, andisDescending. - Response array items:
id,firstName,lastName,comment,rating(0–5), andbookId.
Example response
[ { "id": "01960a1b-5e6f-7a01-8a9b-0c1d2e3f4c01", "firstName": "Minh", "lastName": "Nguyen", "comment": "A landmark of anthropological science fiction with unforgettable world-building.", "rating": 5, "bookId": "01960a1b-2c3d-7e4f-8a9b-0c1d2e3f4a10" }]Using this example
Returns 200 OK with a JSON array of matching Feedback records and Pagination-Count / Link response headers.
using BookWorm.Chassis.Utilities.Configurations;using BookWorm.Constants.Aspire;using Refit;
public interface IRatingApiClient{ [Get("/api/v1/feedbacks")] Task<IReadOnlyList<FeedbackResponse>> ListFeedbacksAsync( [Query] ListFeedbacksQuery query, CancellationToken cancellationToken = default );}
public sealed record ListFeedbacksQuery( Guid BookId, int PageIndex = 1, int PageSize = 10, string? OrderBy = null, bool IsDescending = false);
// DI registration following BookWorm.Chassis Refit patternbuilder.Services .AddRefitGeneratedClient<IRatingApiClient>(settings, Services.Rating) .ConfigureHttpClient(client => client.BaseAddress = new($"https+http://{Services.Rating}")) .ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler { PooledConnectionLifetime = TimeSpan.FromMinutes(5) } );
// Typed invocationvar feedbacks = await ratingApiClient.ListFeedbacksAsync( new(Guid.Parse("01960a1b-2c3d-7e4f-8a9b-0c1d2e3f4a10"), 1, 10, "Rating", true), cancellationToken);import ratingApiClient from "@workspace/api-client/rating/feedbacks";import useFeedbacks from "@workspace/api-hooks/rating/useFeedbacks";
const query = { bookId: "01960a1b-2c3d-7e4f-8a9b-0c1d2e3f4a10", pageIndex: 1, pageSize: 10, orderBy: "Rating", isDescending: true,};
// 1. Direct @workspace/api-client (Axios) callconst pagedFeedbacks = await ratingApiClient.list(query);
// 2. React / TanStack Query hook (@workspace/api-hooks)const { data: feedbacks, isLoading } = useFeedbacks(query);1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "title": "ListFeedbacksResponse",
4 "description": "Feedback records returned for a Catalog book.",
5 "type": "array",
6 "items": {
7 "type": "object",
8 "additionalProperties": false,
9 "required": ["id", "firstName", "lastName", "comment", "rating", "bookId"],
10 "properties": {
11 "id": {
12 "type": "string",
13 "format": "uuid",
14 "description": "Unique identifier of the feedback record."
15 },
16 "firstName": {
17 "type": ["string", "null"],
18 "description": "First name of the reviewer."
19 },
20 "lastName": {
21 "type": ["string", "null"],
22 "description": "Last name of the reviewer."
23 },
24 "comment": {
25 "type": ["string", "null"],
26 "description": "Written feedback left by the reviewer."
27 },
28 "rating": {
29 "type": ["integer", "string"],
30 "format": "int32",
31 "description": "Rating value from 0 through 5."
32 },
33 "bookId": {
34 "type": "string",
35 "format": "uuid",
36 "description": "Identifier of the reviewed Catalog book."
37 }
38 }
39 }
40}
41