A JSON:API URL query string.

interface JsonApiQuery<T extends JsonApiQueryTypes> {
    fields?: Record<string, string[]>;
    filter?: Record<
        string,
        {
            eq?: T["filterValue"];
            gt?: T["filterValue"];
            gte?: T["filterValue"];
            lt?: T["filterValue"];
            lte?: T["filterValue"];
            ne?: T["filterValue"];
        },
    >;
    include?: string[];
    page?: {
        cursor?: T["pageValue"];
        limit?: T["pageValue"];
        number?: T["pageValue"];
        offset?: T["pageValue"];
        size?: T["pageValue"];
    };
    sort?: string[];
}

Type Parameters

Properties

fields?: Record<string, string[]>

Fields to include in the response.

filter?: Record<
    string,
    {
        eq?: T["filterValue"];
        gt?: T["filterValue"];
        gte?: T["filterValue"];
        lt?: T["filterValue"];
        lte?: T["filterValue"];
        ne?: T["filterValue"];
    },
>

Filters to apply to the query.

include?: string[]

Relationships to include in the response.

page?: {
    cursor?: T["pageValue"];
    limit?: T["pageValue"];
    number?: T["pageValue"];
    offset?: T["pageValue"];
    size?: T["pageValue"];
}

Pagination data.

sort?: string[]

Sorting data. Include the "-" prefix for descending order.