Skip to content

Commit

Permalink
fix(specs): ingestion push task payload [skip-bc] (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3607

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Clément Vannicatte <[email protected]>
Co-authored-by: Pierre Millot <[email protected]>
  • Loading branch information
3 people committed Aug 29, 2024
1 parent f997468 commit 1aa736a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 23 deletions.
4 changes: 2 additions & 2 deletions packages/ingestion/model/clientMethodProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { ActionType } from './actionType';
import type { AuthenticationSortKeys } from './authenticationSortKeys';
import type { AuthenticationType } from './authenticationType';
import type { AuthenticationUpdate } from './authenticationUpdate';
import type { BatchWriteParams } from './batchWriteParams';
import type { DestinationSortKeys } from './destinationSortKeys';
import type { DestinationType } from './destinationType';
import type { DestinationUpdate } from './destinationUpdate';
Expand All @@ -13,6 +12,7 @@ import type { EventStatus } from './eventStatus';
import type { EventType } from './eventType';
import type { OrderKeys } from './orderKeys';
import type { PlatformWithNone } from './platformWithNone';
import type { PushTaskPayload } from './pushTaskPayload';
import type { RunSortKeys } from './runSortKeys';
import type { RunSourcePayload } from './runSourcePayload';
import type { RunStatus } from './runStatus';
Expand Down Expand Up @@ -567,7 +567,7 @@ export type PushTaskProps = {
/**
* Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
*/
batchWriteParams: BatchWriteParams;
pushTaskPayload: PushTaskPayload;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/ingestion/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export * from './authenticationSortKeys';
export * from './authenticationType';
export * from './authenticationUpdate';
export * from './authenticationUpdateResponse';
export * from './batchRequest';
export * from './batchWriteParams';
export * from './bigCommerceChannel';
export * from './bigCommerceMetafield';
export * from './bigQueryDataType';
Expand Down Expand Up @@ -76,6 +74,8 @@ export * from './pagination';
export * from './platform';
export * from './platformNone';
export * from './platformWithNone';
export * from './pushTaskPayload';
export * from './pushTaskRecords';
export * from './recordType';
export * from './run';
export * from './runListResponse';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// 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.

import type { Action } from './action';
import type { PushTaskRecords } from './pushTaskRecords';

export type BatchRequest = {
export type PushTaskPayload = {
action: Action;

/**
* Operation arguments (varies with specified `action`).
*/
body: Record<string, unknown>;
records: PushTaskRecords[];
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// 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.

import type { BatchRequest } from './batchRequest';

/**
* Batch parameters.
*/
export type BatchWriteParams = {
requests: BatchRequest[];
export type PushTaskRecords = Record<string, any> & {
/**
* Unique record identifier.
*/
objectID: string;
};
17 changes: 10 additions & 7 deletions packages/ingestion/src/ingestionClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1707,20 +1707,23 @@ export function createIngestionClient({
*
* @param pushTask - The pushTask object.
* @param pushTask.taskID - Unique identifier of a task.
* @param pushTask.batchWriteParams - Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
* @param pushTask.pushTaskPayload - Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
pushTask({ taskID, batchWriteParams }: PushTaskProps, requestOptions?: RequestOptions): Promise<RunResponse> {
pushTask({ taskID, pushTaskPayload }: PushTaskProps, requestOptions?: RequestOptions): Promise<RunResponse> {
if (!taskID) {
throw new Error('Parameter `taskID` is required when calling `pushTask`.');
}

if (!batchWriteParams) {
throw new Error('Parameter `batchWriteParams` is required when calling `pushTask`.');
if (!pushTaskPayload) {
throw new Error('Parameter `pushTaskPayload` is required when calling `pushTask`.');
}

if (!batchWriteParams.requests) {
throw new Error('Parameter `batchWriteParams.requests` is required when calling `pushTask`.');
if (!pushTaskPayload.action) {
throw new Error('Parameter `pushTaskPayload.action` is required when calling `pushTask`.');
}
if (!pushTaskPayload.records) {
throw new Error('Parameter `pushTaskPayload.records` is required when calling `pushTask`.');
}

const requestPath = '/2/tasks/{taskID}/push'.replace('{taskID}', encodeURIComponent(taskID));
Expand All @@ -1732,7 +1735,7 @@ export function createIngestionClient({
path: requestPath,
queryParameters,
headers,
data: batchWriteParams,
data: pushTaskPayload,
};

return transporter.request(request, requestOptions);
Expand Down

0 comments on commit 1aa736a

Please sign in to comment.