updateEnum
The updateEnum function updates an existing Enum model. It is the JavaScript/TypeScript counterpart of the PUT /model/enum/:id REST endpoint.
The params describe the desired final state; the server reconciles them against the current enum by value id. Keep an existing value’s id to preserve it (change its value to rename it — the new label propagates into content), add a value without an id, and omit a value to remove it (clearing it from existing content).
Example:
// Rename the enum, rename `S` → `Small` (keep its id), add `XL`, drop the rest by omission.const { id } = await client.updateEnum(enumId, { name: 'TshirtSize', values: [ { id: smallValueId, value: 'Small' }, { id: mediumValueId, value: 'M' }, { value: 'XL' }, ],});Interface
export interface ApiClient { updateEnum: (enumId: string, params: UpdateEnumParams) => Promise<SaveModelResponse>; // ... other methods}
// Same shape as CreateEnumParams.export type UpdateEnumParams = CreateEnumParams;
export interface SaveModelResponse { id: string;}Parameters
| Name | Description |
|---|---|
enumId | The id of the enum to update. |
params | The new name and the complete desired values list (each with its id to preserve it). |
Output
Returns a Promise<SaveModelResponse> resolving to { id }. On failure it throws a typed
ApiClientError — NOT_FOUND if no enum has that id.