Skip to content

Configuration

DavidDuwaer edited this page Sep 25, 2017 · 7 revisions

Oops! Not much of this page has been written yet. However, our readme features a short version of this section. If the information is not elaborate enough, don't hesitate to create an issue notifying us about it!

Basics (required)

  • URL of the JSON-API

Pagination

Choosing between offset-based or page-based pagination

Coloquent has to translate its queries to HTTP URL strings, and in this process it has to choose between generating pagination parameters page[offset]=... and page[limit]=... (called offset-based pagination), or to generate page[]=... and page[size]=... (called page-based pagination). Bdefault, Coloquent translates to offset-based paginaion. This is determined by the static property Model.paginationStrategy, which can be overriden. I.e., to use page-based pagination, write

class YourModel extends Model
{
    protected static paginationStrategy: PaginationStrategy = PaginationStrategy.PageBased;
}

To explicitly use offset-based pagination, write

class YourModel extends Model
{
    protected static paginationStrategy: PaginationStrategy = PaginationStrategy.OffsetBased;
}

Overriding offset-based pagination parameter names

Overriding page-based pagination parameter names

Clone this wiki locally