Skip to content

Commit 9a6dfc7

Browse files
feat(specs): add v2 endpoints for ingestion
algolia/api-clients-automation#3416 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 2c55b66 commit 9a6dfc7

File tree

6 files changed

+107
-0
lines changed

6 files changed

+107
-0
lines changed

packages/ingestion/model/action.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
2+
3+
/**
4+
* Type of indexing operation.
5+
*/
6+
export type Action =
7+
| 'addObject'
8+
| 'clear'
9+
| 'delete'
10+
| 'deleteObject'
11+
| 'partialUpdateObject'
12+
| 'partialUpdateObjectNoCreate'
13+
| 'updateObject';
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
2+
3+
import type { Action } from './action';
4+
5+
export type BatchRequest = {
6+
action: Action;
7+
8+
/**
9+
* Operation arguments (varies with specified `action`).
10+
*/
11+
body: Record<string, any>;
12+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
2+
3+
import type { BatchRequest } from './batchRequest';
4+
5+
/**
6+
* Batch parameters.
7+
*/
8+
export type BatchWriteParams = {
9+
requests: BatchRequest[];
10+
};

packages/ingestion/model/clientMethodProps.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { ActionType } from './actionType';
44
import type { AuthenticationSortKeys } from './authenticationSortKeys';
55
import type { AuthenticationType } from './authenticationType';
66
import type { AuthenticationUpdate } from './authenticationUpdate';
7+
import type { BatchWriteParams } from './batchWriteParams';
78
import type { DestinationSortKeys } from './destinationSortKeys';
89
import type { DestinationType } from './destinationType';
910
import type { DestinationUpdate } from './destinationUpdate';
@@ -540,6 +541,20 @@ export type ListTransformationsProps = {
540541
order?: OrderKeys;
541542
};
542543

544+
/**
545+
* Properties for the `pushTask` method.
546+
*/
547+
export type PushTaskProps = {
548+
/**
549+
* Unique identifier of a task.
550+
*/
551+
taskID: string;
552+
/**
553+
* Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
554+
*/
555+
batchWriteParams: BatchWriteParams;
556+
};
557+
543558
/**
544559
* Properties for the `runTask` method.
545560
*/

packages/ingestion/model/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
22

3+
export * from './action';
34
export * from './actionType';
45
export * from './authAPIKey';
56
export * from './authAPIKeyPartial';
@@ -23,6 +24,8 @@ export * from './authenticationSortKeys';
2324
export * from './authenticationType';
2425
export * from './authenticationUpdate';
2526
export * from './authenticationUpdateResponse';
27+
export * from './batchRequest';
28+
export * from './batchWriteParams';
2629
export * from './bigCommerceChannel';
2730
export * from './bigCommerceMetafield';
2831
export * from './bigQueryDataType';

packages/ingestion/src/ingestionClient.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import type {
5050
ListTasksProps,
5151
ListTasksV1Props,
5252
ListTransformationsProps,
53+
PushTaskProps,
5354
RunTaskProps,
5455
RunTaskV1Props,
5556
TriggerDockerSourceDiscoverProps,
@@ -1907,6 +1908,59 @@ export function createIngestionClient({
19071908
return transporter.request(request, requestOptions);
19081909
},
19091910

1911+
/**
1912+
* Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints.
1913+
*
1914+
* Required API Key ACLs:
1915+
* - addObject
1916+
* - deleteIndex
1917+
* - editSettings.
1918+
*
1919+
* @param pushTask - The pushTask object.
1920+
* @param pushTask.taskID - Unique identifier of a task.
1921+
* @param pushTask.batchWriteParams - Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
1922+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1923+
*/
1924+
pushTask(
1925+
{ taskID, batchWriteParams }: PushTaskProps,
1926+
requestOptions?: RequestOptions
1927+
): Promise<RunResponse> {
1928+
if (!taskID) {
1929+
throw new Error(
1930+
'Parameter `taskID` is required when calling `pushTask`.'
1931+
);
1932+
}
1933+
1934+
if (!batchWriteParams) {
1935+
throw new Error(
1936+
'Parameter `batchWriteParams` is required when calling `pushTask`.'
1937+
);
1938+
}
1939+
1940+
if (!batchWriteParams.requests) {
1941+
throw new Error(
1942+
'Parameter `batchWriteParams.requests` is required when calling `pushTask`.'
1943+
);
1944+
}
1945+
1946+
const requestPath = '/2/tasks/{taskID}/push'.replace(
1947+
'{taskID}',
1948+
encodeURIComponent(taskID)
1949+
);
1950+
const headers: Headers = {};
1951+
const queryParameters: QueryParameters = {};
1952+
1953+
const request: Request = {
1954+
method: 'POST',
1955+
path: requestPath,
1956+
queryParameters,
1957+
headers,
1958+
data: batchWriteParams,
1959+
};
1960+
1961+
return transporter.request(request, requestOptions);
1962+
},
1963+
19101964
/**
19111965
* Runs a task. You can check the status of task runs with the observability endpoints.
19121966
*

0 commit comments

Comments
 (0)