Skip to content

Commit a0ca699

Browse files
committed
feat(specs): add v2 endpoints for ingestion
1 parent b0fa5a9 commit a0ca699

36 files changed

+596
-103
lines changed

clients/algoliasearch-client-ruby/lib/algolia/error.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def initialize(message, errors = [])
1616
errors.last&.tap do |last_error|
1717
message += " Last error for #{last_error[:host]}: #{last_error[:error]}"
1818
end
19+
1920
super(message)
2021
@errors = errors
2122
end

clients/algoliasearch-client-ruby/lib/algolia/logger_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def self.create(debug_file = nil)
1111
begin
1212
file = File.new("debug.log", "a+")
1313
rescue Errno::EACCES, Errno::ENOENT => e
14-
puts "Failed to open debug.log: #{e.message}. Falling back to $stderr."
14+
puts("Failed to open debug.log: #{e.message}. Falling back to $stderr.")
1515
end
1616
end
1717

specs/ingestion/common/schemas/task.yml

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,48 @@
11
Task:
22
type: object
33
additionalProperties: false
4+
properties:
5+
taskID:
6+
$ref: './common.yml#/taskID'
7+
sourceID:
8+
$ref: './common.yml#/sourceID'
9+
destinationID:
10+
$ref: './common.yml#/destinationID'
11+
cron:
12+
$ref: '#/Cron'
13+
lastRun:
14+
$ref: '#/LastRun'
15+
nextRun:
16+
$ref: '#/NextRun'
17+
input:
18+
$ref: '#/TaskInput'
19+
enabled:
20+
type: boolean
21+
default: true
22+
description: Whether the task is enabled.
23+
failureThreshold:
24+
$ref: '#/failureThreshold'
25+
action:
26+
$ref: '#/ActionType'
27+
cursor:
28+
$ref: './common.yml#/cursor'
29+
createdAt:
30+
$ref: './common.yml#/createdAt'
31+
updatedAt:
32+
$ref: './common.yml#/updatedAt'
33+
required:
34+
- taskID
35+
- sourceID
36+
- destinationID
37+
- enabled
38+
- action
39+
- createdAt
40+
41+
TaskV1:
42+
type: object
43+
additionalProperties: false
44+
deprecated: true
45+
description: The V1 task object, please use methods and types that don't contain the V1 suffix.
446
properties:
547
taskID:
648
$ref: './common.yml#/taskID'
@@ -47,6 +89,34 @@ TaskCreate:
4789
type: object
4890
additionalProperties: false
4991
description: API request body for creating a task.
92+
properties:
93+
sourceID:
94+
$ref: './common.yml#/sourceID'
95+
destinationID:
96+
$ref: './common.yml#/destinationID'
97+
action:
98+
$ref: '#/ActionType'
99+
cron:
100+
$ref: '#/Cron'
101+
enabled:
102+
type: boolean
103+
description: Whether the task is enabled.
104+
failureThreshold:
105+
$ref: '#/failureThreshold'
106+
input:
107+
$ref: '#/TaskInput'
108+
cursor:
109+
$ref: './common.yml#/cursor'
110+
required:
111+
- sourceID
112+
- destinationID
113+
- action
114+
115+
TaskCreateV1:
116+
type: object
117+
additionalProperties: false
118+
deprecated: true
119+
description: API request body for creating a task using the V1 shape, please use methods and types that don't contain the V1 suffix.
50120
properties:
51121
sourceID:
52122
$ref: './common.yml#/sourceID'
@@ -95,6 +165,24 @@ TaskUpdate:
95165
type: object
96166
additionalProperties: false
97167
description: API request body for updating a task.
168+
properties:
169+
destinationID:
170+
$ref: './common.yml#/destinationID'
171+
cron:
172+
$ref: '#/Cron'
173+
input:
174+
$ref: '#/TaskInput'
175+
enabled:
176+
type: boolean
177+
description: Whether the task is enabled.
178+
failureThreshold:
179+
$ref: '#/failureThreshold'
180+
181+
TaskUpdateV1:
182+
type: object
183+
additionalProperties: false
184+
deprecated: true
185+
description: API request body for updating a task using the V1 shape, please use methods and types that don't contain the V1 suffix.
98186
properties:
99187
destinationID:
100188
$ref: './common.yml#/destinationID'
@@ -188,6 +276,10 @@ LastRun:
188276
description: The last time the scheduled task ran in RFC 3339 format.
189277
type: string
190278

