feat(data_store): finalize V3 cascading lookup with limit override
- Update GET /v3/data_store/code/{code} to support 'limit' query parameter.
- Refactor return logic: returns single object if limit=1, otherwise returns a list.
- Clean up formatting in GUIDE__V3_FRONTEND_API.md and sync to agents_sync.
- Finalize unified E2E test script: tests/e2e/test_e2e_v3_data_store_lookup.py.
This commit is contained in:
@@ -152,6 +152,7 @@ V3 provides a specialized endpoint for retrieving configuration or content snipp
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| `for_type` | String | No | Parent object type (e.g., `event`, `person`). |
|
||||
| `for_id` | String | No | Parent object random ID. |
|
||||
| `limit` | Integer | No | **Dynamic Return:** Default `1` (returns single object). If `> 1`, returns a list. |
|
||||
|
||||
### B. Cascading Logic (Specificity)
|
||||
The API automatically resolves the "best fit" record in the following order:
|
||||
@@ -161,10 +162,10 @@ The API automatically resolves the "best fit" record in the following order:
|
||||
|
||||
### C. Example Implementation
|
||||
```ts
|
||||
// GET /v3/data_store/code/event_launcher_main_info?for_type=event&for_id=nmBfuGFeR0k
|
||||
export async function get_data_store_v3({ api_cfg, code, for_type, for_id }) {
|
||||
// GET /v3/data_store/code/event_launcher_main_info?for_type=event&for_id=nmBfuGFeR0k&limit=1
|
||||
export async function get_data_store_v3({ api_cfg, code, for_type, for_id, limit = 1 }) {
|
||||
const endpoint = `/v3/data_store/code/${code}`;
|
||||
const params = { for_type, for_id };
|
||||
const params = { for_type, for_id, limit };
|
||||
return await get_object({ api_cfg, endpoint, params });
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user