Skip to content

Commit

Permalink
feat(specs): add runSource endpoint (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3453

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
algolia-bot and millotp committed Aug 2, 2024
1 parent 6803e83 commit eb38f1b
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/ingestion/model/clientMethodProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type { EventType } from './eventType';
import type { OrderKeys } from './orderKeys';
import type { PlatformWithNone } from './platformWithNone';
import type { RunSortKeys } from './runSortKeys';
import type { RunSourcePayload } from './runSourcePayload';
import type { RunStatus } from './runStatus';
import type { SortKeys } from './sortKeys';
import type { SourceSortKeys } from './sourceSortKeys';
Expand Down Expand Up @@ -555,6 +556,20 @@ export type PushTaskProps = {
batchWriteParams: BatchWriteParams;
};

/**
* Properties for the `runSource` method.
*/
export type RunSourceProps = {
/**
* Unique identifier of a source.
*/
sourceID: string;
/**
*
*/
runSourcePayload?: RunSourcePayload;
};

/**
* Properties for the `runTask` method.
*/
Expand Down
6 changes: 6 additions & 0 deletions packages/ingestion/model/entityType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// 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.

/**
* Type of entity to update.
*/
export type EntityType = 'collection' | 'product';
3 changes: 3 additions & 0 deletions packages/ingestion/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export * from './destinationUpdateResponse';
export * from './dockerImageType';
export * from './dockerRegistry';
export * from './dockerStreamsInput';
export * from './entityType';
export * from './errorBase';
export * from './event';
export * from './eventSortKeys';
Expand Down Expand Up @@ -79,6 +80,8 @@ export * from './runProgress';
export * from './runReasonCode';
export * from './runResponse';
export * from './runSortKeys';
export * from './runSourcePayload';
export * from './runSourceResponse';
export * from './runStatus';
export * from './runType';
export * from './scheduleTrigger';
Expand Down
22 changes: 22 additions & 0 deletions packages/ingestion/model/runSourcePayload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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 { EntityType } from './entityType';

export type RunSourcePayload = {
/**
* List of index names to include in reidexing/update.
*/
indexToInclude?: string[];

/**
* List of index names to exclude in reidexing/update.
*/
indexToExclude?: string[];

/**
* List of entityID to update.
*/
entityIDs?: string[];

entityType?: EntityType;
};
13 changes: 13 additions & 0 deletions packages/ingestion/model/runSourceResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// 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.

export type RunSourceResponse = {
/**
* Map of taskID sent for reindex with the corresponding runID.
*/
taskWithRunID: Record<string, string>;

/**
* Date of creation in RFC 3339 format.
*/
createdAt: string;
};
43 changes: 43 additions & 0 deletions packages/ingestion/src/ingestionClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import type {
ListTasksV1Props,
ListTransformationsProps,
PushTaskProps,
RunSourceProps,
RunTaskProps,
RunTaskV1Props,
TriggerDockerSourceDiscoverProps,
Expand Down Expand Up @@ -80,6 +81,7 @@ import type { OnDemandTrigger } from '../model/onDemandTrigger';
import type { Run } from '../model/run';
import type { RunListResponse } from '../model/runListResponse';
import type { RunResponse } from '../model/runResponse';
import type { RunSourceResponse } from '../model/runSourceResponse';
import type { ScheduleTrigger } from '../model/scheduleTrigger';
import type { Source } from '../model/source';
import type { SourceCreate } from '../model/sourceCreate';
Expand Down Expand Up @@ -1961,6 +1963,47 @@ export function createIngestionClient({
return transporter.request(request, requestOptions);
},

/**
* Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task.
*
* Required API Key ACLs:
* - addObject
* - deleteIndex
* - editSettings.
*
* @param runSource - The runSource object.
* @param runSource.sourceID - Unique identifier of a source.
* @param runSource.runSourcePayload -.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
runSource(
{ sourceID, runSourcePayload }: RunSourceProps,
requestOptions?: RequestOptions
): Promise<RunSourceResponse> {
if (!sourceID) {
throw new Error(
'Parameter `sourceID` is required when calling `runSource`.'
);
}

const requestPath = '/1/sources/{sourceID}/run'.replace(
'{sourceID}',
encodeURIComponent(sourceID)
);
const headers: Headers = {};
const queryParameters: QueryParameters = {};

const request: Request = {
method: 'POST',
path: requestPath,
queryParameters,
headers,
data: runSourcePayload ? runSourcePayload : {},
};

return transporter.request(request, requestOptions);
},

/**
* Runs a task. You can check the status of task runs with the observability endpoints.
*
Expand Down

0 comments on commit eb38f1b

Please sign in to comment.