Concorde documentation (crawl) · interactive version

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&lt;Partial&lt;Resource&gt;&gt;("resourcePatch");

@patch(
  new Endpoint&lt;Resource, { resourceId: string }&gt;("resources/${resourceId}"),
  patchBodyKey,
  { skipEmptyPlaceholder: true },
)
@state()
payload?: ApiResult&lt;Resource&gt; | null;

See also