ContentType Collection

View as Markdown

ContentType Collection

The ContentType Collection method retrieves a list of all content types available within a stack. It provides metadata and structural details for each content type but does not retrieve actual content entries.

Example:

const contentType = await stack.contentType().find<BlogPost>();

find

The find method retrieves all the content types of the stack.

Example:

import { BaseContentType, FindContentType } from '@contentstack/delivery-sdk'



interface BlogPostContentType extends BaseContentType {

  // custom content type schema

}


const result = await stack.contentType().find<BlogPostContentType>();

includeGlobalFieldSchema

The includeGlobalFieldSchema method includes the schema of the global field in the response.

Example:

const contentType = stack.ContentType();
const result = contentType.includeGlobalFieldSchema().find<ContentTypes>();