Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

ApiOperation

interfaz

Declaración de tipos de una operación de API, que el contrato generado infiere de los schemas públicos de shared/. undefined en un campo indica que la operación no lo acepta.

ts
import type { ApiOperation } from "@meekojs/meeko/framework";

Source code src/shared/clients.ts:112

Declaración #

ts
interface ApiOperation<Params = undefined, Query = undefined, Body = undefined, Output = unknown> {
	readonly params: Params
	readonly query: Query
	readonly body: Body
	readonly output: Output
}

Type parameters #

Params = undefined
Query = undefined
Body = undefined
Output = unknown

Example #

ts
import { createApiClient } from "@meekojs/meeko/framework";
import type { ApiOperation } from "@meekojs/meeko/framework";

type GetUser = ApiOperation<{ id: string }, undefined, undefined, { id: string; name: string }>;
const api = createApiClient<{ "users.byId": { get: GetUser } }>({
  api: [{ clientKey: "users.byId", pathname: "/api/users/[id]", method: "GET" }],
});
const user = await api.users({ id: "123" }).get();

Propiedades #

params #

propiedad sólo lectura

readonly params: Params

Segmentos dinámicos de la ruta.

query #

propiedad sólo lectura

readonly query: Query

Parámetros de la query string.

body #

propiedad sólo lectura

readonly body: Body

Cuerpo JSON de la petición.

output #

propiedad sólo lectura

readonly output: Output

Respuesta del endpoint.

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/shared/clients.ts