Skip to content

Commit aa340dc

Browse files
authored
feat(specs): add put and delete API for compositions and rules (#5282)
1 parent 9a29c26 commit aa340dc

File tree

6 files changed

+322
-0
lines changed

6 files changed

+322
-0
lines changed

specs/composition-full/paths/objects/objects.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,77 @@ get:
2525
$ref: '../../../common/responses/MethodNotAllowed.yml'
2626
'404':
2727
$ref: '../../../common/responses/CompositionNotFound.yml'
28+
29+
put:
30+
tags:
31+
- Compositions
32+
operationId: putComposition
33+
x-acl:
34+
- editSettings
35+
- settings
36+
summary: Upsert a composition
37+
description: |
38+
Upsert a composition in the current Algolia application.
39+
parameters:
40+
- $ref: '../urlParams.yml#/compositionID'
41+
requestBody:
42+
required: true
43+
content:
44+
application/json:
45+
schema:
46+
$ref: '../../common/schemas/components/Composition.yml#/composition'
47+
responses:
48+
'200':
49+
description: OK
50+
content:
51+
application/json:
52+
schema:
53+
title: taskIDResponse
54+
type: object
55+
additionalProperties: false
56+
properties:
57+
taskID:
58+
$ref: '../../../common/responses/common.yml#/taskID'
59+
required:
60+
- taskID
61+
'400':
62+
$ref: '../../../common/responses/BadRequest.yml'
63+
'402':
64+
$ref: '../../../common/responses/FeatureNotEnabled.yml'
65+
'403':
66+
$ref: '../../../common/responses/MethodNotAllowed.yml'
67+
'422':
68+
$ref: '../../../common/responses/UnprocessableEntity.yml'
69+
70+
delete:
71+
tags:
72+
- Compositions
73+
operationId: deleteComposition
74+
x-acl:
75+
- editSettings
76+
- settings
77+
summary: Delete a composition
78+
description: |
79+
Delete a composition from the current Algolia application.
80+
parameters:
81+
- $ref: '../urlParams.yml#/compositionID'
82+
responses:
83+
'200':
84+
description: OK
85+
content:
86+
application/json:
87+
schema:
88+
title: taskIDResponse
89+
type: object
90+
additionalProperties: false
91+
properties:
92+
taskID:
93+
$ref: '../../../common/responses/common.yml#/taskID'
94+
required:
95+
- taskID
96+
'400':
97+
$ref: '../../../common/responses/BadRequest.yml'
98+
'402':
99+
$ref: '../../../common/responses/FeatureNotEnabled.yml'
100+
'403':
101+
$ref: '../../../common/responses/MethodNotAllowed.yml'

specs/composition-full/paths/rules/rule.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,83 @@ get:
2727
$ref: '../../../common/responses/MethodNotAllowed.yml'
2828
'404':
2929
$ref: '../../../common/responses/IndexNotFound.yml'
30+
31+
put:
32+
tags:
33+
- Rules
34+
operationId: putCompositionRule
35+
x-acl:
36+
- editSettings
37+
- settings
38+
summary: Upsert a composition rule
39+
description: |
40+
Upsert a Composition Rule for the specified composition ID.
41+
parameters:
42+
- $ref: '../urlParams.yml#/compositionID'
43+
- $ref: './parameters.yml#/ObjectIDRule'
44+
requestBody:
45+
required: true
46+
content:
47+
application/json:
48+
schema:
49+
$ref: '../../common/schemas/components/CompositionRule.yml#/compositionRule'
50+
responses:
51+
'200':
52+
description: OK
53+
content:
54+
application/json:
55+
schema:
56+
title: taskIDResponse
57+
type: object
58+
additionalProperties: false
59+
properties:
60+
taskID:
61+
$ref: '../../../common/responses/common.yml#/taskID'
62+
required:
63+
- taskID
64+
'400':
65+
$ref: '../../../common/responses/BadRequest.yml'
66+
'402':
67+
$ref: '../../../common/responses/FeatureNotEnabled.yml'
68+
'403':
69+
$ref: '../../../common/responses/MethodNotAllowed.yml'
70+
'404':
71+
$ref: '../../../common/responses/CompositionNotFound.yml'
72+
'422':
73+
$ref: '../../../common/responses/UnprocessableEntity.yml'
74+
75+
delete:
76+
tags:
77+
- Rules
78+
operationId: deleteCompositionRule
79+
x-acl:
80+
- editSettings
81+
- settings
82+
summary: Delete a Composition Rule
83+
description: |
84+
Delete a Composition Rule from the specified Composition ID.
85+
parameters:
86+
- $ref: '../urlParams.yml#/compositionID'
87+
- $ref: './parameters.yml#/ObjectIDRule'
88+
responses:
89+
'200':
90+
description: OK
91+
content:
92+
application/json:
93+
schema:
94+
title: taskIDResponse
95+
type: object
96+
additionalProperties: false
97+
properties:
98+
taskID:
99+
$ref: '../../../common/responses/common.yml#/taskID'
100+
required:
101+
- taskID
102+
'400':
103+
$ref: '../../../common/responses/BadRequest.yml'
104+
'402':
105+
$ref: '../../../common/responses/FeatureNotEnabled.yml'
106+
'403':
107+
$ref: '../../../common/responses/MethodNotAllowed.yml'
108+
'404':
109+
$ref: '../../../common/responses/CompositionNotFound.yml'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[
2+
{
3+
"parameters": {
4+
"compositionID": "1234"
5+
},
6+
"request": {
7+
"path": "/1/compositions/1234",
8+
"method": "DELETE"
9+
}
10+
}
11+
]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
{
3+
"parameters": {
4+
"compositionID": "1234",
5+
"objectID": "5678"
6+
},
7+
"request": {
8+
"path": "/1/compositions/1234/rules/5678",
9+
"method": "DELETE"
10+
}
11+
}
12+
]
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
[
2+
{
3+
"parameters": {
4+
"compositionID": "1234",
5+
"composition": {
6+
"objectID": "1234",
7+
"name": "my first composition",
8+
"behavior": {
9+
"injection": {
10+
"main": {
11+
"source": {
12+
"search": {
13+
"index": "foo"
14+
}
15+
}
16+
},
17+
"injectedItems": [
18+
{
19+
"key": "injectedItem1",
20+
"source": {
21+
"search": {
22+
"index": "foo"
23+
}
24+
},
25+
"position": 2,
26+
"length": 1
27+
}
28+
]
29+
}
30+
}
31+
}
32+
},
33+
"request": {
34+
"path": "/1/compositions/1234",
35+
"method": "PUT",
36+
"body": {
37+
"objectID": "1234",
38+
"name": "my first composition",
39+
"behavior": {
40+
"injection": {
41+
"main": {
42+
"source": {
43+
"search": {
44+
"index": "foo"
45+
}
46+
}
47+
},
48+
"injectedItems": [
49+
{
50+
"key": "injectedItem1",
51+
"source": {
52+
"search": {
53+
"index": "foo"
54+
}
55+
},
56+
"position": 2,
57+
"length": 1
58+
}
59+
]
60+
}
61+
}
62+
}
63+
}
64+
}
65+
]
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
[
2+
{
3+
"parameters": {
4+
"compositionID": "1234",
5+
"objectID": "5678",
6+
"compositionRule": {
7+
"objectID": "5678",
8+
"conditions": [
9+
{
10+
"anchoring": "is",
11+
"pattern": "test"
12+
}
13+
],
14+
"consequence": {
15+
"behavior": {
16+
"injection": {
17+
"main": {
18+
"source": {
19+
"search": {
20+
"index": "foo"
21+
}
22+
}
23+
},
24+
"injectedItems": [
25+
{
26+
"key": "injectedItem1",
27+
"source": {
28+
"search": {
29+
"index": "foo"
30+
}
31+
},
32+
"position": 2,
33+
"length": 1
34+
}
35+
]
36+
}
37+
}
38+
}
39+
}
40+
},
41+
"request": {
42+
"path": "/1/compositions/1234/rules/5678",
43+
"method": "PUT",
44+
"body": {
45+
"objectID": "5678",
46+
"conditions": [
47+
{
48+
"anchoring": "is",
49+
"pattern": "test"
50+
}
51+
],
52+
"consequence": {
53+
"behavior": {
54+
"injection": {
55+
"main": {
56+
"source": {
57+
"search": {
58+
"index": "foo"
59+
}
60+
}
61+
},
62+
"injectedItems": [
63+
{
64+
"key": "injectedItem1",
65+
"source": {
66+
"search": {
67+
"index": "foo"
68+
}
69+
},
70+
"position": 2,
71+
"length": 1
72+
}
73+
]
74+
}
75+
}
76+
}
77+
}
78+
}
79+
}
80+
]

0 commit comments

Comments
 (0)