callEndpoint
callEndpoint<
Req,Res>(endpoint,request,options?):Promise<EndpointValidationResult<Req,Res>>
Defined in: wp-typia-rest/src/client.ts:472
Execute a WordPress REST endpoint contract with validated input and output.
Type Parameters
Section titled “Type Parameters”Req
Res
Parameters
Section titled “Parameters”endpoint
Section titled “endpoint”ApiEndpoint<Req, Res>
Contract describing the REST route and validators.
request
Section titled “request”Req
Caller input to validate and serialize.
options?
Section titled “options?”EndpointCallOptions = {}
Optional fetch implementation and request overrides.
Returns
Section titled “Returns”Promise<EndpointValidationResult<Req, Res>>
A validation result tagged as either a request or response outcome.
Remarks
Section titled “Remarks”Invalid requests return a request validation result immediately and never reach the network layer.
Example
Section titled “Example”const result = await callEndpoint(endpoint, { slug: "hero-card" });