Skip to content

Commit eb38f1b

Browse files
algolia-botmillotp
andcommitted
feat(specs): add runSource endpoint (generated)
algolia/api-clients-automation#3453 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 6803e83 commit eb38f1b

File tree

6 files changed

+102
-0
lines changed

6 files changed

+102
-0
lines changed

packages/ingestion/model/clientMethodProps.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type { EventType } from './eventType';
1414
import type { OrderKeys } from './orderKeys';
1515
import type { PlatformWithNone } from './platformWithNone';
1616
import type { RunSortKeys } from './runSortKeys';
17+
import type { RunSourcePayload } from './runSourcePayload';
1718
import type { RunStatus } from './runStatus';
1819
import type { SortKeys } from './sortKeys';
1920
import type { SourceSortKeys } from './sourceSortKeys';
@@ -555,6 +556,20 @@ export type PushTaskProps = {
555556
batchWriteParams: BatchWriteParams;
556557
};
557558

559+
/**
560+
* Properties for the `runSource` method.
561+
*/
562+
export type RunSourceProps = {
563+
/**
564+
* Unique identifier of a source.
565+
*/
566+
sourceID: string;
567+
/**
568+
*
569+
*/
570+
runSourcePayload?: RunSourcePayload;
571+
};
572+
558573
/**
559574
* Properties for the `runTask` method.
560575
*/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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 entity to update.
5+
*/
6+
export type EntityType = 'collection' | 'product';

packages/ingestion/model/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export * from './destinationUpdateResponse';
4545
export * from './dockerImageType';
4646
export * from './dockerRegistry';
4747
export * from './dockerStreamsInput';
48+
export * from './entityType';
4849
export * from './errorBase';
4950
export * from './event';
5051
export * from './eventSortKeys';
@@ -79,6 +80,8 @@ export * from './runProgress';
7980
export * from './runReasonCode';
8081
export * from './runResponse';
8182
export * from './runSortKeys';
83+
export * from './runSourcePayload';
84+
export * from './runSourceResponse';
8285
export * from './runStatus';
8386
export * from './runType';
8487
export * from './scheduleTrigger';
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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 { EntityType } from './entityType';
4+
5+
export type RunSourcePayload = {
6+
/**
7+
* List of index names to include in reidexing/update.
8+
*/
9+
indexToInclude?: string[];
10+
11+
/**
12+
* List of index names to exclude in reidexing/update.
13+
*/
14+
indexToExclude?: string[];
15+
16+
/**
17+
* List of entityID to update.
18+
*/
19+
entityIDs?: string[];
20+
21+
entityType?: EntityType;
22+
};
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+
export type RunSourceResponse = {
4+
/**
5+
* Map of taskID sent for reindex with the corresponding runID.
6+
*/
7+
taskWithRunID: Record<string, string>;
8+
9+
/**
10+
* Date of creation in RFC 3339 format.
11+
*/
12+
createdAt: string;
13+
};

packages/ingestion/src/ingestionClient.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import type {
5151
ListTasksV1Props,
5252
ListTransformationsProps,
5353
PushTaskProps,
54+
RunSourceProps,
5455
RunTaskProps,
5556
RunTaskV1Props,
5657
TriggerDockerSourceDiscoverProps,
@@ -80,6 +81,7 @@ import type { OnDemandTrigger } from '../model/onDemandTrigger';
8081
import type { Run } from '../model/run';
8182
import type { RunListResponse } from '../model/runListResponse';
8283
import type { RunResponse } from '../model/runResponse';
84+
import type { RunSourceResponse } from '../model/runSourceResponse';
8385
import type { ScheduleTrigger } from '../model/scheduleTrigger';
8486
import type { Source } from '../model/source';
8587
import type { SourceCreate } from '../model/sourceCreate';
@@ -1961,6 +1963,47 @@ export function createIngestionClient({
19611963
return transporter.request(request, requestOptions);
19621964
},
19631965

1966+
/**
1967+
* Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task.
1968+
*
1969+
* Required API Key ACLs:
1970+
* - addObject
1971+
* - deleteIndex
1972+
* - editSettings.
1973+
*
1974+
* @param runSource - The runSource object.
1975+
* @param runSource.sourceID - Unique identifier of a source.
1976+
* @param runSource.runSourcePayload -.
1977+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1978+
*/
1979+
runSource(
1980+
{ sourceID, runSourcePayload }: RunSourceProps,
1981+
requestOptions?: RequestOptions
1982+
): Promise<RunSourceResponse> {
1983+
if (!sourceID) {
1984+
throw new Error(
1985+
'Parameter `sourceID` is required when calling `runSource`.'
1986+
);
1987+
}
1988+
1989+
const requestPath = '/1/sources/{sourceID}/run'.replace(
1990+
'{sourceID}',
1991+
encodeURIComponent(sourceID)
1992+
);
1993+
const headers: Headers = {};
1994+
const queryParameters: QueryParameters = {};
1995+
1996+
const request: Request = {
1997+
method: 'POST',
1998+
path: requestPath,
1999+
queryParameters,
2000+
headers,
2001+
data: runSourcePayload ? runSourcePayload : {},
2002+
};
2003+
2004+
return transporter.request(request, requestOptions);
2005+
},
2006+
19642007
/**
19652008
* Runs a task. You can check the status of task runs with the observability endpoints.
19662009
*

0 commit comments

Comments
 (0)