Get catalog dashboard over gRPCv1.0.0 · Protobuf Schema
Returns Catalog totals and category counts through the admin-protected book.v1 gRPC contract.
1. Fetch Catalog Inventory Metrics for the Ordering Dashboard
Ordering API invokes book.v1.BookGrpcService/GetDashboard using a named gRPC client configured with OBO user token exchange to retrieve total book counts and category breakdowns.
Payload details
- Request (
GetDashboardRequest): Empty message. - Response (
GetDashboardResponse):total_books(int64) andcategories(repeated DashboardCategorywithnameandvalue).
Using this example
Returns StatusCode.OK with GetDashboardResponse (total_books and per-category counts) after validating the exchanged business_user Entra ID token.
using BookWorm.Catalog.Grpc.Services;using BookWorm.Chassis.Security.TokenExchange;using BookWorm.Chassis.Utilities;using BookWorm.Chassis.Utilities.Configurations;using Grpc.Net.ClientFactory;
// 1. Named gRPC client + OBO token exchange in Ordering API (src/Services/Ordering/BookWorm.Ordering/Grpc/Extensions.cs)builder.Services .AddGrpcServiceReference<BookGrpcService.BookGrpcServiceClient>( HttpUtilities .AsUrlBuilder() .WithScheme(builder.GetScheme()) .WithHost(Constants.Aspire.Services.Catalog) .Build(), HealthStatus.Degraded, BookService.DashboardClientName ) .AddUserTokenExchange(Constants.Aspire.Services.Catalog);
// 2. Typed gRPC client invocation via GrpcClientFactoryvar response = await clientFactory .CreateClient<BookGrpcService.BookGrpcServiceClient>(BookService.DashboardClientName) .GetDashboardAsync( new(), deadline: DateTime.UtcNow.AddSeconds(10), cancellationToken: cancellationToken );1edition = "2023";
2
3package book.v1;
4
5service BookGrpcService {
6 rpc GetDashboard (GetDashboardRequest) returns (GetDashboardResponse);
7}
8
9message GetDashboardRequest {}
10
11message GetDashboardResponse {
12 int64 total_books = 1;
13 repeated DashboardCategory categories = 2;
14}
15
16message DashboardCategory {
17 string name = 1;
18 int64 value = 2;
19}
20