Saltar al contenido
Meeko
Escribe para buscar en las guías y en la referencia de la API. Ábrela desde cualquier página con / o Ctrl K; muévete con las flechas y entra con Intro.
Empezar

Contenidos

En esta página

ApiMutationContract

tipo Desde 1.2.0

Operaciones de escritura (POST, PUT, PATCH, DELETE) de un contrato de API indexadas por ruta y método (["/api/notes"]["POST"]), a partir del manifiesto público. Es el tipo que recibe UseApiMutation.

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

Código fuente src/app/composables/resources/engine.ts:361

Declaración #

ts
type ApiMutationContract<Manifest, Contract> = {
	[P in MutationEndpoint<Manifest>['pathname']]: {
		[E in Extract<MutationEndpoint<Manifest>, { readonly pathname: P }> as E['method']]: MethodOperation<Contract, E['clientKey'], E['method']>
	}
}

Parámetros de tipo #

Manifest

Manifiesto público con los endpoints (pathname, method, clientKey).

Contract

Contrato ApiContract generado, indexado por clientKey.

Ejemplo #

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

type Contract = { notes: { post: ApiOperation<undefined, undefined, { text: string }, { id: string }> } };
declare const manifest: { readonly api: readonly [{ readonly clientKey: "notes"; readonly pathname: "/api/notes"; readonly method: "POST" }] };
// Mutations["/api/notes"]["POST"] es la operación de api.notes.post.
type Mutations = ApiMutationContract<typeof manifest, Contract>;

¿Te sirvió esta página?

Añadir un comentario

Se envía al elegir «Sí» o «No». Solo se guardan la página, tu respuesta y el comentario: ni cookies ni datos tuyos.

0 de 2000 caracteres

Editar en GitHub: packages/meeko/src/app/composables/resources/engine.ts