Pular para o conteúdo principal

externalCollectionSelector

A Selector that provide methods to list and request information on Collections.

You can use a CollectionSelector by accessing StarlightClient.collections.

To get items from a specific collection, use a CollectionInstance.

Index

Methods

Methods

externalget

  • Returns a StarlightItemResponse with a single Collection.

    @example

    Requesting information from a collection of slug “event-photos”.

    import Starlight from '@starlightcms/js-sdk'

    const response = await Starlight.collections.get('event-photos')

    Parameters

    • externalslug: string | number

      The collection slug.

    Returns Promise<StarlightItemResponse<Collection<string>>>

externallist

  • Returns a StarlightListResponse with the list of Collections in this workspace.

    @example

    Requesting all collections from the workspace.

    import Starlight from '@starlightcms/js-sdk'

    const response = await Starlight.collections.list()
    @example

    Paginating and searching on the last example.

    import Starlight from '@starlightcms/js-sdk'

    const response = await Starlight.collections.list({
    page: 2,
    query: 'photos',
    })

    Parameters

    Returns Promise<StarlightListResponse<Collection<string>>>