Pular para o conteúdo principal

externalModelCategoryInstance <D>

An Instance that provide methods to request information from a ModelCategory and its Entries.

You can access a ModelCategoryInstance using ModelInstance.category or using the dynamic syntax on a DynamicModelInstance. Usage examples will use the dynamic syntax.

To list all categories from a model, use a ModelCategorySelector.

Index

Methods

Methods

externalentries

  • Returns a StarlightListResponse with the list of entries of this ModelCategory.

    @example

    Requesting all items from a category called “gaming” in a model of slug “posts”.

    import Starlight from '@starlightcms/js-sdk'

    const response = await Starlight.posts.gaming.items()
    @example

    Paginating and searching on the last example.

    import Starlight from '@starlightcms/js-sdk'

    const response = await Starlight.posts.gaming.items({
    page: 5,
    query: 'kirby'
    })

    Parameters

    Returns Promise<StarlightListResponse<Entry<D>>>

externalget