ApiQueryContract
tipo Since 1.1.0
Operaciones GET de un contrato de API indexadas por ruta ("/api/users/[id]"), a partir del
manifiesto público de la aplicación. Es el tipo que recibe UseApi.
ts
import type { ApiQueryContract } from "@meekojs/meeko/framework";Source code src/app/composables/resources/engine.ts:272
Declaración #
ts
type ApiQueryContract<Manifest, Contract> = {
[E in GetEndpoint<Manifest> as E['pathname']]: GetOperation<Contract, E['clientKey']>
}Type parameters #
-
Manifest Manifiesto público con los endpoints (
pathname,method,clientKey).-
Contract Contrato
ApiContractgenerado, indexado porclientKey.
Example #
ts
import type { ApiQueryContract } from "@meekojs/meeko/framework";
type Contract = { users: { get: { params: undefined; query: undefined; output: string[] } } };
declare const manifest: { readonly api: readonly [{ readonly clientKey: "users"; readonly pathname: "/api/users"; readonly method: "GET" }] };
// Queries["/api/users"] es la operación GET de api.users.
type Queries = ApiQueryContract<typeof manifest, Contract>;