interface ContentType {
    description: string;
    displayField: string;
    fields: ContentFields<KeyValueMap>[];
    metadata?: ContentTypeMetadata;
    name: string;
    sys: BasicMetaSysProps & {
        environment: SysLink;
        firstPublishedAt?: string;
        publishedCounter?: number;
        publishedVersion?: number;
        space: SysLink;
    };
    delete(): Promise<void>;
    getEditorInterface(): Promise<EditorInterface>;
    getSnapshot(snapshotId: string): Promise<SnapshotProps<ContentTypeProps>>;
    getSnapshots(): Promise<Collection<Snapshot<ContentTypeProps>, SnapshotProps<ContentTypeProps>>>;
    isDraft(): boolean;
    isPublished(): boolean;
    isUpdated(): boolean;
    omitAndDeleteField(id: string): Promise<ContentType>;
    publish(): Promise<ContentType>;
    toPlainObject(): ContentTypeProps;
    unpublish(): Promise<ContentType>;
    update(): Promise<ContentType>;
}

Hierarchy (view full)

Properties

description: string
displayField: string

Field used as the main display field for Entries

All the fields contained in this Content Type

name: string
sys: BasicMetaSysProps & {
    environment: SysLink;
    firstPublishedAt?: string;
    publishedCounter?: number;
    publishedVersion?: number;
    space: SysLink;
}

Methods

  • Deletes this object on the server.

    Returns Promise<void>

    Promise for the deletion. It contains no data, but the Promise error case should be handled.

  • Gets the editor interface for the object
    Important note: The editor interface only represent a published contentType.
    To get the most recent representation of the contentType make sure to publish it first

    Returns Promise<EditorInterface>

    Object returned from the server with the current editor interface.

  • Gets a snapshot of a contentType

    Parameters

    • snapshotId: string

      Id of the snapshot

    Returns Promise<SnapshotProps<ContentTypeProps>>

  • Checks if the contentType is in draft mode. This means it is not published.

    Returns boolean

  • Checks if the contentType is published. A published contentType might have unpublished changes (@see {ContentType.isUpdated})

    Returns boolean

  • Checks if the contentType is updated. This means the contentType was previously published but has unpublished changes.

    Returns boolean

  • Omits and deletes a field if it exists on the contentType. This is a convenience method which does both operations at once and potentially less safe than the standard way. See note about deleting fields on the Update method.

    Parameters

    • id: string

    Returns Promise<ContentType>

    Object returned from the server with updated metadata.

  • Publishes the object

    Returns Promise<ContentType>

    Object returned from the server with updated metadata.

  • Unpublishes the object

    Returns Promise<ContentType>

    Object returned from the server with updated metadata.

  • Sends an update to the server with any changes made to the object's properties.
    Important note about deleting fields: The standard way to delete a field is with two updates: first omit the property from your responses (set the field attribute "omitted" to true), and then delete it by setting the attribute "deleted" to true. See the "Deleting fields" section in the API reference for more reasoning. Alternatively, you may use the convenience method omitAndDeleteField to do both steps at once.

    Returns Promise<ContentType>

    Object returned from the server with updated changes.