Pular para o conteúdo principal

StarlightListResponse <T>

This interface represents an API response that returns a list of entities, like a list of Entries or a list of items from a Collection.

It contains a data parameter, which is an array of items with a generic type that depends on the kind of request that was made, and two metadata objects: links and meta. Metadata is useful for pagination.

All SDK request methods that return a list of entities will return this interface.

Index

Properties

Properties

data

data: T[]

The list of entities returned by the API request. Its type depends on which request was made. SDK methods will generally type this parameter automatically.

links

links: { first: string; last: string; next?: string; prev?: string }

An object containing useful links for easier pagination. All links points to the same list requested, but with a varying page parameter.


Type declaration

  • first: string

    A link for the first page of the list.

  • last: string

    A link for the last page of the list.

  • optionalnext?: string

    A link to the next page of the list, if there’s any.

  • optionalprev?: string

    A link to the previous page of the list, if there’s any.

meta

meta: { current_page: number; from: number; last_page: number; per_page: number; to: number; total: number }

An object with useful metadata related to the current list. It can be used in applications to create pagination logic and interfaces.

from and to are indexes indicating which items start and finish the current page of the list. For instance, in a list with 100 items with 15 items per page, on the first page, from and to will be 1 and 15 respectively.


Type declaration

  • current_page: number

    The number of the current page.

  • from: number

    The index of the first item on this page out of all list items.

  • last_page: number

    The number of the last page for the current list.

  • per_page: number

    The number of items per page.

  • to: number

    The index of the last item on this page out of all list items.

  • total: number

    The total number of items in the current list.