Detailed Specification Sample - Customer List Retrieval API
tip
- I created a PlantUML theme for Docusaurus because I wanted to write specifications like this!
- Since it's text-based, almost everything can be written using ChatGPT. Super convenient.
Overview
- This API retrieves a list of customer information.
- It uses gRPC and is implemented based on connect-go.
Prerequisites
- Authentication is required.
- The user must have permission to view customer information.
CRUD
Operation: Read
- Reference table: customers
Parameter Specification
{
"userId": "string", // User ID
"filter": "string", // Search condition (optional)
"limit": "number", // Maximum number of records to retrieve (optional)
"offset": "number" // Starting position for retrieval (optional)
}
Result Specification
{
"customers": [
{
"id": "string", // Customer ID
"name": "string", // Customer name
"email": "string", // Email address
"createdAt": "string" // Creation timestamp
}
],
"total": "number" // Total number of records
}
Sequence Diagram
Processing Details
[02]: Authentication
- Verify the authentication information in the request.
- If authentication fails, return an error and terminate processing.
[03]: Parameter Validation
- Ensure
userId
is required. - Validate that
limit
andoffset
have appropriate values. - If validation fails, return an error and terminate processing.
[04]: Database Permission Check
- Retrieve permissions based on
userId
. - If the user lacks permission, return an error and terminate processing.
[06]: Retrieve List from Database
- Query the
customers
table based onfilter
,limit
, andoffset
. - Retrieve the search results.
Convert to Result Format
- Store customer information in the
customers
array. - Set
total
.