Skip to content

Commit 900ad45

Browse files
committed
feat(clients): add collections
1 parent aaf1fd9 commit 900ad45

File tree

12 files changed

+413
-0
lines changed

12 files changed

+413
-0
lines changed

config/clients.config.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"abtesting",
66
"abtesting-v3",
77
"analytics",
8+
"collections",
89
"composition",
910
"ingestion",
1011
"insights",
@@ -39,6 +40,10 @@
3940
"name": "abtesting-v3",
4041
"output": "clients/algoliasearch-client-dart/packages/client_abtesting_v3"
4142
},
43+
{
44+
"name": "collections",
45+
"output": "clients/algoliasearch-client-dart/packages/client_collections"
46+
},
4247
{
4348
"name": "composition",
4449
"output": "clients/algoliasearch-client-dart/packages/client_composition"
@@ -76,6 +81,7 @@
7681
"abtesting",
7782
"abtesting-v3",
7883
"analytics",
84+
"collections",
7985
"composition",
8086
"ingestion",
8187
"insights",
@@ -105,6 +111,7 @@
105111
"abtesting",
106112
"abtesting-v3",
107113
"analytics",
114+
"collections",
108115
"composition",
109116
"ingestion",
110117
"insights",
@@ -153,6 +160,10 @@
153160
"name": "analytics",
154161
"output": "clients/algoliasearch-client-javascript/packages/client-analytics"
155162
},
163+
{
164+
"name": "collections",
165+
"output": "clients/algoliasearch-client-javascript/packages/collections"
166+
},
156167
{
157168
"name": "composition",
158169
"output": "clients/algoliasearch-client-javascript/packages/composition",
@@ -218,6 +229,7 @@
218229
"abtesting",
219230
"abtesting-v3",
220231
"analytics",
232+
"collections",
221233
"composition",
222234
"ingestion",
223235
"insights",
@@ -247,6 +259,7 @@
247259
"abtesting",
248260
"abtesting-v3",
249261
"analytics",
262+
"collections",
250263
"composition",
251264
"ingestion",
252265
"insights",
@@ -276,6 +289,7 @@
276289
"abtesting",
277290
"abtesting-v3",
278291
"analytics",
292+
"collections",
279293
"composition",
280294
"ingestion",
281295
"insights",
@@ -312,6 +326,7 @@
312326
"abtesting",
313327
"abtesting-v3",
314328
"analytics",
329+
"collections",
315330
"composition",
316331
"ingestion",
317332
"insights",
@@ -341,6 +356,7 @@
341356
"abtesting",
342357
"abtesting-v3",
343358
"analytics",
359+
"collections",
344360
"composition",
345361
"ingestion",
346362
"insights",
@@ -370,6 +386,7 @@
370386
"abtesting",
371387
"abtesting-v3",
372388
"analytics",
389+
"collections",
373390
"composition",
374391
"ingestion",
375392
"insights",

config/clients.schema.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"abtesting",
1515
"abtesting-v3",
1616
"analytics",
17+
"collections",
1718
"composition",
1819
"ingestion",
1920
"insights",
@@ -38,6 +39,7 @@
3839
"abtesting",
3940
"abtesting-v3",
4041
"analytics",
42+
"collections",
4143
"composition",
4244
"composition-full",
4345
"ingestion",
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
indexName:
2+
name: indexName
3+
in: query
4+
required: true
5+
description: Name of the index.
6+
schema:
7+
type: string
8+
example: ALGOLIA_INDEX_NAME
9+
10+
paginationLimit:
11+
name: limit
12+
in: query
13+
description: Number of items to fetch.
14+
required: false
15+
schema:
16+
$ref: './schemas/pagination.yml#/limit'
17+
18+
paginationOffset:
19+
name: offset
20+
in: query
21+
description: Number of items to skip.
22+
required: false
23+
schema:
24+
$ref: './schemas/pagination.yml#/offset'
25+
26+
pathCollectionID:
27+
name: collectionID
28+
in: path
29+
required: true
30+
description: Unique identifier of a collection.
31+
schema:
32+
$ref: './schemas/common.yml#/collectionID'
33+
34+
query:
35+
name: query
36+
in: query
37+
required: false
38+
description: Query to filter collections.
39+
schema:
40+
$ref: './schemas/common.yml#/query'
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
description: Collection not found.
2+
content:
3+
application/json:
4+
schema:
5+
title: collectionNotFoundResponse
6+
type: object
7+
properties:
8+
message:
9+
type: string
10+
example: 'Collection not found'
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
Collection:
2+
type: object
3+
properties:
4+
id:
5+
type: string
6+
example: '5db3039e-04b5-4ed6-a00e-ba3304032c5a'
7+
name:
8+
type: string
9+
example: 'Summer Deals'
10+
indexName:
11+
type: string
12+
example: 'prod_products_EN'
13+
createdAt:
14+
type: string
15+
format: date-time
16+
example: '2024-10-07T00:00:00Z'
17+
updatedAt:
18+
type: string
19+
format: date-time
20+
example: '2024-10-07T00:00:00Z'
21+
status:
22+
$ref: '#/CollectionStatus'
23+
conditions:
24+
$ref: 'condition.yml#/Conditions'
25+
records:
26+
type: array
27+
items:
28+
type: string
29+
30+
CollectionStatus:
31+
type: string
32+
description: |
33+
Collection commit status.
34+
Only returned if the request API key has write ACLs.
35+
enum:
36+
- COMMITTED
37+
- COMMITTING
38+
- TO_COMMIT
39+
40+
CollectionUpsert:
41+
type: object
42+
description: API request body for upserting a Collection.
43+
properties:
44+
id:
45+
type: string
46+
indexName:
47+
type: string
48+
name:
49+
type: string
50+
description:
51+
type: string
52+
add:
53+
type: array
54+
description: a list of objectIDs.
55+
minItems: 0
56+
items:
57+
type: string
58+
remove:
59+
type: array
60+
description: a list of objectIDs.
61+
minItems: 0
62+
items:
63+
type: string
64+
conditions:
65+
$ref: 'condition.yml#/Conditions'
66+
required:
67+
- indexName
68+
- name
69+
70+
CollectionsResponse:
71+
type: object
72+
allOf:
73+
- type: object
74+
properties:
75+
items:
76+
type: array
77+
items:
78+
$ref: '#/Collection'
79+
required:
80+
- items
81+
- $ref: 'pagination.yml#/Pagination'
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
collectionID:
2+
type: string
3+
# format: uuid
4+
description: Universally unique identifier (UUID) of a collection.
5+
example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
6+
7+
query:
8+
type: string
9+
description: Query to filter collections.
10+
example: Summer collection
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Conditions:
2+
type: object
3+
description: Conditions to filter records.
4+
properties:
5+
facetFilters:
6+
$ref: '../../../common/schemas/SearchParams.yml#/facetFilters'
7+
numericFilters:
8+
$ref: '../../../common/schemas/SearchParams.yml#/numericFilters'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Pagination:
2+
type: object
3+
description: Paginated API response.
4+
additionalProperties: false
5+
properties:
6+
total:
7+
type: integer
8+
minimum: 0
9+
description: Total number of items across all pages.
10+
limit:
11+
$ref: '#/limit'
12+
offset:
13+
$ref: '#/offset'
14+
required:
15+
- total
16+
- limit
17+
- offset
18+
19+
limit:
20+
type: integer
21+
description: Number of items to fetch.
22+
minimum: 1
23+
maximum: 50
24+
default: 10
25+
26+
offset:
27+
type: integer
28+
description: Number of items to skip.
29+
minimum: 0
30+
default: 0
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
get:
2+
summary: Retrieve a collection
3+
description: Retrieves a collection by its ID.
4+
operationId: getCollection
5+
x-acl:
6+
- search
7+
parameters:
8+
- $ref: '../common/parameters.yml#/pathCollectionID'
9+
responses:
10+
'404':
11+
$ref: '../common/responses/CollectionNotFound.yml'
12+
'200':
13+
description: The requested collection.
14+
content:
15+
application/json:
16+
schema:
17+
title: getCollectionResponse
18+
$ref: '../common/schemas/collection.yml#/Collection'
19+
20+
delete:
21+
summary: Delete a collection
22+
description: Deletes a collection by its ID.
23+
operationId: deleteCollection
24+
x-acl:
25+
- search
26+
- addObject
27+
- deleteIndex
28+
- settings
29+
- editSettings
30+
parameters:
31+
- $ref: '../common/parameters.yml#/pathCollectionID'
32+
responses:
33+
'404':
34+
$ref: '../common/responses/CollectionNotFound.yml'
35+
'200':
36+
description: Collection deleted successfully.
37+
content:
38+
application/json:
39+
schema:
40+
title: deleteCollectionResponse
41+
type: object
42+
properties:
43+
message:
44+
type: string
45+
example: 'Collection with id {collectionID} deleted.'
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
get:
2+
summary: List collections
3+
description: Retrieves a list of collections for a specific index.
4+
operationId: listCollections
5+
x-acl:
6+
- search
7+
parameters:
8+
- $ref: '../common/parameters.yml#/indexName'
9+
- $ref: '../common/parameters.yml#/query'
10+
- $ref: '../common/parameters.yml#/paginationLimit'
11+
- $ref: '../common/parameters.yml#/paginationOffset'
12+
responses:
13+
'400':
14+
$ref: '../../common/responses/BadRequest.yml'
15+
'200':
16+
description: A list of collections.
17+
content:
18+
application/json:
19+
schema:
20+
title: listCollectionsResponse
21+
$ref: '../common/schemas/collection.yml#/CollectionsResponse'
22+
23+
post:
24+
summary: Upsert a collection
25+
description: Upserts a collection.
26+
operationId: upsertCollection
27+
x-acl:
28+
- search
29+
- addObject
30+
- deleteIndex
31+
- settings
32+
- editSettings
33+
requestBody:
34+
description: Request body for upserting a Collection.
35+
content:
36+
application/json:
37+
schema:
38+
$ref: '../common/schemas/collection.yml#/CollectionUpsert'
39+
responses:
40+
'400':
41+
$ref: '../../common/responses/BadRequest.yml'
42+
'201':
43+
description: Collection created.
44+
content:
45+
application/json:
46+
schema:
47+
title: upsertCollectionResponse
48+
$ref: '../common/schemas/collection.yml#/Collection'
49+
'200':
50+
description: Collection updated.
51+
content:
52+
application/json:
53+
schema:
54+
title: upsertCollectionResponse
55+
$ref: '../common/schemas/collection.yml#/Collection'

0 commit comments

Comments
 (0)