Home > @uniformdev/canvas > CompositionManagementClient

CompositionManagementClient class

Full-CRUD management client for compositions. Reads the canonical (PUT-safe) shape from the origin host and defaults state to draft and bypassCache to true. Pass format: 'editor' per call for the editor read shape (patterns expanded, still PUT-safe).

Signature:

Extends: ContentClientBase

Constructors

Constructor

Modifiers

Description

(constructor)(options)

Constructs a new instance of the CompositionManagementClient class

Methods

Method

Modifiers

Description

get(args)

Fetches one composition in canonical shape (throws ApiClientError(404) if absent).

history(args)

Fetches historical versions of a composition or pattern.

list(args)

Fetches a list of compositions in canonical shape.

remove(selector)

Deletes across all states. Scoped to a single edition when editionId is supplied; otherwise deletes all states and editions. Use unpublish to drop only the published state.

save(body, opts)

Creates or updates a composition. Returns the new x-modified-at timestamp.

saveAndPublish(body, opts)

Saves the draft and publishes in one call (two PUTs). The optimistic concurrency guard, if any, applies to the draft write.

unpublish(selector)

Removes only the published state, leaving the draft intact. Scoped to a single edition when editionId is supplied; otherwise unpublishes all editions. To unpublish only the base edition, pass editionId and compositionId as the same value.