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.

ApiMutationContract

tipo Since 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";

Source code 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']>
	}
}

Type parameters #

Manifest

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

Contract

Contrato ApiContract generado, indexado por clientKey.

Example #

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>;

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/app/composables/resources/engine.ts