Skip to content

Commit 1f4a3a9

Browse files
authored
feat(specs): add put task endpoint to ingestion api (#5281)
1 parent 1ae0f1d commit 1f4a3a9

File tree

5 files changed

+176
-25
lines changed

5 files changed

+176
-25
lines changed

specs/ingestion/common/schemas/task.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,41 @@ TaskCreateResponse:
179179
- taskID
180180
- createdAt
181181

182-
TaskUpdate:
182+
TaskReplace:
183183
type: object
184184
additionalProperties: false
185185
description: API request body for updating a task.
186+
properties:
187+
destinationID:
188+
$ref: './common.yml#/destinationID'
189+
action:
190+
$ref: '#/ActionType'
191+
subscriptionAction:
192+
$ref: '#/ActionType'
193+
cron:
194+
$ref: '#/Cron'
195+
enabled:
196+
type: boolean
197+
description: Whether the task is enabled.
198+
failureThreshold:
199+
$ref: '#/failureThreshold'
200+
input:
201+
$ref: '#/TaskInput'
202+
cursor:
203+
$ref: './common.yml#/cursor'
204+
notifications:
205+
$ref: '#/Notifications'
206+
policies:
207+
$ref: '#/Policies'
208+
required:
209+
- destinationID
210+
- action
211+
212+
# TODO: rename TaskUpdate to TaskPartialUpdate next major
213+
TaskUpdate:
214+
type: object
215+
additionalProperties: false
216+
description: API request body for partially updating a task.
186217
properties:
187218
destinationID:
188219
$ref: './common.yml#/destinationID'
@@ -215,8 +246,7 @@ TaskUpdateV1:
215246
input:
216247
$ref: '#/TaskInput'
217248
enabled:
218-
type: boolean
219-
description: Whether the task is enabled.
249+
$ref: '#/Enabled'
220250
failureThreshold:
221251
$ref: '#/failureThreshold'
222252

@@ -309,6 +339,10 @@ Cron:
309339
description: Cron expression for the task's schedule.
310340
example: '* * 1 * *'
311341

342+
Enabled:
343+
type: boolean
344+
description: Whether the task is enabled.
345+
312346
ScheduleTriggerType:
313347
type: string
314348
description: Task runs on a schedule.

specs/ingestion/paths/tasks/v2/taskID.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,36 @@ get:
2020
'400':
2121
$ref: '../../../../common/responses/BadRequest.yml'
2222

23+
put:
24+
tags:
25+
- tasks
26+
summary: Fully updates a task
27+
description: Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields.
28+
operationId: replaceTask
29+
parameters:
30+
- $ref: '../../../common/parameters.yml#/pathTaskID'
31+
requestBody:
32+
content:
33+
application/json:
34+
schema:
35+
$ref: '../../../common/schemas/task.yml#/TaskReplace'
36+
required: true
37+
responses:
38+
'200':
39+
description: OK
40+
content:
41+
application/json:
42+
schema:
43+
$ref: '../../../common/schemas/task.yml#/TaskUpdateResponse'
44+
'400':
45+
$ref: '../../../../common/responses/BadRequest.yml'
46+
47+
# TODO: rename taskUpdate to taskPartialUpdate next major
2348
patch:
2449
tags:
2550
- tasks
26-
summary: Update a task
27-
description: Updates a task by its ID.
51+
summary: Partially updates a task
52+
description: Partially updates a task by its ID.
2853
operationId: updateTask
2954
parameters:
3055
- $ref: '../../../common/parameters.yml#/pathTaskID'

tests/CTS/requests/ingestion/createTask.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"testName": "task without cron",
44
"parameters": {
55
"sourceID": "search",
6-
"destinationID": "destinationName",
6+
"destinationID": "destinationID",
77
"action": "replace"
88
},
99
"request": {
1010
"path": "/2/tasks",
1111
"method": "POST",
1212
"body": {
1313
"sourceID": "search",
14-
"destinationID": "destinationName",
14+
"destinationID": "destinationID",
1515
"action": "replace"
1616
}
1717
}
@@ -20,7 +20,7 @@
2020
"testName": "task with cron",
2121
"parameters": {
2222
"sourceID": "search",
23-
"destinationID": "destinationName",
23+
"destinationID": "destinationID",
2424
"cron": "* * * * *",
2525
"action": "replace",
2626
"notifications": {
@@ -37,7 +37,7 @@
3737
"method": "POST",
3838
"body": {
3939
"sourceID": "search",
40-
"destinationID": "destinationName",
40+
"destinationID": "destinationID",
4141
"cron": "* * * * *",
4242
"action": "replace",
4343
"notifications": {
@@ -55,7 +55,7 @@
5555
"testName": "task shopify",
5656
"parameters": {
5757
"sourceID": "search",
58-
"destinationID": "destinationName",
58+
"destinationID": "destinationID",
5959
"cron": "* * * * *",
6060
"action": "replace",
6161
"input": {
@@ -72,7 +72,7 @@
7272
"method": "POST",
7373
"body": {
7474
"sourceID": "search",
75-
"destinationID": "destinationName",
75+
"destinationID": "destinationID",
7676
"cron": "* * * * *",
7777
"action": "replace",
7878
"input": {
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
[
2+
{
3+
"testName": "fully replace task without cron",
4+
"parameters": {
5+
"taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
6+
"taskReplace": {
7+
"destinationID": "destinationID",
8+
"action": "replace"
9+
}
10+
},
11+
"request": {
12+
"path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f",
13+
"method": "PUT",
14+
"body": {
15+
"destinationID": "destinationID",
16+
"action": "replace"
17+
}
18+
}
19+
},
20+
{
21+
"testName": "fully replace task with cron",
22+
"parameters": {
23+
"taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
24+
"taskReplace": {
25+
"destinationID": "destinationID",
26+
"cron": "* * * * *",
27+
"action": "replace",
28+
"notifications": {
29+
"email": {
30+
"enabled": true
31+
}
32+
},
33+
"policies": {
34+
"criticalThreshold": 8
35+
}
36+
}
37+
},
38+
"request": {
39+
"path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f",
40+
"method": "PUT",
41+
"body": {
42+
"destinationID": "destinationID",
43+
"cron": "* * * * *",
44+
"action": "replace",
45+
"notifications": {
46+
"email": {
47+
"enabled": true
48+
}
49+
},
50+
"policies": {
51+
"criticalThreshold": 8
52+
}
53+
}
54+
}
55+
},
56+
{
57+
"testName": "fully replace task shopify",
58+
"parameters": {
59+
"taskID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
60+
"taskReplace": {
61+
"destinationID": "destinationID",
62+
"cron": "* * * * *",
63+
"action": "replace",
64+
"input": {
65+
"streams": [
66+
{
67+
"name": "foo",
68+
"syncMode": "incremental"
69+
}
70+
]
71+
}
72+
}
73+
},
74+
"request": {
75+
"path": "/2/tasks/6c02aeb1-775e-418e-870b-1faccd4b2c0f",
76+
"method": "PUT",
77+
"body": {
78+
"destinationID": "destinationID",
79+
"cron": "* * * * *",
80+
"action": "replace",
81+
"input": {
82+
"streams": [
83+
{
84+
"name": "foo",
85+
"syncMode": "incremental"
86+
}
87+
]
88+
}
89+
}
90+
}
91+
}
92+
]

tests/output/javascript/yarn.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -427,12 +427,12 @@ __metadata:
427427
languageName: node
428428
linkType: hard
429429

430-
"@types/node@npm:22.16.5":
431-
version: 22.16.5
432-
resolution: "@types/node@npm:22.16.5"
430+
"@types/node@npm:22.18.0":
431+
version: 22.18.0
432+
resolution: "@types/node@npm:22.18.0"
433433
dependencies:
434434
undici-types: "npm:~6.21.0"
435-
checksum: 10/ba45b5c9113cbc5edb12960fcfe7e80db2c998af5c1931264240695b27d756570d92462150b95781bd67a03aa82111cc970ab0f4504eb99213edff8bf425354e
435+
checksum: 10/c4e4cdac52aae71e120fb4a02a08f774366e8bd6654de9376fb1113fb66cfa2706176b72f188069cdecdb40e5cdde2befa031dc720a0cc0b1e349af9e38492ad
436436
languageName: node
437437
linkType: hard
438438

@@ -1022,9 +1022,9 @@ __metadata:
10221022
"@algolia/client-composition": "link:../../../clients/algoliasearch-client-javascript/packages/client-composition"
10231023
"@algolia/composition": "link:../../../clients/algoliasearch-client-javascript/packages/composition"
10241024
"@algolia/requester-testing": "link:../../../clients/algoliasearch-client-javascript/packages/requester-testing"
1025-
"@types/node": "npm:22.16.5"
1025+
"@types/node": "npm:22.18.0"
10261026
algoliasearch: "link:../../../clients/algoliasearch-client-javascript/packages/algoliasearch"
1027-
typescript: "npm:5.8.3"
1027+
typescript: "npm:5.9.2"
10281028
vitest: "npm:3.2.4"
10291029
languageName: unknown
10301030
linkType: soft
@@ -1621,23 +1621,23 @@ __metadata:
16211621
languageName: node
16221622
linkType: hard
16231623

1624-
"typescript@npm:5.8.3":
1625-
version: 5.8.3
1626-
resolution: "typescript@npm:5.8.3"
1624+
"typescript@npm:5.9.2":
1625+
version: 5.9.2
1626+
resolution: "typescript@npm:5.9.2"
16271627
bin:
16281628
tsc: bin/tsc
16291629
tsserver: bin/tsserver
1630-
checksum: 10/65c40944c51b513b0172c6710ee62e951b70af6f75d5a5da745cb7fab132c09ae27ffdf7838996e3ed603bb015dadd099006658046941bd0ba30340cc563ae92
1630+
checksum: 10/cc2fe6c822819de5d453fa25aa9f32096bf70dde215d481faa1ad84a283dfb264e33988ed8f6d36bc803dd0b16dbe943efa311a798ef76d5b3892a05dfbfd628
16311631
languageName: node
16321632
linkType: hard
16331633

1634-
"typescript@patch:typescript@npm%3A5.8.3#optional!builtin<compat/typescript>":
1635-
version: 5.8.3
1636-
resolution: "typescript@patch:typescript@npm%3A5.8.3#optional!builtin<compat/typescript>::version=5.8.3&hash=5786d5"
1634+
"typescript@patch:typescript@npm%3A5.9.2#optional!builtin<compat/typescript>":
1635+
version: 5.9.2
1636+
resolution: "typescript@patch:typescript@npm%3A5.9.2#optional!builtin<compat/typescript>::version=5.9.2&hash=5786d5"
16371637
bin:
16381638
tsc: bin/tsc
16391639
tsserver: bin/tsserver
1640-
checksum: 10/b9b1e73dabac5dc730c041325dbd9c99467c1b0d239f1b74ec3b90d831384af3e2ba973946232df670519147eb51a2c20f6f96163cea2b359f03de1e2091cc4f
1640+
checksum: 10/bd810ab13e8e557225a8b5122370385440b933e4e077d5c7641a8afd207fdc8be9c346e3c678adba934b64e0e70b0acf5eef9493ea05170a48ce22bef845fdc7
16411641
languageName: node
16421642
linkType: hard
16431643

0 commit comments

Comments
 (0)