Concorde documentation (crawl) · interactive version

Concorde decorator — @put. Sends data through API.putDetailed. Same model as @post: decorated property is ApiResult<T> | null (request, response, result). Doc ID: docs/_decorators/put. Keywords: Concorde, supersoniks, docs/_decorators/put, put, @put, decorator, API.putDetailed, ApiResult | null, request, response, result, Endpoint, DataProviderKey, ApiResult, @supersoniks/concorde/decorators. URL: https://concorde.supersoniks.org/crawl/docs/_decorators/put.html.

@put

Sends data through API.putDetailed. 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 put and ApiResult from @supersoniks/concorde/decorators.

Configuration

Same as @post / @get: scoped HTML.getApiConfiguration(host) or DataProviderKey<APIConfiguration> as third argument.

Options (PutOptions)

Same shape as PostOptions on @post (ApiSendOptions): refetchEveryMs, skipIfBodyMissing, autoPostOnBodyMutation, triggerKey, skipEmptyPlaceholder. See Dynamic path placeholders for ${sessionId} and empty-string behaviour.

Import

import { put, type ApiResult } from "@supersoniks/concorde/decorators";
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";

Example

const bodyKey = new DataProviderKey&lt;UpdatePayload&gt;("resourceBody");

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

Changing resourceId on the host re-runs the PUT when the path becomes ready — see Dynamic path placeholders.

See also