279+
NextRun:
280+
description: The next scheduled run of the task in RFC 3339 format.
281+
type: string
282+
191283
Cron:
192284
type: string
193285
description: Cron expression for the task's schedule.
@@ -224,8 +316,7 @@ ScheduleTrigger:
224316
lastRun:
225317
$ref: '#/LastRun'
226318
nextRun:
227-
description: The next scheduled run of the task in RFC 3339 format.
228-
type: string
319+
$ref: '#/NextRun'
229320
required:
230321
- type
231322
- cron
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
put:
2+
tags:
3+
- tasks
4+
summary: Disable a task
5+
description: Disables a task using the v1 endpoint, please use `disableTask` instead.
6+
operationId: disableTaskV1
7+
deprecated: true
8+
x-acl:
9+
- addObject
10+
- deleteIndex
11+
- editSettings
12+
parameters:
13+
- $ref: '../../../common/parameters.yml#/pathTaskID'
14+
responses:
15+
'200':
16+
description: OK
17+
content:
18+
application/json:
19+
schema:
20+
$ref: '../../../common/schemas/task.yml#/TaskUpdateResponse'
21+
'400':
22+
$ref: '../../../../common/responses/BadRequest.yml'
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
put:
2+
tags:
3+
- tasks
4+
summary: Enable a task
5+
description: Enables a task using the v1 endpoint, please use `enableTask` instead.
6+
operationId: enableTaskV1
7+
x-acl:
8+
- addObject
9+
- deleteIndex
10+
- editSettings
11+
parameters:
12+
- $ref: '../../../common/parameters.yml#/pathTaskID'
13+
responses:
14+
'200':
15+
description: OK
16+
content:
17+
application/json:
18+
schema:
19+
$ref: '../../../common/schemas/task.yml#/TaskUpdateResponse'
20+
'400':
21+
$ref: '../../../../common/responses/BadRequest.yml'
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
post:
2+
tags:
3+
- tasks
4+
summary: Run a task
5+
description: Runs a task using the v1 endpoint, please use `runTask` instead. You can check the status of task runs with the observability endpoints.
6+
operationId: runTaskV1
7+
x-acl:
8+
- addObject
9+
- deleteIndex
10+
- editSettings
11+
parameters:
12+
- $ref: '../../../common/parameters.yml#/pathTaskID'
13+
responses:
14+
'200':
15+
description: OK
16+
content:
17+
application/json:
18+
schema:
19+
$ref: '../../../common/schemas/run.yml#/RunResponse'
20+
'400':
21+
$ref: '../../../../common/responses/BadRequest.yml'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
post:
2+
tags:
3+
- tasks
4+
summary: Search for tasks
5+
description: Searches for tasks using the v1 endpoint, please use `searchTasks` instead.
6+
operationId: searchTasksV1
7+
x-acl:
8+
- addObject
9+
- deleteIndex
10+
- editSettings
11+
requestBody:
12+
content:
13+
application/json:
14+
schema:
15+
$ref: '../../../common/schemas/task.yml#/TaskSearch'
16+
required: true
17+
responses:
18+
'200':
19+
description: OK
20+
content:
21+
application/json:
22+
schema:
23+
title: searchTasksResponse
24+
type: array
25+
items:
26+
$ref: '../../../common/schemas/task.yml#/TaskV1'
27+
'400':
28+
$ref: '../../../../common/responses/BadRequest.yml'
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
get:
2+
tags:
3+
- tasks
4+
summary: Retrieve a task
5+
description: Retrieves a task by its ID using the v1 endpoint, please use `getTask` instead.
6+
operationId: getTaskV1
7+
x-acl:
8+
- addObject
9+
- deleteIndex
10+
- editSettings
11+
parameters:
12+
- $ref: '../../../common/parameters.yml#/pathTaskID'
13+
responses:
14+
'200':
15+
description: OK
16+
content:
17+
application/json:
18+
schema:
19+
$ref: '../../../common/schemas/task.yml#/TaskV1'
20+
'400':
21+
$ref: '../../../../common/responses/BadRequest.yml'
22+
23+
patch:
24+
tags:
25+
- tasks
26+
summary: Update a task
27+
description: Updates a task by its ID using the v1 endpoint, please use `updateTask` instead.
28+
operationId: updateTaskV1
29+
parameters:
30+
- $ref: '../../../common/parameters.yml#/pathTaskID'
31+
requestBody:
32+
content:
33+
application/json:
34+
schema:
35+
$ref: '../../../common/schemas/task.yml#/TaskUpdateV1'
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+
delete:
48+
tags:
49+
- tasks
50+
summary: Delete a task
51+
description: Deletes a task by its ID using the v1 endpoint, please use `deleteTask` instead.
52+
operationId: deleteTaskV1
53+
parameters:
54+
- $ref: '../../../common/parameters.yml#/pathTaskID'
55+
responses:
56+
'200':
57+
description: OK
58+
content:
59+
application/json:
60+
schema:
61+
$ref: '../../../common/schemas/common.yml#/DeleteResponse'
62+
'400':
63+
$ref: '../../../../common/responses/BadRequest.yml'
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
get:
2+
tags:
3+
- tasks
4+
summary: List tasks
5+
description: Retrieves a list of tasks using the v1 endpoint, please use `getTasks` instead.
6+
operationId: getTasksV1
7+
x-acl:
8+
- addObject
9+
- deleteIndex
10+
- editSettings
11+
parameters:
12+
- $ref: '../../../common/parameters.yml#/itemsPerPage'
13+
- $ref: '../../../common/parameters.yml#/page'
14+
- $ref: '../../../common/taskParameters.yml#/action'
15+
- $ref: '../../../common/taskParameters.yml#/enabled'
16+
- $ref: '../../../common/taskParameters.yml#/sourceID'
17+
- $ref: '../../../common/taskParameters.yml#/destinationID'
18+
- $ref: '../../../common/taskParameters.yml#/triggerType'
19+
- $ref: '../../../common/taskParameters.yml#/sort'
20+
- $ref: '../../../common/parameters.yml#/order'
21+
responses:
22+
'200':
23+
description: OK
24+
content:
25+
application/json:
26+
schema:
27+
title: listTasksResponse
28+
type: object
29+
description: Configured tasks and pagination information.
30+
additionalProperties: false
31+
properties:
32+
tasks:
33+
type: array
34+
items:
35+
$ref: '../../../common/schemas/task.yml#/TaskV1'
36+
pagination:
37+
$ref: '../../../common/schemas/pagination.yml#/Pagination'
38+
required:
39+
- tasks
40+
- pagination
41+
'400':
42+
$ref: '../../../../common/responses/BadRequest.yml'
43+
44+
post:
45+
tags:
46+
- tasks
47+
summary: Create a task
48+
description: Creates a new task using the v1 endpoint, please use `createTask` instead.
49+
operationId: createTaskV1
50+
requestBody:
51+
description: Request body for creating a task.
52+
content:
53+
application/json:
54+
schema:
55+
$ref: '../../../common/schemas/task.yml#/TaskCreateV1'
56+
required: true
57+
responses:
58+
'200':
59+
description: OK
60+
content:
61+
application/json:
62+
schema:
63+
$ref: '../../../common/schemas/task.yml#/TaskCreateResponse'
64+
'400':
65+
$ref: '../../../../common/responses/BadRequest.yml'

specs/ingestion/paths/tasks/disableTask.yml renamed to specs/ingestion/paths/tasks/v2/disableTask.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ put:
99
- deleteIndex
1010
- editSettings
1111
parameters:
12-
- $ref: '../../common/parameters.yml#/pathTaskID'
12+
- $ref: '../../../common/parameters.yml#/pathTaskID'
1313
responses:
1414
'200':
1515
description: OK
1616
content:
1717
application/json:
1818
schema:
19-
$ref: '../../common/schemas/task.yml#/TaskUpdateResponse'
19+
$ref: '../../../common/schemas/task.yml#/TaskUpdateResponse'
2020
'400':
21-
$ref: '../../../common/responses/BadRequest.yml'
21+
$ref: '../../../../common/responses/BadRequest.yml'

0 commit comments

Comments
 (0)