Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Add offset/limit pagination for indexes and API keys
Browse files Browse the repository at this point in the history
  • Loading branch information
gmourier committed Apr 13, 2022
1 parent fdcd018 commit 7c8b330
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 6 deletions.
66 changes: 64 additions & 2 deletions text/0085-api-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,67 @@ Only the master key allows managing the API keys.
```
"Authorization: Bearer :masterKey"
```
##### Query Parameters

##### Response
| Field | Type | Required |
|--------------------------|--------------------------|----------|
| `offset` | Integer / `null` | false |
| `limit` | Integer / `null` | false |

###### `offset`

- Type: Integer
- Required: False
- Default: `0`

Sets the starting point in the results, effectively skipping over a given number of API keys.

###### `limit`

- Type: Integer
- Required: False
- Default: `20`

Sets the maximum number of documents to be returned by the current request.

##### Response Definition

| Field | Type | Required |
|--------------------------|--------------------------|----------|
| `result` | Array[Key] | true |
| `offset` | Integer | true |
| `limit` | Integer | true |
| `total` | Integer | true |

###### `results`

- Type: Array[Key]
- Required: True

An array containing the fetched API keys.

###### `offset`

- Type: Integer
- Required: True

Gives the `offset` parameter used for the query.

###### `limit`

- Type: Integer
- Required: True

Gives the `limit` parameter used for the query.

###### `total`

- Type: Integer
- Required: True

Gives the total number of API keys that can be browsed.

###### Example

`200 Success`

Expand Down Expand Up @@ -417,7 +476,10 @@ Only the master key allows managing the API keys.
"createdAt": "2021-08-11T10:00:00Z",
"updatedAt": "2021-08-11T10:00:00Z"
}
]
],
"offset": 0,
"limit": 20,
"total": 3
}
```

Expand Down
12 changes: 10 additions & 2 deletions text/0124-documents-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Unique identifier of an index.
| Field | Type | Required |
|--------------------------|--------------------------|----------|
| `offset` | Integer / `null` | false |
| `limit` | String / `null` | false |
| `limit` | Integer / `null` | false |
| `attributesToRetrieve` | String / `null` | false |

###### 3.1.1.2.1. `offset`
Expand Down Expand Up @@ -95,6 +95,7 @@ A `results` array representing documents as JSON objects.
| `results` | Array[Document] | true |
| `offset` | Integer | true |
| `limit` | Integer | true |
| `total` | Integer | true |

###### 3.1.1.3.1. `results`

Expand All @@ -121,6 +122,12 @@ Gives the `limit` parameter used for the query.

> See [3.1.1.2.2. `limit`](#31122-limit) section.
###### 3.1.1.3.3. `total`

- Type: Integer
- Required: True

Gives the total number of documents that can be browsed in the related index.

###### 3.1.1.3.4. Example

Expand All @@ -137,7 +144,8 @@ Gives the `limit` parameter used for the query.
}
],
"offset": 0,
"limit": 2
"limit": 2,
"total": 3 //The index contains 3 documents in total
}
```

Expand Down
57 changes: 55 additions & 2 deletions text/0132-indexes-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,74 @@ Manipulate indexes of a Meilisearch instance.

List all indexes of a Meilisearch instance.

##### 3.2.1.1. Response Definition
The results are sorted in ascending alphanumeric order from the `uid` field.

##### 3.2.1.1. Query Parameters

| Field | Type | Required |
|--------------------------|--------------------------|----------|
| `offset` | integer / `null` | false |
| `limit` | integer / `null` | false |

###### 3.2.1.1.1. `offset`

- Type: Integer
- Required: False
- Default: `0`

Sets the starting point in the results, effectively skipping over a given number of indexes.

###### 3.2.1.1.2. `limit`

- Type: Integer
- Required: False
- Default: `20`

Sets the maximum number of indexes to be returned by the current request.

##### 3.2.1.2. Response Definition

An object containing all the indexes.

| Field | Type | Required |
|--------------------------|--------------------------|----------|
| `results` | Array[Index] | true |
| `offset` | integer | true |
| `limit` | integer | true |
| `total` | integer | true |

###### 3.2.1.1.1. `results`
###### 3.2.1.2.1. `results`

- Type: Array[Index]
- Required: True

An array containing the fetched indexes.

###### 3.2.1.2.2. `offset`

- Type: Integer
- Required: True

Gives the `offset` parameter used for the query.

> See [3.2.1.1.1. `offset`](#32111-offset) section.
###### 3.2.1.2.3. `limit`

- Type: Integer
- Required: True

Gives the `limit` parameter used for the query.

> See [3.2.1.1.2. `limit`](#32112-limit) section.
###### 3.2.1.2.3. `total`

- Type: Integer
- Required: True

Gives the total number of indexes that can be browsed.

#### 3.2.2. `GET` - `indexes/:index_uid`

Fetch an index of a Meilisearch instance.
Expand Down

0 comments on commit 7c8b330

Please sign in to comment.