Concorde decorator — @patch. Sends data through API.patchDetailed. Same model as @post: decorated property is ApiResult<T> | null (request, response, result). Doc ID: docs/_decorators/patch. Keywords: Concorde, supersoniks, docs/_decorators/patch, patch, @patch, decorator, API.patchDetailed, ApiResult | null, request, response, result, Endpoint, DataProviderKey, ApiResult, @supersoniks/concorde/decorators. URL: https://concorde.supersoniks.org/crawl/docs/_decorators/patch.html.
@patch
Sends data through API.patchDetailed. Same model as @post: decorated property is ApiResult<T> | null (request, response, result).
Pass an Endpoint<T> and a DataProviderKey for the request body. Import patch and ApiResult from @supersoniks/concorde/decorators.
Configuration
Same as @post / @get: scoped HTML.getApiConfiguration(host) or DataProviderKey<APIConfiguration> as third argument.
Options (PatchOptions)
Same shape as PostOptions on @post (ApiSendOptions): refetchEveryMs, skipIfBodyMissing, autoPostOnBodyMutation, triggerKey, skipEmptyPlaceholder. See Dynamic path placeholders for ${sessionId} and empty-string behaviour.
Import
import { patch, type ApiResult } from "@supersoniks/concorde/decorators";
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
Example
const patchBodyKey = new DataProviderKey<Partial<Resource>>("resourcePatch");
@patch(
new Endpoint<Resource, { resourceId: string }>("resources/${resourceId}"),
patchBodyKey,
{ skipEmptyPlaceholder: true },
)
@state()
payload?: ApiResult<Resource> | null;
See also
- @post — POST (live demos)
- @put — full replacement (PUT)
- Dynamic path placeholders