Skip to content

deleteEnum

The deleteEnum function deletes an Enum model. It is the JavaScript/TypeScript counterpart of the DELETE /model/enum/:id REST endpoint.

Example:

import { isApiClientError } from '@content-island/api-client';
try {
await client.deleteEnum(enumId);
// resolves to `true` on success
} catch (error) {
if (isApiClientError(error) && error.code === 'CONFLICT') {
// an entity field references this enum — repoint or remove that field first
}
}

Interface

export interface ApiClient {
deleteEnum: (enumId: string) => Promise<boolean>;
// ... other methods
}

Parameters

NameDescription
enumIdThe id of the enum to delete.

Output

Resolves to true when the enum is deleted (HTTP 204). On failure it throws a typed ApiClientError:

  • CONFLICT (409) — an entity field of type enum references this enum. There is no force override; remove or repoint the referencing field first.
  • NOT_FOUND (404) — no enum with that id exists.