Pular para o conteúdo principal

externalModelInstance <D>

An Instance that provide methods to request information from a Model, its Entries, and its Categories.

You can access a ModelInstance using StarlightClient.model or using the dynamic syntax on a DynamicStarlightClient. Usage examples will use the dynamic syntax.

To list all workspace models, use a ModelSelector.

Index

Accessors

externalcategories

  • Returns a DynamicModelCategorySelector.

    This is an accessor, which means that it should be used just like a common object parameter. For instance:

    import Starlight from '@starlightcms/js-sdk'

    // "categories" below is a DynamicModelCategorySelector.
    const response = await Starlight.posts.categories.get('interviews')

    Returns DynamicModelCategorySelector<D>

externalentries

  • Returns an EntrySelector.

    This is an accessor, which means that it should be used just like a common object parameter. For instance:

    import Starlight from '@starlightcms/js-sdk'

    // "entries" below is an EntrySelector.
    const response = await Starlight.posts.entries.list()

    Returns EntrySelector<D>

Methods

externalcategory

  • Returns a ModelCategoryInstance.

    If you’re using a DynamicModelInstance, you can use the dynamic syntax instead of this method.

    @example

    Listing all entries from the “news” category of a model of slug “posts”.

    import Starlight from '@starlightcms/js-sdk'

    const response = await Starlight.posts.category('news').entries()

    Parameters

    • externalslug: string

      The category slug.

    Returns ModelCategoryInstance<D>

externalget