Skip to main content

Function: getFieldHandler()

getFieldHandler(c, params): Promise<{ ancestors: object[]; childCount: number; children: object[]; createdAt: string; description: string; externalIds: object[]; id: string; name: string; parentId: string; preprintCount: number; relationships: object[]; status: "approved" | "proposed" | "under_review" | "deprecated"; updatedAt: string; uri: string; }>

Defined in: src/api/handlers/xrpc/graph/getField.ts:47

Handler for pub.chive.graph.getField query.

Parameters

c

Context<ChiveEnv>

Hono context with Chive environment

params

Validated query parameters

id

string = ...

includeAncestors

boolean = ...

includeChildren

boolean = ...

includeRelationships

boolean = ...

Returns

Promise<{ ancestors: object[]; childCount: number; children: object[]; createdAt: string; description: string; externalIds: object[]; id: string; name: string; parentId: string; preprintCount: number; relationships: object[]; status: "approved" | "proposed" | "under_review" | "deprecated"; updatedAt: string; uri: string; }>

Field details with optional relationships and hierarchy

Throws

NotFoundError if field not found

Example

GET /xrpc/pub.chive.graph.getField?id=physics&includeChildren=true

Response:
{
"id": "physics",
"name": "Physics",
"children": [...],
"ancestors": [{ "id": "science", "name": "Science" }]
}