Skip to content

Commit 1852d61

Browse files
feat(specs): add authentications to ingestion transformations (generated)
algolia/api-clients-automation#3494 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 7d71353 commit 1852d61

File tree

5 files changed

+89
-1
lines changed

5 files changed

+89
-1
lines changed

packages/ingestion/model/clientMethodProps.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type { TaskSortKeys } from './taskSortKeys';
2424
import type { TaskUpdate } from './taskUpdate';
2525
import type { TaskUpdateV1 } from './taskUpdateV1';
2626
import type { TransformationCreate } from './transformationCreate';
27+
import type { TransformationTry } from './transformationTry';
2728
import type { TriggerType } from './triggerType';
2829

2930
/**
@@ -608,6 +609,17 @@ export type TriggerDockerSourceDiscoverProps = {
608609
sourceID: string;
609610
};
610611

612+
/**
613+
* Properties for the `tryTransformationBeforeUpdate` method.
614+
*/
615+
export type TryTransformationBeforeUpdateProps = {
616+
/**
617+
* Unique identifier of a transformation.
618+
*/
619+
transformationID: string;
620+
transformationTry: TransformationTry;
621+
};
622+
611623
/**
612624
* Properties for the `updateAuthentication` method.
613625
*/

packages/ingestion/model/transformation.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ export type Transformation = {
66
*/
77
transformationID: string;
88

9+
/**
10+
* The authentications associated for the current transformation.
11+
*/
12+
authenticationIDs?: string[];
13+
914
/**
1015
* The source code of the transformation.
1116
*/

packages/ingestion/model/transformationCreate.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ export type TransformationCreate = {
1818
* A descriptive name for your transformation of what it does.
1919
*/
2020
description?: string;
21+
22+
/**
23+
* The authentications associated for the current transformation.
24+
*/
25+
authenticationIDs?: string[];
2126
};

packages/ingestion/model/transformationTry.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
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+
import type { AuthenticationCreate } from './authenticationCreate';
4+
35
export type TransformationTry = {
46
/**
57
* The source code of the transformation.
@@ -10,4 +12,6 @@ export type TransformationTry = {
1012
* The record to apply the given code to.
1113
*/
1214
sampleRecord: Record<string, any>;
15+
16+
authentications?: AuthenticationCreate[];
1317
};

packages/ingestion/src/ingestionClient.ts

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import type {
5555
RunTaskProps,
5656
RunTaskV1Props,
5757
TriggerDockerSourceDiscoverProps,
58+
TryTransformationBeforeUpdateProps,
5859
UpdateAuthenticationProps,
5960
UpdateDestinationProps,
6061
UpdateSourceProps,
@@ -2455,7 +2456,7 @@ export function createIngestionClient({
24552456
},
24562457

24572458
/**
2458-
* Try a transformation.
2459+
* Try a transformation before creating it.
24592460
*
24602461
* Required API Key ACLs:
24612462
* - addObject
@@ -2501,6 +2502,67 @@ export function createIngestionClient({
25012502
return transporter.request(request, requestOptions);
25022503
},
25032504

2505+
/**
2506+
* Try a transformation before updating it.
2507+
*
2508+
* Required API Key ACLs:
2509+
* - addObject
2510+
* - deleteIndex
2511+
* - editSettings.
2512+
*
2513+
* @param tryTransformationBeforeUpdate - The tryTransformationBeforeUpdate object.
2514+
* @param tryTransformationBeforeUpdate.transformationID - Unique identifier of a transformation.
2515+
* @param tryTransformationBeforeUpdate.transformationTry - The transformationTry object.
2516+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2517+
*/
2518+
tryTransformationBeforeUpdate(
2519+
{
2520+
transformationID,
2521+
transformationTry,
2522+
}: TryTransformationBeforeUpdateProps,
2523+
requestOptions?: RequestOptions
2524+
): Promise<TransformationTryResponse> {
2525+
if (!transformationID) {
2526+
throw new Error(
2527+
'Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.'
2528+
);
2529+
}
2530+
2531+
if (!transformationTry) {
2532+
throw new Error(
2533+
'Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.'
2534+
);
2535+
}
2536+
2537+
if (!transformationTry.code) {
2538+
throw new Error(
2539+
'Parameter `transformationTry.code` is required when calling `tryTransformationBeforeUpdate`.'
2540+
);
2541+
}
2542+
if (!transformationTry.sampleRecord) {
2543+
throw new Error(
2544+
'Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`.'
2545+
);
2546+
}
2547+
2548+
const requestPath = '/1/transformations/{transformationID}/try'.replace(
2549+
'{transformationID}',
2550+
encodeURIComponent(transformationID)
2551+
);
2552+
const headers: Headers = {};
2553+
const queryParameters: QueryParameters = {};
2554+
2555+
const request: Request = {
2556+
method: 'POST',
2557+
path: requestPath,
2558+
queryParameters,
2559+
headers,
2560+
data: transformationTry,
2561+
};
2562+
2563+
return transporter.request(request, requestOptions);
2564+
},
2565+
25042566
/**
25052567
* Updates an authentication resource.
25062568
*

0 commit comments

Comments
 (0)