From 1852d613379ede266693bea027cb881645bd94ee Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Thu, 8 Aug 2024 10:42:21 +0000 Subject: [PATCH] feat(specs): add authentications to ingestion transformations (generated) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/algolia/api-clients-automation/pull/3494 Co-authored-by: algolia-bot Co-authored-by: Clément Vannicatte --- packages/ingestion/model/clientMethodProps.ts | 12 ++++ packages/ingestion/model/transformation.ts | 5 ++ .../ingestion/model/transformationCreate.ts | 5 ++ packages/ingestion/model/transformationTry.ts | 4 ++ packages/ingestion/src/ingestionClient.ts | 64 ++++++++++++++++++- 5 files changed, 89 insertions(+), 1 deletion(-) diff --git a/packages/ingestion/model/clientMethodProps.ts b/packages/ingestion/model/clientMethodProps.ts index 019f5c597..af5d84716 100644 --- a/packages/ingestion/model/clientMethodProps.ts +++ b/packages/ingestion/model/clientMethodProps.ts @@ -24,6 +24,7 @@ import type { TaskSortKeys } from './taskSortKeys'; import type { TaskUpdate } from './taskUpdate'; import type { TaskUpdateV1 } from './taskUpdateV1'; import type { TransformationCreate } from './transformationCreate'; +import type { TransformationTry } from './transformationTry'; import type { TriggerType } from './triggerType'; /** @@ -608,6 +609,17 @@ export type TriggerDockerSourceDiscoverProps = { sourceID: string; }; +/** + * Properties for the `tryTransformationBeforeUpdate` method. + */ +export type TryTransformationBeforeUpdateProps = { + /** + * Unique identifier of a transformation. + */ + transformationID: string; + transformationTry: TransformationTry; +}; + /** * Properties for the `updateAuthentication` method. */ diff --git a/packages/ingestion/model/transformation.ts b/packages/ingestion/model/transformation.ts index 68d4af8b0..10b3df76e 100644 --- a/packages/ingestion/model/transformation.ts +++ b/packages/ingestion/model/transformation.ts @@ -6,6 +6,11 @@ export type Transformation = { */ transformationID: string; + /** + * The authentications associated for the current transformation. + */ + authenticationIDs?: string[]; + /** * The source code of the transformation. */ diff --git a/packages/ingestion/model/transformationCreate.ts b/packages/ingestion/model/transformationCreate.ts index 0753e5144..09f42eb48 100644 --- a/packages/ingestion/model/transformationCreate.ts +++ b/packages/ingestion/model/transformationCreate.ts @@ -18,4 +18,9 @@ export type TransformationCreate = { * A descriptive name for your transformation of what it does. */ description?: string; + + /** + * The authentications associated for the current transformation. + */ + authenticationIDs?: string[]; }; diff --git a/packages/ingestion/model/transformationTry.ts b/packages/ingestion/model/transformationTry.ts index 668bfc963..40d74d097 100644 --- a/packages/ingestion/model/transformationTry.ts +++ b/packages/ingestion/model/transformationTry.ts @@ -1,5 +1,7 @@ // 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 { AuthenticationCreate } from './authenticationCreate'; + export type TransformationTry = { /** * The source code of the transformation. @@ -10,4 +12,6 @@ export type TransformationTry = { * The record to apply the given code to. */ sampleRecord: Record; + + authentications?: AuthenticationCreate[]; }; diff --git a/packages/ingestion/src/ingestionClient.ts b/packages/ingestion/src/ingestionClient.ts index 8c01b2b57..8b230802b 100644 --- a/packages/ingestion/src/ingestionClient.ts +++ b/packages/ingestion/src/ingestionClient.ts @@ -55,6 +55,7 @@ import type { RunTaskProps, RunTaskV1Props, TriggerDockerSourceDiscoverProps, + TryTransformationBeforeUpdateProps, UpdateAuthenticationProps, UpdateDestinationProps, UpdateSourceProps, @@ -2455,7 +2456,7 @@ export function createIngestionClient({ }, /** - * Try a transformation. + * Try a transformation before creating it. * * Required API Key ACLs: * - addObject @@ -2501,6 +2502,67 @@ export function createIngestionClient({ return transporter.request(request, requestOptions); }, + /** + * Try a transformation before updating it. + * + * Required API Key ACLs: + * - addObject + * - deleteIndex + * - editSettings. + * + * @param tryTransformationBeforeUpdate - The tryTransformationBeforeUpdate object. + * @param tryTransformationBeforeUpdate.transformationID - Unique identifier of a transformation. + * @param tryTransformationBeforeUpdate.transformationTry - The transformationTry object. + * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions. + */ + tryTransformationBeforeUpdate( + { + transformationID, + transformationTry, + }: TryTransformationBeforeUpdateProps, + requestOptions?: RequestOptions + ): Promise { + if (!transformationID) { + throw new Error( + 'Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.' + ); + } + + if (!transformationTry) { + throw new Error( + 'Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.' + ); + } + + if (!transformationTry.code) { + throw new Error( + 'Parameter `transformationTry.code` is required when calling `tryTransformationBeforeUpdate`.' + ); + } + if (!transformationTry.sampleRecord) { + throw new Error( + 'Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`.' + ); + } + + const requestPath = '/1/transformations/{transformationID}/try'.replace( + '{transformationID}', + encodeURIComponent(transformationID) + ); + const headers: Headers = {}; + const queryParameters: QueryParameters = {}; + + const request: Request = { + method: 'POST', + path: requestPath, + queryParameters, + headers, + data: transformationTry, + }; + + return transporter.request(request, requestOptions); + }, + /** * Updates an authentication resource. *