Add missing query param docs

This commit is contained in:
rijkvanzanten
2020-12-09 19:31:16 -05:00
parent c0d1eeed25
commit a91c5cc8a6
16 changed files with 244 additions and 1 deletions

View File

@@ -38,6 +38,11 @@ const systemDefaults: Record<string, Partial<Preset>> = {
directus_users: {
collection: 'directus_users',
layout: 'cards',
layout_query: {
cards: {
sort: 'email',
},
},
layout_options: {
cards: {
icon: 'account_circle',

View File

@@ -0,0 +1,3 @@
# Download
Download the generated asset as a file.

View File

@@ -1,3 +1,39 @@
# Fields
@TODO
`fields` is a CSV of columns to include in the result. This parameter supports dot notation to request nested relational
fields. You can also use a wildcard (\*) to include all fields at a specific depth.
## Examples
```
# Get all top-level fields
?fields=*
# Get all top-level fields and all second-level relational fields
?fields=*.*
# Get all top-level fields and second-level relational fields within images
?fields=*,images.*
# Get only the first_name and last_name fields
?fields=first_name,last_name
# Get all top-level and second-level relational fields, and third-level fields within images.thumbnails
?fields=*.*,images.thumbnails.*
```
Alternatively, you can use the array syntax to specify multiple fields:
```
?fields[]=*
&fields[]=images.*
?fields[]=first_name
&fields[]=last_name
?fields[]=title
&fields[]=images
&fields[]=thumbnails.*
```

View File

@@ -0,0 +1,49 @@
# Filter
Used to search items in a collection that matches the filter's conditions. Filters follow the syntax
`filter[<field-name>][<operator>]=<value>`.
#### Filter Operators
| Operator | Description |
| ------------ | ----------------------------------------- |
| `_eq` | Equal to |
| `_neq` | Not equal to |
| `_lt` | Less than |
| `_lte` | Less than or equal to |
| `_gt` | Greater than |
| `_gte` | Greater than or equal to |
| `_in` | Exists in one of the values |
| `_nin` | Not in one of the values |
| `_null` | It is null |
| `_nnull` | It is not null |
| `_contains` | Contains the substring |
| `_ncontains` | Doesn't contain the substring |
| `_rlike` | Contains a substring using a wildcard |
| `_nrlike` | Not contains a substring using a wildcard |
| `_between` | The value is between two values |
| `_nbetween` | The value is not between two values |
| `_empty` | The value is empty (null or falsy) |
| `_nempty` | The value is not empty (null or falsy) |
| `_all` | Contains all given related item's IDs |
| `_has` | Has one or more related items's IDs |
#### Filter: Relational
You can filter by relational values by appending the field names in nested sections in the parameter, as follows:
`?filter[author][name][_eq]=Rijk`
#### Filtering using JSON
The `filter` parameter supports the full [Filter Rules](/reference/filter-rules.html) syntax. As a matter of fact, the
standard array-like syntax is parsed to an object in execution. This means that you can also pass filter rules as a JSON
object in the parameter directly:
```
?filter={ "status": { "_eq": "active" }}
```
#### AND vs OR
See [Filter Rules](/reference/filter-rules.html) for more information on how to nest logical operations in a filter.

View File

@@ -0,0 +1,15 @@
# Fit
Controls how the image is being fitted within the binding box. Can be compared to CSS' `object-fit`.
## Examples
```
?fit=cover
?fit=contain
?fit=inside
?fit=outside
```

View File

@@ -0,0 +1,12 @@
# Height
Sets the height in pixels of the generated asset.
## Examples
```
?height=500
?height=1080
&width=1920
```

View File

@@ -0,0 +1,11 @@
# Asset Key
The key of the asset size configured in settings.
Note: you can't combine this with any of the other transformation query parameters, like `width`, `height`, or `fit`
## Examples
```
/assets/b10e9716-7270-423b-b857-039b252e1408?key=system-small-cover
```

View File

@@ -0,0 +1,20 @@
# Limit
Using `limit` can be set the maximum number of items that will be returned. You can also use `-1` to return all items,
bypassing the default limits. The default limit is set to 100.
## Examples
```
# Returns a maximum of 10 items
?limit=10
# Returns an unlimited number of items
?limit=-1
```
<!-- prettier-ignore-start -->
::: warning
Fetching unlimited data may result in degraded performance or timeouts, use with caution.
:::
<!-- prettier-ignore-end -->

View File

@@ -0,0 +1,16 @@
# Metadata
The `meta` parameter is a CSV of metadata fields to include. This parameter supports the wildcard (`*`) to return all
metadata fields.
## Options
- `total_count` - Total number of items in this collection
- `filter_count` - Number of items matching the filter query
```json
{
"total_count": 962,
"filter_count": 120
}
```

View File

@@ -0,0 +1,11 @@
# Offset
Using `offset` the first `offset` number of items can be skipped.
## Examples
```
# Returns a maximum of 10 items, but skips the first 3 items on the list
?offset=3
&limit=10
```

View File

@@ -0,0 +1,3 @@
# Quality
Quality of the compression. 0-100

View File

@@ -0,0 +1,5 @@
# Search
The `search` parameter allows you to perform a search on all string and text type fields within a collection. It's an
easy way to search for an item without creating complex field filters though it is far less optimized. It only
searches the root item's fields, related item fields are not included.

View File

@@ -0,0 +1,19 @@
# Single
Using `single` the first element will be returned.
<!-- prettier-ignore-start -->
::: tip NOTE
Instead of returning a list, the result data will be a single object representing the first item.
:::
<!-- prettier-ignore-end -->
## Examples
```
# Returns the first item of the result set
?single=1
?filter[author][first_name]=Rijk
&single
```

View File

@@ -0,0 +1,17 @@
# Sorting
`sort` is a CSV of fields used to sort the fetched items. Sorting defaults to ascending (ASC) order but a minus sign
(`-`) can be used to reverse this to descending (DESC) order. Fields are prioritized by their order in the CSV.
## Examples
```
# Sorts by name ASC
?sort=name
# Sorts by name ASC, followed by age DESC
?&sort=name,-age
# Sorts by name ASC, followed by age DESC
?sort=name,-age
```

View File

@@ -0,0 +1,12 @@
# Width
Sets the width in pixels of the generated asset.
## Examples
```
?width=500
?width=1920
&height=1080
```

View File

@@ -0,0 +1,9 @@
# Without Enlargement
Prevents the file from being upscaled if the dimensions are bigger than the original file.
## Examples
```
?withoutEnlargement
```