Docs
Types

WP_EndpointResult

Extract the complete result union from a generated WordPress endpoint.

WP_EndpointResult<Path> resolves everything an endpoint can return: successful data, declared failures, status codes, and response headers. Use it for a wrapper whose return type must match the generated call.

Prop

Type

import type { ActiveWordPressClient, WP_EndpointResult } from "kizlo"

export async function getFeaturedPost(
  wordpress: ActiveWordPressClient,
): Promise<WP_EndpointResult<"kizlo.postTypes.post.retrieve">> {
  return wordpress.kizlo.postTypes.post.retrieve({ params: { identifier: "featured" } })
}

Use WP_EndpointData when only the successful payload is needed.