diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Clients/IngestionClient.cs b/clients/algoliasearch-client-csharp/algoliasearch/Clients/IngestionClient.cs
index 918c3e350b..53226ffb58 100644
--- a/clients/algoliasearch-client-csharp/algoliasearch/Clients/IngestionClient.cs
+++ b/clients/algoliasearch-client-csharp/algoliasearch/Clients/IngestionClient.cs
@@ -1007,6 +1007,56 @@ public interface IIngestionClient
/// TaskUpdateResponse
TaskUpdateResponse UpdateTask(string taskID, TaskUpdate taskUpdate, RequestOptions options = null, CancellationToken cancellationToken = default);
+ ///
+ /// Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ ///
+ /// (optional)
+ /// Add extra http header or query parameters to Algolia.
+ /// Cancellation Token to cancel the request.
+ /// Thrown when arguments are not correct
+ /// Thrown when the API call was rejected by Algolia
+ /// Thrown when the client failed to call the endpoint
+ /// Task of SourceValidateResponse
+ Task ValidateSourceAsync(SourceCreate sourceCreate = default, RequestOptions options = null, CancellationToken cancellationToken = default);
+
+ ///
+ /// Validates a source payload to ensure it can be created and that the data source can be reached by Algolia. (Synchronous version)
+ ///
+ /// (optional)
+ /// Add extra http header or query parameters to Algolia.
+ /// Cancellation Token to cancel the request.
+ /// Thrown when arguments are not correct
+ /// Thrown when the API call was rejected by Algolia
+ /// Thrown when the client failed to call the endpoint
+ /// SourceValidateResponse
+ SourceValidateResponse ValidateSource(SourceCreate sourceCreate = default, RequestOptions options = null, CancellationToken cancellationToken = default);
+
+ ///
+ /// Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ ///
+ /// Unique identifier of a source.
+ ///
+ /// Add extra http header or query parameters to Algolia.
+ /// Cancellation Token to cancel the request.
+ /// Thrown when arguments are not correct
+ /// Thrown when the API call was rejected by Algolia
+ /// Thrown when the client failed to call the endpoint
+ /// Task of SourceValidateResponse
+ Task ValidateSourceBeforeUpdateAsync(string sourceID, SourceUpdate sourceUpdate, RequestOptions options = null, CancellationToken cancellationToken = default);
+
+ ///
+ /// Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia. (Synchronous version)
+ ///
+ /// Unique identifier of a source.
+ ///
+ /// Add extra http header or query parameters to Algolia.
+ /// Cancellation Token to cancel the request.
+ /// Thrown when arguments are not correct
+ /// Thrown when the API call was rejected by Algolia
+ /// Thrown when the client failed to call the endpoint
+ /// SourceValidateResponse
+ SourceValidateResponse ValidateSourceBeforeUpdate(string sourceID, SourceUpdate sourceUpdate, RequestOptions options = null, CancellationToken cancellationToken = default);
+
}
@@ -2923,5 +2973,104 @@ public async Task UpdateTaskAsync(string taskID, TaskUpdate
public TaskUpdateResponse UpdateTask(string taskID, TaskUpdate taskUpdate, RequestOptions options = null, CancellationToken cancellationToken = default) =>
AsyncHelper.RunSync(() => UpdateTaskAsync(taskID, taskUpdate, options, cancellationToken));
+
+ ///
+ /// Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ ///
+ ///
+ /// Required API Key ACLs:
+ /// - addObject
+ /// - deleteIndex
+ /// - editSettings
+ /// (optional)
+ /// Add extra http header or query parameters to Algolia.
+ /// Cancellation Token to cancel the request.
+ /// Thrown when arguments are not correct
+ /// Thrown when the API call was rejected by Algolia
+ /// Thrown when the client failed to call the endpoint
+ /// Task of SourceValidateResponse
+ public async Task ValidateSourceAsync(SourceCreate sourceCreate = default, RequestOptions options = null, CancellationToken cancellationToken = default)
+ {
+ var requestOptions = new InternalRequestOptions(options);
+
+
+ requestOptions.Data = sourceCreate;
+ return await _transport.ExecuteRequestAsync(new HttpMethod("POST"), "/1/sources/validate", requestOptions, cancellationToken).ConfigureAwait(false);
+ }
+
+
+ ///
+ /// Validates a source payload to ensure it can be created and that the data source can be reached by Algolia. (Synchronous version)
+ ///
+ ///
+ /// Required API Key ACLs:
+ /// - addObject
+ /// - deleteIndex
+ /// - editSettings
+ /// (optional)
+ /// Add extra http header or query parameters to Algolia.
+ /// Cancellation Token to cancel the request.
+ /// Thrown when arguments are not correct
+ /// Thrown when the API call was rejected by Algolia
+ /// Thrown when the client failed to call the endpoint
+ /// SourceValidateResponse
+ public SourceValidateResponse ValidateSource(SourceCreate sourceCreate = default, RequestOptions options = null, CancellationToken cancellationToken = default) =>
+ AsyncHelper.RunSync(() => ValidateSourceAsync(sourceCreate, options, cancellationToken));
+
+
+ ///
+ /// Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ ///
+ ///
+ /// Required API Key ACLs:
+ /// - addObject
+ /// - deleteIndex
+ /// - editSettings
+ /// Unique identifier of a source.
+ ///
+ /// Add extra http header or query parameters to Algolia.
+ /// Cancellation Token to cancel the request.
+ /// Thrown when arguments are not correct
+ /// Thrown when the API call was rejected by Algolia
+ /// Thrown when the client failed to call the endpoint
+ /// Task of SourceValidateResponse
+ public async Task ValidateSourceBeforeUpdateAsync(string sourceID, SourceUpdate sourceUpdate, RequestOptions options = null, CancellationToken cancellationToken = default)
+ {
+
+ if (sourceID == null)
+ throw new ArgumentException("Parameter `sourceID` is required when calling `ValidateSourceBeforeUpdate`.");
+
+
+ if (sourceUpdate == null)
+ throw new ArgumentException("Parameter `sourceUpdate` is required when calling `ValidateSourceBeforeUpdate`.");
+
+ var requestOptions = new InternalRequestOptions(options);
+
+ requestOptions.PathParameters.Add("sourceID", QueryStringHelper.ParameterToString(sourceID));
+
+ requestOptions.Data = sourceUpdate;
+ return await _transport.ExecuteRequestAsync(new HttpMethod("POST"), "/1/sources/{sourceID}/validate", requestOptions, cancellationToken).ConfigureAwait(false);
+ }
+
+
+ ///
+ /// Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia. (Synchronous version)
+ ///
+ ///
+ /// Required API Key ACLs:
+ /// - addObject
+ /// - deleteIndex
+ /// - editSettings
+ /// Unique identifier of a source.
+ ///
+ /// Add extra http header or query parameters to Algolia.
+ /// Cancellation Token to cancel the request.
+ /// Thrown when arguments are not correct
+ /// Thrown when the API call was rejected by Algolia
+ /// Thrown when the client failed to call the endpoint
+ /// SourceValidateResponse
+ public SourceValidateResponse ValidateSourceBeforeUpdate(string sourceID, SourceUpdate sourceUpdate, RequestOptions options = null, CancellationToken cancellationToken = default) =>
+ AsyncHelper.RunSync(() => ValidateSourceBeforeUpdateAsync(sourceID, sourceUpdate, options, cancellationToken));
+
}
diff --git a/clients/algoliasearch-client-csharp/algoliasearch/Models/Ingestion/SourceValidateResponse.cs b/clients/algoliasearch-client-csharp/algoliasearch/Models/Ingestion/SourceValidateResponse.cs
new file mode 100644
index 0000000000..d6c1f14413
--- /dev/null
+++ b/clients/algoliasearch-client-csharp/algoliasearch/Models/Ingestion/SourceValidateResponse.cs
@@ -0,0 +1,135 @@
+//
+// 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.
+//
+using System;
+using System.Text;
+using System.Linq;
+using System.Text.Json.Serialization;
+using System.Collections.Generic;
+using Algolia.Search.Serializer;
+using System.Text.Json;
+
+namespace Algolia.Search.Models.Ingestion;
+
+///
+/// SourceValidateResponse
+///
+public partial class SourceValidateResponse
+{
+ ///
+ /// Initializes a new instance of the SourceValidateResponse class.
+ ///
+ [JsonConstructor]
+ public SourceValidateResponse() { }
+ ///
+ /// Initializes a new instance of the SourceValidateResponse class.
+ ///
+ /// a message describing the outcome of a validate run. (required).
+ public SourceValidateResponse(string message)
+ {
+ Message = message ?? throw new ArgumentNullException(nameof(message));
+ }
+
+ ///
+ /// Universally unique identifier (UUID) of a task run.
+ ///
+ /// Universally unique identifier (UUID) of a task run.
+ [JsonPropertyName("runID")]
+ public string RunID { get; set; }
+
+ ///
+ /// depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery).
+ ///
+ /// depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery).
+ [JsonPropertyName("data")]
+ public List Data { get; set; }
+
+ ///
+ /// in case of error, observability events will be added to the response, if any.
+ ///
+ /// in case of error, observability events will be added to the response, if any.
+ [JsonPropertyName("events")]
+ public List Events { get; set; }
+
+ ///
+ /// a message describing the outcome of a validate run.
+ ///
+ /// a message describing the outcome of a validate run.
+ [JsonPropertyName("message")]
+ public string Message { get; set; }
+
+ ///
+ /// Returns the string presentation of the object
+ ///
+ /// String presentation of the object
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("class SourceValidateResponse {\n");
+ sb.Append(" RunID: ").Append(RunID).Append("\n");
+ sb.Append(" Data: ").Append(Data).Append("\n");
+ sb.Append(" Events: ").Append(Events).Append("\n");
+ sb.Append(" Message: ").Append(Message).Append("\n");
+ sb.Append("}\n");
+ return sb.ToString();
+ }
+
+ ///
+ /// Returns the JSON string presentation of the object
+ ///
+ /// JSON string presentation of the object
+ public virtual string ToJson()
+ {
+ return JsonSerializer.Serialize(this, JsonConfig.Options);
+ }
+
+ ///
+ /// Returns true if objects are equal
+ ///
+ /// Object to be compared
+ /// Boolean
+ public override bool Equals(object obj)
+ {
+ if (obj is not SourceValidateResponse input)
+ {
+ return false;
+ }
+
+ return
+ (RunID == input.RunID || (RunID != null && RunID.Equals(input.RunID))) &&
+ (Data == input.Data || Data != null && input.Data != null && Data.SequenceEqual(input.Data)) &&
+ (Events == input.Events || Events != null && input.Events != null && Events.SequenceEqual(input.Events)) &&
+ (Message == input.Message || (Message != null && Message.Equals(input.Message)));
+ }
+
+ ///
+ /// Gets the hash code
+ ///
+ /// Hash code
+ public override int GetHashCode()
+ {
+ unchecked // Overflow is fine, just wrap
+ {
+ int hashCode = 41;
+ if (RunID != null)
+ {
+ hashCode = (hashCode * 59) + RunID.GetHashCode();
+ }
+ if (Data != null)
+ {
+ hashCode = (hashCode * 59) + Data.GetHashCode();
+ }
+ if (Events != null)
+ {
+ hashCode = (hashCode * 59) + Events.GetHashCode();
+ }
+ if (Message != null)
+ {
+ hashCode = (hashCode * 59) + Message.GetHashCode();
+ }
+ return hashCode;
+ }
+ }
+
+}
+
diff --git a/clients/algoliasearch-client-go/algolia/ingestion/api_ingestion.go b/clients/algoliasearch-client-go/algolia/ingestion/api_ingestion.go
index 5313268666..604aefd24a 100644
--- a/clients/algoliasearch-client-go/algolia/ingestion/api_ingestion.go
+++ b/clients/algoliasearch-client-go/algolia/ingestion/api_ingestion.go
@@ -5800,3 +5800,287 @@ func (c *APIClient) UpdateTaskWithContext(ctx context.Context, r ApiUpdateTaskRe
return returnValue, nil
}
+
+func (r *ApiValidateSourceRequest) UnmarshalJSON(b []byte) error {
+ req := map[string]json.RawMessage{}
+ err := json.Unmarshal(b, &req)
+ if err != nil {
+ return fmt.Errorf("cannot unmarshal request: %w", err)
+ }
+ if v, ok := req["sourceCreate"]; ok {
+ err = json.Unmarshal(v, &r.sourceCreate)
+ if err != nil {
+ err = json.Unmarshal(b, &r.sourceCreate)
+ if err != nil {
+ return fmt.Errorf("cannot unmarshal sourceCreate: %w", err)
+ }
+ }
+ }
+
+ return nil
+}
+
+// ApiValidateSourceRequest represents the request with all the parameters for the API call.
+type ApiValidateSourceRequest struct {
+ sourceCreate *SourceCreate
+}
+
+// NewApiValidateSourceRequest creates an instance of the ApiValidateSourceRequest to be used for the API call.
+func (c *APIClient) NewApiValidateSourceRequest() ApiValidateSourceRequest {
+ return ApiValidateSourceRequest{}
+}
+
+// WithSourceCreate adds the sourceCreate to the ApiValidateSourceRequest and returns the request for chaining.
+func (r ApiValidateSourceRequest) WithSourceCreate(sourceCreate *SourceCreate) ApiValidateSourceRequest {
+ r.sourceCreate = sourceCreate
+ return r
+}
+
+/*
+ValidateSource Wraps ValidateSourceWithContext using context.Background.
+
+Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+
+Required API Key ACLs:
+ - addObject
+ - deleteIndex
+ - editSettings
+
+Request can be constructed by NewApiValidateSourceRequest with parameters below.
+
+ @param sourceCreate SourceCreate -
+ @return SourceValidateResponse
+*/
+func (c *APIClient) ValidateSource(r ApiValidateSourceRequest, opts ...Option) (*SourceValidateResponse, error) {
+ return c.ValidateSourceWithContext(context.Background(), r, opts...)
+}
+
+/*
+ValidateSource
+
+Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+
+Required API Key ACLs:
+ - addObject
+ - deleteIndex
+ - editSettings
+
+Request can be constructed by NewApiValidateSourceRequest with parameters below.
+
+ @param sourceCreate SourceCreate -
+ @return SourceValidateResponse
+*/
+func (c *APIClient) ValidateSourceWithContext(ctx context.Context, r ApiValidateSourceRequest, opts ...Option) (*SourceValidateResponse, error) {
+ var (
+ postBody any
+ returnValue *SourceValidateResponse
+ )
+
+ requestPath := "/1/sources/validate"
+
+ headers := make(map[string]string)
+ queryParams := url.Values{}
+
+ // optional params if any
+ for _, opt := range opts {
+ switch opt.optionType {
+ case "query":
+ queryParams.Set(opt.name, opt.value)
+ case "header":
+ headers[opt.name] = opt.value
+ }
+ }
+
+ // body params
+ if utils.IsNilOrEmpty(r.sourceCreate) {
+ postBody = "{}"
+ } else {
+ postBody = r.sourceCreate
+ }
+ req, err := c.prepareRequest(ctx, requestPath, http.MethodPost, postBody, headers, queryParams)
+ if err != nil {
+ return returnValue, err
+ }
+
+ res, resBody, err := c.callAPI(req, false)
+ if err != nil {
+ return returnValue, err
+ }
+ if res == nil {
+ return returnValue, reportError("res is nil")
+ }
+
+ if res.StatusCode >= 300 {
+ newErr := &APIError{
+ Message: string(resBody),
+ Status: res.StatusCode,
+ }
+
+ var v ErrorBase
+ err = c.decode(&v, resBody)
+ if err != nil {
+ newErr.Message = err.Error()
+ return returnValue, newErr
+ }
+
+ return returnValue, newErr
+ }
+
+ err = c.decode(&returnValue, resBody)
+ if err != nil {
+ return returnValue, reportError("cannot decode result: %w", err)
+ }
+
+ return returnValue, nil
+}
+
+func (r *ApiValidateSourceBeforeUpdateRequest) UnmarshalJSON(b []byte) error {
+ req := map[string]json.RawMessage{}
+ err := json.Unmarshal(b, &req)
+ if err != nil {
+ return fmt.Errorf("cannot unmarshal request: %w", err)
+ }
+ if v, ok := req["sourceID"]; ok {
+ err = json.Unmarshal(v, &r.sourceID)
+ if err != nil {
+ err = json.Unmarshal(b, &r.sourceID)
+ if err != nil {
+ return fmt.Errorf("cannot unmarshal sourceID: %w", err)
+ }
+ }
+ }
+ if v, ok := req["sourceUpdate"]; ok {
+ err = json.Unmarshal(v, &r.sourceUpdate)
+ if err != nil {
+ err = json.Unmarshal(b, &r.sourceUpdate)
+ if err != nil {
+ return fmt.Errorf("cannot unmarshal sourceUpdate: %w", err)
+ }
+ }
+ } else {
+ err = json.Unmarshal(b, &r.sourceUpdate)
+ if err != nil {
+ return fmt.Errorf("cannot unmarshal body parameter sourceUpdate: %w", err)
+ }
+ }
+
+ return nil
+}
+
+// ApiValidateSourceBeforeUpdateRequest represents the request with all the parameters for the API call.
+type ApiValidateSourceBeforeUpdateRequest struct {
+ sourceID string
+ sourceUpdate *SourceUpdate
+}
+
+// NewApiValidateSourceBeforeUpdateRequest creates an instance of the ApiValidateSourceBeforeUpdateRequest to be used for the API call.
+func (c *APIClient) NewApiValidateSourceBeforeUpdateRequest(sourceID string, sourceUpdate *SourceUpdate) ApiValidateSourceBeforeUpdateRequest {
+ return ApiValidateSourceBeforeUpdateRequest{
+ sourceID: sourceID,
+ sourceUpdate: sourceUpdate,
+ }
+}
+
+/*
+ValidateSourceBeforeUpdate Wraps ValidateSourceBeforeUpdateWithContext using context.Background.
+
+Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
+
+Required API Key ACLs:
+ - addObject
+ - deleteIndex
+ - editSettings
+
+Request can be constructed by NewApiValidateSourceBeforeUpdateRequest with parameters below.
+
+ @param sourceID string - Unique identifier of a source.
+ @param sourceUpdate SourceUpdate
+ @return SourceValidateResponse
+*/
+func (c *APIClient) ValidateSourceBeforeUpdate(r ApiValidateSourceBeforeUpdateRequest, opts ...Option) (*SourceValidateResponse, error) {
+ return c.ValidateSourceBeforeUpdateWithContext(context.Background(), r, opts...)
+}
+
+/*
+ValidateSourceBeforeUpdate
+
+Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
+
+Required API Key ACLs:
+ - addObject
+ - deleteIndex
+ - editSettings
+
+Request can be constructed by NewApiValidateSourceBeforeUpdateRequest with parameters below.
+
+ @param sourceID string - Unique identifier of a source.
+ @param sourceUpdate SourceUpdate
+ @return SourceValidateResponse
+*/
+func (c *APIClient) ValidateSourceBeforeUpdateWithContext(ctx context.Context, r ApiValidateSourceBeforeUpdateRequest, opts ...Option) (*SourceValidateResponse, error) {
+ var (
+ postBody any
+ returnValue *SourceValidateResponse
+ )
+
+ requestPath := "/1/sources/{sourceID}/validate"
+ requestPath = strings.ReplaceAll(requestPath, "{sourceID}", url.PathEscape(parameterToString(r.sourceID)))
+
+ headers := make(map[string]string)
+ queryParams := url.Values{}
+ if r.sourceID == "" {
+ return returnValue, reportError("Parameter `sourceID` is required when calling `ValidateSourceBeforeUpdate`.")
+ }
+
+ if r.sourceUpdate == nil {
+ return returnValue, reportError("Parameter `sourceUpdate` is required when calling `ValidateSourceBeforeUpdate`.")
+ }
+
+ // optional params if any
+ for _, opt := range opts {
+ switch opt.optionType {
+ case "query":
+ queryParams.Set(opt.name, opt.value)
+ case "header":
+ headers[opt.name] = opt.value
+ }
+ }
+
+ // body params
+ postBody = r.sourceUpdate
+ req, err := c.prepareRequest(ctx, requestPath, http.MethodPost, postBody, headers, queryParams)
+ if err != nil {
+ return returnValue, err
+ }
+
+ res, resBody, err := c.callAPI(req, false)
+ if err != nil {
+ return returnValue, err
+ }
+ if res == nil {
+ return returnValue, reportError("res is nil")
+ }
+
+ if res.StatusCode >= 300 {
+ newErr := &APIError{
+ Message: string(resBody),
+ Status: res.StatusCode,
+ }
+
+ var v ErrorBase
+ err = c.decode(&v, resBody)
+ if err != nil {
+ newErr.Message = err.Error()
+ return returnValue, newErr
+ }
+
+ return returnValue, newErr
+ }
+
+ err = c.decode(&returnValue, resBody)
+ if err != nil {
+ return returnValue, reportError("cannot decode result: %w", err)
+ }
+
+ return returnValue, nil
+}
diff --git a/clients/algoliasearch-client-go/algolia/ingestion/model_source_validate_response.go b/clients/algoliasearch-client-go/algolia/ingestion/model_source_validate_response.go
new file mode 100644
index 0000000000..35e0d44001
--- /dev/null
+++ b/clients/algoliasearch-client-go/algolia/ingestion/model_source_validate_response.go
@@ -0,0 +1,212 @@
+// 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.
+package ingestion
+
+import (
+ "encoding/json"
+ "fmt"
+)
+
+// SourceValidateResponse struct for SourceValidateResponse.
+type SourceValidateResponse struct {
+ // Universally unique identifier (UUID) of a task run.
+ RunID *string `json:"runID,omitempty"`
+ // depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery).
+ Data []map[string]any `json:"data,omitempty"`
+ // in case of error, observability events will be added to the response, if any.
+ Events []Event `json:"events,omitempty"`
+ // a message describing the outcome of a validate run.
+ Message string `json:"message"`
+}
+
+type SourceValidateResponseOption func(f *SourceValidateResponse)
+
+func WithSourceValidateResponseRunID(val string) SourceValidateResponseOption {
+ return func(f *SourceValidateResponse) {
+ f.RunID = &val
+ }
+}
+
+func WithSourceValidateResponseData(val []map[string]any) SourceValidateResponseOption {
+ return func(f *SourceValidateResponse) {
+ f.Data = val
+ }
+}
+
+func WithSourceValidateResponseEvents(val []Event) SourceValidateResponseOption {
+ return func(f *SourceValidateResponse) {
+ f.Events = val
+ }
+}
+
+// NewSourceValidateResponse instantiates a new SourceValidateResponse object
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed.
+func NewSourceValidateResponse(message string, opts ...SourceValidateResponseOption) *SourceValidateResponse {
+ this := &SourceValidateResponse{}
+ this.Message = message
+ for _, opt := range opts {
+ opt(this)
+ }
+ return this
+}
+
+// NewEmptySourceValidateResponse return a pointer to an empty SourceValidateResponse object.
+func NewEmptySourceValidateResponse() *SourceValidateResponse {
+ return &SourceValidateResponse{}
+}
+
+// GetRunID returns the RunID field value if set, zero value otherwise.
+func (o *SourceValidateResponse) GetRunID() string {
+ if o == nil || o.RunID == nil {
+ var ret string
+ return ret
+ }
+ return *o.RunID
+}
+
+// GetRunIDOk returns a tuple with the RunID field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *SourceValidateResponse) GetRunIDOk() (*string, bool) {
+ if o == nil || o.RunID == nil {
+ return nil, false
+ }
+ return o.RunID, true
+}
+
+// HasRunID returns a boolean if a field has been set.
+func (o *SourceValidateResponse) HasRunID() bool {
+ if o != nil && o.RunID != nil {
+ return true
+ }
+
+ return false
+}
+
+// SetRunID gets a reference to the given string and assigns it to the RunID field.
+func (o *SourceValidateResponse) SetRunID(v string) *SourceValidateResponse {
+ o.RunID = &v
+ return o
+}
+
+// GetData returns the Data field value if set, zero value otherwise.
+func (o *SourceValidateResponse) GetData() []map[string]any {
+ if o == nil || o.Data == nil {
+ var ret []map[string]any
+ return ret
+ }
+ return o.Data
+}
+
+// GetDataOk returns a tuple with the Data field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *SourceValidateResponse) GetDataOk() ([]map[string]any, bool) {
+ if o == nil || o.Data == nil {
+ return nil, false
+ }
+ return o.Data, true
+}
+
+// HasData returns a boolean if a field has been set.
+func (o *SourceValidateResponse) HasData() bool {
+ if o != nil && o.Data != nil {
+ return true
+ }
+
+ return false
+}
+
+// SetData gets a reference to the given []map[string]any and assigns it to the Data field.
+func (o *SourceValidateResponse) SetData(v []map[string]any) *SourceValidateResponse {
+ o.Data = v
+ return o
+}
+
+// GetEvents returns the Events field value if set, zero value otherwise.
+func (o *SourceValidateResponse) GetEvents() []Event {
+ if o == nil || o.Events == nil {
+ var ret []Event
+ return ret
+ }
+ return o.Events
+}
+
+// GetEventsOk returns a tuple with the Events field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *SourceValidateResponse) GetEventsOk() ([]Event, bool) {
+ if o == nil || o.Events == nil {
+ return nil, false
+ }
+ return o.Events, true
+}
+
+// HasEvents returns a boolean if a field has been set.
+func (o *SourceValidateResponse) HasEvents() bool {
+ if o != nil && o.Events != nil {
+ return true
+ }
+
+ return false
+}
+
+// SetEvents gets a reference to the given []Event and assigns it to the Events field.
+func (o *SourceValidateResponse) SetEvents(v []Event) *SourceValidateResponse {
+ o.Events = v
+ return o
+}
+
+// GetMessage returns the Message field value.
+func (o *SourceValidateResponse) GetMessage() string {
+ if o == nil {
+ var ret string
+ return ret
+ }
+
+ return o.Message
+}
+
+// GetMessageOk returns a tuple with the Message field value
+// and a boolean to check if the value has been set.
+func (o *SourceValidateResponse) GetMessageOk() (*string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Message, true
+}
+
+// SetMessage sets field value.
+func (o *SourceValidateResponse) SetMessage(v string) *SourceValidateResponse {
+ o.Message = v
+ return o
+}
+
+func (o SourceValidateResponse) MarshalJSON() ([]byte, error) {
+ toSerialize := map[string]any{}
+ if o.RunID != nil {
+ toSerialize["runID"] = o.RunID
+ }
+ if o.Data != nil {
+ toSerialize["data"] = o.Data
+ }
+ if o.Events != nil {
+ toSerialize["events"] = o.Events
+ }
+ if true {
+ toSerialize["message"] = o.Message
+ }
+ serialized, err := json.Marshal(toSerialize)
+ if err != nil {
+ return nil, fmt.Errorf("failed to marshal SourceValidateResponse: %w", err)
+ }
+
+ return serialized, nil
+}
+
+func (o SourceValidateResponse) String() string {
+ out := ""
+ out += fmt.Sprintf(" runID=%v\n", o.RunID)
+ out += fmt.Sprintf(" data=%v\n", o.Data)
+ out += fmt.Sprintf(" events=%v\n", o.Events)
+ out += fmt.Sprintf(" message=%v\n", o.Message)
+ return fmt.Sprintf("SourceValidateResponse {\n%s}", out)
+}
diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/api/IngestionClient.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/api/IngestionClient.java
index 396c6579be..85c6e608f2 100644
--- a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/api/IngestionClient.java
+++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/api/IngestionClient.java
@@ -2869,4 +2869,172 @@ public CompletableFuture updateTaskAsync(@Nonnull String tas
throws AlgoliaRuntimeException {
return this.updateTaskAsync(taskID, taskUpdate, null);
}
+
+ /**
+ * Validates a source payload to ensure it can be created and that the data source can be reached
+ * by Algolia.
+ *
+ * @param sourceCreate (optional)
+ * @param requestOptions The requestOptions to send along with the query, they will be merged with
+ * the transporter requestOptions.
+ * @throws AlgoliaRuntimeException If it fails to process the API call
+ */
+ public SourceValidateResponse validateSource(SourceCreate sourceCreate, RequestOptions requestOptions) throws AlgoliaRuntimeException {
+ return LaunderThrowable.await(validateSourceAsync(sourceCreate, requestOptions));
+ }
+
+ /**
+ * Validates a source payload to ensure it can be created and that the data source can be reached
+ * by Algolia.
+ *
+ * @param sourceCreate (optional)
+ * @throws AlgoliaRuntimeException If it fails to process the API call
+ */
+ public SourceValidateResponse validateSource(SourceCreate sourceCreate) throws AlgoliaRuntimeException {
+ return this.validateSource(sourceCreate, null);
+ }
+
+ /**
+ * Validates a source payload to ensure it can be created and that the data source can be reached
+ * by Algolia.
+ *
+ * @param requestOptions The requestOptions to send along with the query, they will be merged with
+ * the transporter requestOptions.
+ * @throws AlgoliaRuntimeException If it fails to process the API call
+ */
+ public SourceValidateResponse validateSource(RequestOptions requestOptions) throws AlgoliaRuntimeException {
+ return this.validateSource(null, requestOptions);
+ }
+
+ /**
+ * Validates a source payload to ensure it can be created and that the data source can be reached
+ * by Algolia.
+ *
+ * @throws AlgoliaRuntimeException If it fails to process the API call
+ */
+ public SourceValidateResponse validateSource() throws AlgoliaRuntimeException {
+ return this.validateSource(null, null);
+ }
+
+ /**
+ * (asynchronously) Validates a source payload to ensure it can be created and that the data
+ * source can be reached by Algolia.
+ *
+ * @param sourceCreate (optional)
+ * @param requestOptions The requestOptions to send along with the query, they will be merged with
+ * the transporter requestOptions.
+ * @throws AlgoliaRuntimeException If it fails to process the API call
+ */
+ public CompletableFuture validateSourceAsync(SourceCreate sourceCreate, RequestOptions requestOptions)
+ throws AlgoliaRuntimeException {
+ HttpRequest request = HttpRequest.builder().setPath("/1/sources/validate").setMethod("POST").setBody(sourceCreate).build();
+ return executeAsync(request, requestOptions, new TypeReference() {});
+ }
+
+ /**
+ * (asynchronously) Validates a source payload to ensure it can be created and that the data
+ * source can be reached by Algolia.
+ *
+ * @param sourceCreate (optional)
+ * @throws AlgoliaRuntimeException If it fails to process the API call
+ */
+ public CompletableFuture validateSourceAsync(SourceCreate sourceCreate) throws AlgoliaRuntimeException {
+ return this.validateSourceAsync(sourceCreate, null);
+ }
+
+ /**
+ * (asynchronously) Validates a source payload to ensure it can be created and that the data
+ * source can be reached by Algolia.
+ *
+ * @param requestOptions The requestOptions to send along with the query, they will be merged with
+ * the transporter requestOptions.
+ * @throws AlgoliaRuntimeException If it fails to process the API call
+ */
+ public CompletableFuture validateSourceAsync(RequestOptions requestOptions) throws AlgoliaRuntimeException {
+ return this.validateSourceAsync(null, requestOptions);
+ }
+
+ /**
+ * (asynchronously) Validates a source payload to ensure it can be created and that the data
+ * source can be reached by Algolia.
+ *
+ * @throws AlgoliaRuntimeException If it fails to process the API call
+ */
+ public CompletableFuture validateSourceAsync() throws AlgoliaRuntimeException {
+ return this.validateSourceAsync(null, null);
+ }
+
+ /**
+ * Validates an update of a source payload to ensure it can be created and that the data source
+ * can be reached by Algolia.
+ *
+ * @param sourceID Unique identifier of a source. (required)
+ * @param sourceUpdate (required)
+ * @param requestOptions The requestOptions to send along with the query, they will be merged with
+ * the transporter requestOptions.
+ * @throws AlgoliaRuntimeException If it fails to process the API call
+ */
+ public SourceValidateResponse validateSourceBeforeUpdate(
+ @Nonnull String sourceID,
+ @Nonnull SourceUpdate sourceUpdate,
+ RequestOptions requestOptions
+ ) throws AlgoliaRuntimeException {
+ return LaunderThrowable.await(validateSourceBeforeUpdateAsync(sourceID, sourceUpdate, requestOptions));
+ }
+
+ /**
+ * Validates an update of a source payload to ensure it can be created and that the data source
+ * can be reached by Algolia.
+ *
+ * @param sourceID Unique identifier of a source. (required)
+ * @param sourceUpdate (required)
+ * @throws AlgoliaRuntimeException If it fails to process the API call
+ */
+ public SourceValidateResponse validateSourceBeforeUpdate(@Nonnull String sourceID, @Nonnull SourceUpdate sourceUpdate)
+ throws AlgoliaRuntimeException {
+ return this.validateSourceBeforeUpdate(sourceID, sourceUpdate, null);
+ }
+
+ /**
+ * (asynchronously) Validates an update of a source payload to ensure it can be created and that
+ * the data source can be reached by Algolia.
+ *
+ * @param sourceID Unique identifier of a source. (required)
+ * @param sourceUpdate (required)
+ * @param requestOptions The requestOptions to send along with the query, they will be merged with
+ * the transporter requestOptions.
+ * @throws AlgoliaRuntimeException If it fails to process the API call
+ */
+ public CompletableFuture validateSourceBeforeUpdateAsync(
+ @Nonnull String sourceID,
+ @Nonnull SourceUpdate sourceUpdate,
+ RequestOptions requestOptions
+ ) throws AlgoliaRuntimeException {
+ Parameters.requireNonNull(sourceID, "Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.");
+
+ Parameters.requireNonNull(sourceUpdate, "Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.");
+
+ HttpRequest request = HttpRequest
+ .builder()
+ .setPath("/1/sources/{sourceID}/validate", sourceID)
+ .setMethod("POST")
+ .setBody(sourceUpdate)
+ .build();
+ return executeAsync(request, requestOptions, new TypeReference() {});
+ }
+
+ /**
+ * (asynchronously) Validates an update of a source payload to ensure it can be created and that
+ * the data source can be reached by Algolia.
+ *
+ * @param sourceID Unique identifier of a source. (required)
+ * @param sourceUpdate (required)
+ * @throws AlgoliaRuntimeException If it fails to process the API call
+ */
+ public CompletableFuture validateSourceBeforeUpdateAsync(
+ @Nonnull String sourceID,
+ @Nonnull SourceUpdate sourceUpdate
+ ) throws AlgoliaRuntimeException {
+ return this.validateSourceBeforeUpdateAsync(sourceID, sourceUpdate, null);
+ }
}
diff --git a/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/ingestion/SourceValidateResponse.java b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/ingestion/SourceValidateResponse.java
new file mode 100644
index 0000000000..2aaec3edee
--- /dev/null
+++ b/clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/ingestion/SourceValidateResponse.java
@@ -0,0 +1,133 @@
+// 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.
+
+package com.algolia.model.ingestion;
+
+import com.fasterxml.jackson.annotation.*;
+import com.fasterxml.jackson.databind.annotation.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+/** SourceValidateResponse */
+public class SourceValidateResponse {
+
+ @JsonProperty("runID")
+ private String runID;
+
+ @JsonProperty("data")
+ private List data;
+
+ @JsonProperty("events")
+ private List events;
+
+ @JsonProperty("message")
+ private String message;
+
+ public SourceValidateResponse setRunID(String runID) {
+ this.runID = runID;
+ return this;
+ }
+
+ /** Universally unique identifier (UUID) of a task run. */
+ @javax.annotation.Nullable
+ public String getRunID() {
+ return runID;
+ }
+
+ public SourceValidateResponse setData(List data) {
+ this.data = data;
+ return this;
+ }
+
+ public SourceValidateResponse addData(Object dataItem) {
+ if (this.data == null) {
+ this.data = new ArrayList<>();
+ }
+ this.data.add(dataItem);
+ return this;
+ }
+
+ /**
+ * depending on the source type, the validation returns sampling data of your source (JSON, CSV,
+ * BigQuery).
+ */
+ @javax.annotation.Nullable
+ public List getData() {
+ return data;
+ }
+
+ public SourceValidateResponse setEvents(List events) {
+ this.events = events;
+ return this;
+ }
+
+ public SourceValidateResponse addEvents(Event eventsItem) {
+ if (this.events == null) {
+ this.events = new ArrayList<>();
+ }
+ this.events.add(eventsItem);
+ return this;
+ }
+
+ /** in case of error, observability events will be added to the response, if any. */
+ @javax.annotation.Nullable
+ public List getEvents() {
+ return events;
+ }
+
+ public SourceValidateResponse setMessage(String message) {
+ this.message = message;
+ return this;
+ }
+
+ /** a message describing the outcome of a validate run. */
+ @javax.annotation.Nonnull
+ public String getMessage() {
+ return message;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SourceValidateResponse sourceValidateResponse = (SourceValidateResponse) o;
+ return (
+ Objects.equals(this.runID, sourceValidateResponse.runID) &&
+ Objects.equals(this.data, sourceValidateResponse.data) &&
+ Objects.equals(this.events, sourceValidateResponse.events) &&
+ Objects.equals(this.message, sourceValidateResponse.message)
+ );
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(runID, data, events, message);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class SourceValidateResponse {\n");
+ sb.append(" runID: ").append(toIndentedString(runID)).append("\n");
+ sb.append(" data: ").append(toIndentedString(data)).append("\n");
+ sb.append(" events: ").append(toIndentedString(events)).append("\n");
+ sb.append(" message: ").append(toIndentedString(message)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/clients/algoliasearch-client-javascript/packages/ingestion/model/clientMethodProps.ts b/clients/algoliasearch-client-javascript/packages/ingestion/model/clientMethodProps.ts
index 0a59ce1199..d32c1467bf 100644
--- a/clients/algoliasearch-client-javascript/packages/ingestion/model/clientMethodProps.ts
+++ b/clients/algoliasearch-client-javascript/packages/ingestion/model/clientMethodProps.ts
@@ -494,3 +494,14 @@ export type UpdateTaskProps = {
taskID: string;
taskUpdate: TaskUpdate;
};
+
+/**
+ * Properties for the `validateSourceBeforeUpdate` method.
+ */
+export type ValidateSourceBeforeUpdateProps = {
+ /**
+ * Unique identifier of a source.
+ */
+ sourceID: string;
+ sourceUpdate: SourceUpdate;
+};
diff --git a/clients/algoliasearch-client-javascript/packages/ingestion/model/index.ts b/clients/algoliasearch-client-javascript/packages/ingestion/model/index.ts
index c24df2cf2b..58794be48b 100644
--- a/clients/algoliasearch-client-javascript/packages/ingestion/model/index.ts
+++ b/clients/algoliasearch-client-javascript/packages/ingestion/model/index.ts
@@ -107,6 +107,7 @@ export * from './sourceUpdateDocker';
export * from './sourceUpdateInput';
export * from './sourceUpdateResponse';
export * from './sourceUpdateShopify';
+export * from './sourceValidateResponse';
export * from './streamingTrigger';
export * from './streamingTriggerType';
export * from './streamingUtilsInput';
diff --git a/clients/algoliasearch-client-javascript/packages/ingestion/model/sourceValidateResponse.ts b/clients/algoliasearch-client-javascript/packages/ingestion/model/sourceValidateResponse.ts
new file mode 100644
index 0000000000..75af836d9b
--- /dev/null
+++ b/clients/algoliasearch-client-javascript/packages/ingestion/model/sourceValidateResponse.ts
@@ -0,0 +1,25 @@
+// 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 { Event } from './event';
+
+export type SourceValidateResponse = {
+ /**
+ * Universally unique identifier (UUID) of a task run.
+ */
+ runID?: string;
+
+ /**
+ * Depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery).
+ */
+ data?: Array>;
+
+ /**
+ * In case of error, observability events will be added to the response, if any.
+ */
+ events?: Event[];
+
+ /**
+ * A message describing the outcome of a validate run.
+ */
+ message: string;
+};
diff --git a/clients/algoliasearch-client-javascript/packages/ingestion/src/ingestionClient.ts b/clients/algoliasearch-client-javascript/packages/ingestion/src/ingestionClient.ts
index 0d5e39f519..d194d9c0a4 100644
--- a/clients/algoliasearch-client-javascript/packages/ingestion/src/ingestionClient.ts
+++ b/clients/algoliasearch-client-javascript/packages/ingestion/src/ingestionClient.ts
@@ -49,6 +49,7 @@ import type {
UpdateDestinationProps,
UpdateSourceProps,
UpdateTaskProps,
+ ValidateSourceBeforeUpdateProps,
} from '../model/clientMethodProps';
import type { DeleteResponse } from '../model/deleteResponse';
import type { Destination } from '../model/destination';
@@ -74,6 +75,7 @@ import type { SourceCreate } from '../model/sourceCreate';
import type { SourceCreateResponse } from '../model/sourceCreateResponse';
import type { SourceSearch } from '../model/sourceSearch';
import type { SourceUpdateResponse } from '../model/sourceUpdateResponse';
+import type { SourceValidateResponse } from '../model/sourceValidateResponse';
import type { SubscriptionTrigger } from '../model/subscriptionTrigger';
import type { Task } from '../model/task';
import type { TaskCreate } from '../model/taskCreate';
@@ -1917,5 +1919,82 @@ export function createIngestionClient({
return transporter.request(request, requestOptions);
},
+
+ /**
+ * Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ *
+ * Required API Key ACLs:
+ * - addObject
+ * - deleteIndex
+ * - editSettings.
+ *
+ * @param sourceCreate -.
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
+ */
+ validateSource(
+ sourceCreate: SourceCreate,
+ requestOptions: RequestOptions | undefined = undefined
+ ): Promise {
+ const requestPath = '/1/sources/validate';
+ const headers: Headers = {};
+ const queryParameters: QueryParameters = {};
+
+ const request: Request = {
+ method: 'POST',
+ path: requestPath,
+ queryParameters,
+ headers,
+ data: sourceCreate ? sourceCreate : {},
+ };
+
+ return transporter.request(request, requestOptions);
+ },
+
+ /**
+ * Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ *
+ * Required API Key ACLs:
+ * - addObject
+ * - deleteIndex
+ * - editSettings.
+ *
+ * @param validateSourceBeforeUpdate - The validateSourceBeforeUpdate object.
+ * @param validateSourceBeforeUpdate.sourceID - Unique identifier of a source.
+ * @param validateSourceBeforeUpdate.sourceUpdate - The sourceUpdate object.
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
+ */
+ validateSourceBeforeUpdate(
+ { sourceID, sourceUpdate }: ValidateSourceBeforeUpdateProps,
+ requestOptions?: RequestOptions
+ ): Promise {
+ if (!sourceID) {
+ throw new Error(
+ 'Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.'
+ );
+ }
+
+ if (!sourceUpdate) {
+ throw new Error(
+ 'Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.'
+ );
+ }
+
+ const requestPath = '/1/sources/{sourceID}/validate'.replace(
+ '{sourceID}',
+ encodeURIComponent(sourceID)
+ );
+ const headers: Headers = {};
+ const queryParameters: QueryParameters = {};
+
+ const request: Request = {
+ method: 'POST',
+ path: requestPath,
+ queryParameters,
+ headers,
+ data: sourceUpdate,
+ };
+
+ return transporter.request(request, requestOptions);
+ },
};
}
diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/api/IngestionClient.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/api/IngestionClient.kt
index 85d8acda5a..95dd5ef6a5 100644
--- a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/api/IngestionClient.kt
+++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/api/IngestionClient.kt
@@ -924,4 +924,50 @@ public class IngestionClient(
requestOptions = requestOptions,
)
}
+
+ /**
+ * Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ *
+ * Required API Key ACLs:
+ * - addObject
+ * - deleteIndex
+ * - editSettings
+ * @param sourceCreate
+ * @param requestOptions additional request configuration.
+ */
+ public suspend fun validateSource(sourceCreate: SourceCreate? = null, requestOptions: RequestOptions? = null): SourceValidateResponse {
+ val requestConfig = RequestConfig(
+ method = RequestMethod.POST,
+ path = listOf("1", "sources", "validate"),
+ body = sourceCreate,
+ )
+ return requester.execute(
+ requestConfig = requestConfig,
+ requestOptions = requestOptions,
+ )
+ }
+
+ /**
+ * Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ *
+ * Required API Key ACLs:
+ * - addObject
+ * - deleteIndex
+ * - editSettings
+ * @param sourceID Unique identifier of a source.
+ * @param sourceUpdate
+ * @param requestOptions additional request configuration.
+ */
+ public suspend fun validateSourceBeforeUpdate(sourceID: String, sourceUpdate: SourceUpdate, requestOptions: RequestOptions? = null): SourceValidateResponse {
+ require(sourceID.isNotBlank()) { "Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`." }
+ val requestConfig = RequestConfig(
+ method = RequestMethod.POST,
+ path = listOf("1", "sources", "$sourceID", "validate"),
+ body = sourceUpdate,
+ )
+ return requester.execute(
+ requestConfig = requestConfig,
+ requestOptions = requestOptions,
+ )
+ }
}
diff --git a/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/ingestion/SourceValidateResponse.kt b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/ingestion/SourceValidateResponse.kt
new file mode 100644
index 0000000000..127f7f4cce
--- /dev/null
+++ b/clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/model/ingestion/SourceValidateResponse.kt
@@ -0,0 +1,29 @@
+/** 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. */
+package com.algolia.client.model.ingestion
+
+import kotlinx.serialization.*
+import kotlinx.serialization.json.*
+
+/**
+ * SourceValidateResponse
+ *
+ * @param message a message describing the outcome of a validate run.
+ * @param runID Universally unique identifier (UUID) of a task run.
+ * @param `data` depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery).
+ * @param events in case of error, observability events will be added to the response, if any.
+ */
+@Serializable
+public data class SourceValidateResponse(
+
+ /** a message describing the outcome of a validate run. */
+ @SerialName(value = "message") val message: String,
+
+ /** Universally unique identifier (UUID) of a task run. */
+ @SerialName(value = "runID") val runID: String? = null,
+
+ /** depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery). */
+ @SerialName(value = "data") val `data`: List? = null,
+
+ /** in case of error, observability events will be added to the response, if any. */
+ @SerialName(value = "events") val events: List? = null,
+)
diff --git a/clients/algoliasearch-client-php/lib/Api/IngestionClient.php b/clients/algoliasearch-client-php/lib/Api/IngestionClient.php
index 9a63f37c8a..6281f2246b 100644
--- a/clients/algoliasearch-client-php/lib/Api/IngestionClient.php
+++ b/clients/algoliasearch-client-php/lib/Api/IngestionClient.php
@@ -1798,6 +1798,88 @@ public function updateTask($taskID, $taskUpdate, $requestOptions = [])
return $this->sendRequest('PATCH', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
}
+ /**
+ * Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ *
+ * Required API Key ACLs:
+ * - addObject
+ * - deleteIndex
+ * - editSettings
+ *
+ * @param array $sourceCreate (optional)
+ * - $sourceCreate['type'] => (array) (required)
+ * - $sourceCreate['name'] => (string) Descriptive name of the source. (required)
+ * - $sourceCreate['input'] => (array) (required)
+ * - $sourceCreate['authenticationID'] => (string) Universally unique identifier (UUID) of an authentication resource.
+ *
+ * @see \Algolia\AlgoliaSearch\Model\Ingestion\SourceCreate
+ *
+ * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
+ *
+ * @return \Algolia\AlgoliaSearch\Model\Ingestion\SourceValidateResponse|array
+ */
+ public function validateSource($sourceCreate = null, $requestOptions = [])
+ {
+ $resourcePath = '/1/sources/validate';
+ $queryParameters = [];
+ $headers = [];
+ $httpBody = isset($sourceCreate) ? $sourceCreate : [];
+
+ return $this->sendRequest('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
+ }
+
+ /**
+ * Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ *
+ * Required API Key ACLs:
+ * - addObject
+ * - deleteIndex
+ * - editSettings
+ *
+ * @param string $sourceID Unique identifier of a source. (required)
+ * @param array $sourceUpdate sourceUpdate (required)
+ * - $sourceUpdate['name'] => (string) Descriptive name of the source.
+ * - $sourceUpdate['input'] => (array)
+ * - $sourceUpdate['authenticationID'] => (string) Universally unique identifier (UUID) of an authentication resource.
+ *
+ * @see \Algolia\AlgoliaSearch\Model\Ingestion\SourceUpdate
+ *
+ * @param array $requestOptions the requestOptions to send along with the query, they will be merged with the transporter requestOptions
+ *
+ * @return \Algolia\AlgoliaSearch\Model\Ingestion\SourceValidateResponse|array
+ */
+ public function validateSourceBeforeUpdate($sourceID, $sourceUpdate, $requestOptions = [])
+ {
+ // verify the required parameter 'sourceID' is set
+ if (!isset($sourceID)) {
+ throw new \InvalidArgumentException(
+ 'Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.'
+ );
+ }
+ // verify the required parameter 'sourceUpdate' is set
+ if (!isset($sourceUpdate)) {
+ throw new \InvalidArgumentException(
+ 'Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.'
+ );
+ }
+
+ $resourcePath = '/1/sources/{sourceID}/validate';
+ $queryParameters = [];
+ $headers = [];
+ $httpBody = $sourceUpdate;
+
+ // path params
+ if (null !== $sourceID) {
+ $resourcePath = str_replace(
+ '{sourceID}',
+ ObjectSerializer::toPathValue($sourceID),
+ $resourcePath
+ );
+ }
+
+ return $this->sendRequest('POST', $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions);
+ }
+
private function sendRequest($method, $resourcePath, $headers, $queryParameters, $httpBody, $requestOptions, $useReadTransporter = false)
{
if (!isset($requestOptions['headers'])) {
diff --git a/clients/algoliasearch-client-php/lib/Model/Ingestion/SourceValidateResponse.php b/clients/algoliasearch-client-php/lib/Model/Ingestion/SourceValidateResponse.php
new file mode 100644
index 0000000000..c69c6970fc
--- /dev/null
+++ b/clients/algoliasearch-client-php/lib/Model/Ingestion/SourceValidateResponse.php
@@ -0,0 +1,325 @@
+ 'string',
+ 'data' => 'object[]',
+ 'events' => '\Algolia\AlgoliaSearch\Model\Ingestion\Event[]',
+ 'message' => 'string',
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization.
+ *
+ * @var string[]
+ */
+ protected static $modelFormats = [
+ 'runID' => null,
+ 'data' => null,
+ 'events' => null,
+ 'message' => null,
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name.
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'runID' => 'runID',
+ 'data' => 'data',
+ 'events' => 'events',
+ 'message' => 'message',
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses).
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'runID' => 'setRunID',
+ 'data' => 'setData',
+ 'events' => 'setEvents',
+ 'message' => 'setMessage',
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests).
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'runID' => 'getRunID',
+ 'data' => 'getData',
+ 'events' => 'getEvents',
+ 'message' => 'getMessage',
+ ];
+
+ /**
+ * Associative array for storing property values.
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor.
+ *
+ * @param mixed[] $data Associated array of property values
+ */
+ public function __construct(array $data = null)
+ {
+ if (isset($data['runID'])) {
+ $this->container['runID'] = $data['runID'];
+ }
+ if (isset($data['data'])) {
+ $this->container['data'] = $data['data'];
+ }
+ if (isset($data['events'])) {
+ $this->container['events'] = $data['events'];
+ }
+ if (isset($data['message'])) {
+ $this->container['message'] = $data['message'];
+ }
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name.
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization.
+ *
+ * @return array
+ */
+ public static function modelTypes()
+ {
+ return self::$modelTypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization.
+ *
+ * @return array
+ */
+ public static function modelFormats()
+ {
+ return self::$modelFormats;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses).
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests).
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if (!isset($this->container['message']) || null === $this->container['message']) {
+ $invalidProperties[] = "'message' can't be null";
+ }
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed.
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return 0 === count($this->listInvalidProperties());
+ }
+
+ /**
+ * Gets runID.
+ *
+ * @return null|string
+ */
+ public function getRunID()
+ {
+ return $this->container['runID'] ?? null;
+ }
+
+ /**
+ * Sets runID.
+ *
+ * @param null|string $runID universally unique identifier (UUID) of a task run
+ *
+ * @return self
+ */
+ public function setRunID($runID)
+ {
+ $this->container['runID'] = $runID;
+
+ return $this;
+ }
+
+ /**
+ * Gets data.
+ *
+ * @return null|object[]
+ */
+ public function getData()
+ {
+ return $this->container['data'] ?? null;
+ }
+
+ /**
+ * Sets data.
+ *
+ * @param null|object[] $data depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery)
+ *
+ * @return self
+ */
+ public function setData($data)
+ {
+ $this->container['data'] = $data;
+
+ return $this;
+ }
+
+ /**
+ * Gets events.
+ *
+ * @return null|\Algolia\AlgoliaSearch\Model\Ingestion\Event[]
+ */
+ public function getEvents()
+ {
+ return $this->container['events'] ?? null;
+ }
+
+ /**
+ * Sets events.
+ *
+ * @param null|\Algolia\AlgoliaSearch\Model\Ingestion\Event[] $events in case of error, observability events will be added to the response, if any
+ *
+ * @return self
+ */
+ public function setEvents($events)
+ {
+ $this->container['events'] = $events;
+
+ return $this;
+ }
+
+ /**
+ * Gets message.
+ *
+ * @return string
+ */
+ public function getMessage()
+ {
+ return $this->container['message'] ?? null;
+ }
+
+ /**
+ * Sets message.
+ *
+ * @param string $message a message describing the outcome of a validate run
+ *
+ * @return self
+ */
+ public function setMessage($message)
+ {
+ $this->container['message'] = $message;
+
+ return $this;
+ }
+
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param int $offset Offset
+ *
+ * @return bool
+ */
+ public function offsetExists($offset)
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param int $offset Offset
+ *
+ * @return null|mixed
+ */
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param null|int $offset Offset
+ * @param mixed $value Value to be set
+ */
+ public function offsetSet($offset, $value)
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param int $offset Offset
+ */
+ public function offsetUnset($offset)
+ {
+ unset($this->container[$offset]);
+ }
+}
diff --git a/clients/algoliasearch-client-python/algoliasearch/ingestion/client.py b/clients/algoliasearch-client-python/algoliasearch/ingestion/client.py
index 3c1558659e..00157e89ee 100644
--- a/clients/algoliasearch-client-python/algoliasearch/ingestion/client.py
+++ b/clients/algoliasearch-client-python/algoliasearch/ingestion/client.py
@@ -76,6 +76,9 @@
from algoliasearch.ingestion.models.source_type import SourceType
from algoliasearch.ingestion.models.source_update import SourceUpdate
from algoliasearch.ingestion.models.source_update_response import SourceUpdateResponse
+from algoliasearch.ingestion.models.source_validate_response import (
+ SourceValidateResponse,
+)
from algoliasearch.ingestion.models.task import Task
from algoliasearch.ingestion.models.task_create import TaskCreate
from algoliasearch.ingestion.models.task_create_response import TaskCreateResponse
@@ -3200,3 +3203,137 @@ async def update_task(
return (
await self.update_task_with_http_info(task_id, task_update, request_options)
).deserialize(TaskUpdateResponse)
+
+ async def validate_source_with_http_info(
+ self,
+ source_create: Optional[SourceCreate] = None,
+ request_options: Optional[Union[dict, RequestOptions]] = None,
+ ) -> ApiResponse[str]:
+ """
+ Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+
+ Required API Key ACLs:
+ - addObject
+ - deleteIndex
+ - editSettings
+
+ :param source_create:
+ :type source_create: SourceCreate
+ :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
+ :return: Returns the raw algoliasearch 'APIResponse' object.
+ """
+
+ _data = {}
+ if source_create is not None:
+ _data = source_create
+
+ return await self._transporter.request(
+ verb=Verb.POST,
+ path="/1/sources/validate",
+ request_options=self._request_options.merge(
+ data=dumps(bodySerializer(_data)),
+ user_request_options=request_options,
+ ),
+ use_read_transporter=False,
+ )
+
+ async def validate_source(
+ self,
+ source_create: Optional[SourceCreate] = None,
+ request_options: Optional[Union[dict, RequestOptions]] = None,
+ ) -> SourceValidateResponse:
+ """
+ Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+
+ Required API Key ACLs:
+ - addObject
+ - deleteIndex
+ - editSettings
+
+ :param source_create:
+ :type source_create: SourceCreate
+ :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
+ :return: Returns the deserialized response in a 'SourceValidateResponse' result object.
+ """
+ return (
+ await self.validate_source_with_http_info(source_create, request_options)
+ ).deserialize(SourceValidateResponse)
+
+ async def validate_source_before_update_with_http_info(
+ self,
+ source_id: Annotated[
+ StrictStr, Field(description="Unique identifier of a source.")
+ ],
+ source_update: SourceUpdate,
+ request_options: Optional[Union[dict, RequestOptions]] = None,
+ ) -> ApiResponse[str]:
+ """
+ Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
+
+ Required API Key ACLs:
+ - addObject
+ - deleteIndex
+ - editSettings
+
+ :param source_id: Unique identifier of a source. (required)
+ :type source_id: str
+ :param source_update: (required)
+ :type source_update: SourceUpdate
+ :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
+ :return: Returns the raw algoliasearch 'APIResponse' object.
+ """
+
+ if source_id is None:
+ raise ValueError(
+ "Parameter `source_id` is required when calling `validate_source_before_update`."
+ )
+
+ if source_update is None:
+ raise ValueError(
+ "Parameter `source_update` is required when calling `validate_source_before_update`."
+ )
+
+ _data = {}
+ if source_update is not None:
+ _data = source_update
+
+ return await self._transporter.request(
+ verb=Verb.POST,
+ path="/1/sources/{sourceID}/validate".replace(
+ "{sourceID}", quote(str(source_id), safe="")
+ ),
+ request_options=self._request_options.merge(
+ data=dumps(bodySerializer(_data)),
+ user_request_options=request_options,
+ ),
+ use_read_transporter=False,
+ )
+
+ async def validate_source_before_update(
+ self,
+ source_id: Annotated[
+ StrictStr, Field(description="Unique identifier of a source.")
+ ],
+ source_update: SourceUpdate,
+ request_options: Optional[Union[dict, RequestOptions]] = None,
+ ) -> SourceValidateResponse:
+ """
+ Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
+
+ Required API Key ACLs:
+ - addObject
+ - deleteIndex
+ - editSettings
+
+ :param source_id: Unique identifier of a source. (required)
+ :type source_id: str
+ :param source_update: (required)
+ :type source_update: SourceUpdate
+ :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
+ :return: Returns the deserialized response in a 'SourceValidateResponse' result object.
+ """
+ return (
+ await self.validate_source_before_update_with_http_info(
+ source_id, source_update, request_options
+ )
+ ).deserialize(SourceValidateResponse)
diff --git a/clients/algoliasearch-client-python/algoliasearch/ingestion/models/source_validate_response.py b/clients/algoliasearch-client-python/algoliasearch/ingestion/models/source_validate_response.py
new file mode 100644
index 0000000000..4e1c9950a2
--- /dev/null
+++ b/clients/algoliasearch-client-python/algoliasearch/ingestion/models/source_validate_response.py
@@ -0,0 +1,95 @@
+# coding: utf-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.
+"""
+
+from __future__ import annotations
+
+from json import loads
+from typing import Any, Dict, List, Optional, Self
+
+from pydantic import BaseModel, ConfigDict, Field, StrictStr
+
+from algoliasearch.ingestion.models.event import Event
+
+
+class SourceValidateResponse(BaseModel):
+ """
+ SourceValidateResponse
+ """
+
+ run_id: Optional[StrictStr] = Field(
+ default=None,
+ description="Universally unique identifier (UUID) of a task run.",
+ alias="runID",
+ )
+ data: Optional[List[Dict[str, Any]]] = Field(
+ default=None,
+ description="depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery).",
+ )
+ events: Optional[List[Event]] = Field(
+ default=None,
+ description="in case of error, observability events will be added to the response, if any.",
+ )
+ message: StrictStr = Field(
+ description="a message describing the outcome of a validate run."
+ )
+
+ model_config = ConfigDict(
+ use_enum_values=True, populate_by_name=True, validate_assignment=True
+ )
+
+ def to_json(self) -> str:
+ return self.model_dump_json(by_alias=True, exclude_unset=True)
+
+ @classmethod
+ def from_json(cls, json_str: str) -> Self:
+ """Create an instance of SourceValidateResponse from a JSON string"""
+ return cls.from_dict(loads(json_str))
+
+ def to_dict(self) -> Dict[str, Any]:
+ """Return the dictionary representation of the model using alias.
+
+ This has the following differences from calling pydantic's
+ `self.model_dump(by_alias=True)`:
+
+ * `None` is only added to the output dict for nullable fields that
+ were set at model initialization. Other fields with value `None`
+ are ignored.
+ """
+ _dict = self.model_dump(
+ by_alias=True,
+ exclude={},
+ exclude_none=True,
+ )
+ _items = []
+ if self.events:
+ for _item in self.events:
+ if _item:
+ _items.append(_item.to_dict())
+ _dict["events"] = _items
+ return _dict
+
+ @classmethod
+ def from_dict(cls, obj: Dict) -> Self:
+ """Create an instance of SourceValidateResponse from a dict"""
+ if obj is None:
+ return None
+
+ if not isinstance(obj, dict):
+ return cls.model_validate(obj)
+
+ _obj = cls.model_validate(
+ {
+ "runID": obj.get("runID"),
+ "data": obj.get("data"),
+ "events": (
+ [Event.from_dict(_item) for _item in obj.get("events")]
+ if obj.get("events") is not None
+ else None
+ ),
+ "message": obj.get("message"),
+ }
+ )
+ return _obj
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/api/ingestion_client.rb b/clients/algoliasearch-client-ruby/lib/algolia/api/ingestion_client.rb
index 9516bb8764..fc7a87f264 100644
--- a/clients/algoliasearch-client-ruby/lib/algolia/api/ingestion_client.rb
+++ b/clients/algoliasearch-client-ruby/lib/algolia/api/ingestion_client.rb
@@ -1966,5 +1966,102 @@ def update_task(task_id, task_update, request_options = {})
response = update_task_with_http_info(task_id, task_update, request_options)
@api_client.deserialize(response.body, request_options[:debug_return_type] || 'Ingestion::TaskUpdateResponse')
end
+
+ # Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ #
+ # Required API Key ACLs:
+ # - addObject
+ # - deleteIndex
+ # - editSettings
+ # @param source_create [SourceCreate]
+ # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
+ # @return [Http::Response] the response
+ def validate_source_with_http_info(source_create = nil, request_options = {})
+ path = '/1/sources/validate'
+ query_params = {}
+ query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
+ header_params = {}
+ header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
+
+ post_body = request_options[:debug_body] || @api_client.object_to_http_body(source_create)
+
+ new_options = request_options.merge(
+ :operation => :'IngestionClient.validate_source',
+ :header_params => header_params,
+ :query_params => query_params,
+ :body => post_body,
+ :use_read_transporter => false
+ )
+
+ @api_client.call_api(:POST, path, new_options)
+ end
+
+ # Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ #
+ # Required API Key ACLs:
+ # - addObject
+ # - deleteIndex
+ # - editSettings
+ # @param source_create [SourceCreate]
+ # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
+ # @return [SourceValidateResponse]
+ def validate_source(source_create = nil, request_options = {})
+ response = validate_source_with_http_info(source_create, request_options)
+ @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Ingestion::SourceValidateResponse')
+ end
+
+ # Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ #
+ # Required API Key ACLs:
+ # - addObject
+ # - deleteIndex
+ # - editSettings
+ # @param source_id [String] Unique identifier of a source. (required)
+ # @param source_update [SourceUpdate] (required)
+ # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
+ # @return [Http::Response] the response
+ def validate_source_before_update_with_http_info(source_id, source_update, request_options = {})
+ # verify the required parameter 'source_id' is set
+ if @api_client.config.client_side_validation && source_id.nil?
+ raise ArgumentError, "Parameter `source_id` is required when calling `validate_source_before_update`."
+ end
+ # verify the required parameter 'source_update' is set
+ if @api_client.config.client_side_validation && source_update.nil?
+ raise ArgumentError, "Parameter `source_update` is required when calling `validate_source_before_update`."
+ end
+
+ path = '/1/sources/{sourceID}/validate'.sub('{' + 'sourceID' + '}', Transport.encode_uri(source_id.to_s))
+ query_params = {}
+ query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
+ header_params = {}
+ header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?
+
+ post_body = request_options[:debug_body] || @api_client.object_to_http_body(source_update)
+
+ new_options = request_options.merge(
+ :operation => :'IngestionClient.validate_source_before_update',
+ :header_params => header_params,
+ :query_params => query_params,
+ :body => post_body,
+ :use_read_transporter => false
+ )
+
+ @api_client.call_api(:POST, path, new_options)
+ end
+
+ # Validates an update of a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ #
+ # Required API Key ACLs:
+ # - addObject
+ # - deleteIndex
+ # - editSettings
+ # @param source_id [String] Unique identifier of a source. (required)
+ # @param source_update [SourceUpdate] (required)
+ # @param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)
+ # @return [SourceValidateResponse]
+ def validate_source_before_update(source_id, source_update, request_options = {})
+ response = validate_source_before_update_with_http_info(source_id, source_update, request_options)
+ @api_client.deserialize(response.body, request_options[:debug_return_type] || 'Ingestion::SourceValidateResponse')
+ end
end
end
diff --git a/clients/algoliasearch-client-ruby/lib/algolia/models/ingestion/source_validate_response.rb b/clients/algoliasearch-client-ruby/lib/algolia/models/ingestion/source_validate_response.rb
new file mode 100644
index 0000000000..ef54dadac2
--- /dev/null
+++ b/clients/algoliasearch-client-ruby/lib/algolia/models/ingestion/source_validate_response.rb
@@ -0,0 +1,233 @@
+# 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.
+
+require 'date'
+require 'time'
+
+module Algolia
+ module Ingestion
+ class SourceValidateResponse
+ # Universally unique identifier (UUID) of a task run.
+ attr_accessor :run_id
+
+ # depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery).
+ attr_accessor :data
+
+ # in case of error, observability events will be added to the response, if any.
+ attr_accessor :events
+
+ # a message describing the outcome of a validate run.
+ attr_accessor :message
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :run_id => :runID,
+ :data => :data,
+ :events => :events,
+ :message => :message
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.types_mapping
+ {
+ :run_id => :String,
+ :data => :'Array',
+ :events => :'Array',
+ :message => :String
+ }
+ end
+
+ # List of attributes with nullable: true
+ def self.openapi_nullable
+ Set.new([])
+ end
+
+ # Initializes the object
+ # @param [Hash] attributes Model attributes in the form of hash
+ def initialize(attributes = {})
+ unless attributes.is_a?(Hash)
+ raise ArgumentError, "The input argument (attributes) must be a hash in `Algolia::SourceValidateResponse` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) do |(k, v), h|
+ unless self.class.attribute_map.key?(k.to_sym)
+ raise ArgumentError,
+ "`#{k}` is not a valid attribute in `Algolia::SourceValidateResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+ end
+
+ h[k.to_sym] = v
+ end
+
+ if attributes.key?(:run_id)
+ self.run_id = attributes[:run_id]
+ end
+
+ if attributes.key?(:data)
+ if (value = attributes[:data]).is_a?(Array)
+ self.data = value
+ end
+ end
+
+ if attributes.key?(:events)
+ if (value = attributes[:events]).is_a?(Array)
+ self.events = value
+ end
+ end
+
+ if attributes.key?(:message)
+ self.message = attributes[:message]
+ else
+ self.message = nil
+ end
+ end
+
+ # Checks equality by comparing each attribute.
+ # @param [Object] Object to be compared
+ def ==(other)
+ return true if equal?(other)
+
+ self.class == other.class &&
+ run_id == other.run_id &&
+ data == other.data &&
+ events == other.events &&
+ message == other.message
+ end
+
+ # @see the `==` method
+ # @param [Object] Object to be compared
+ def eql?(other)
+ self == other
+ end
+
+ # Calculates hash code according to all attributes.
+ # @return [Integer] Hash code
+ def hash
+ [run_id, data, events, message].hash
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def self.build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+
+ attributes = attributes.transform_keys(&:to_sym)
+ transformed_hash = {}
+ types_mapping.each_pair do |key, type|
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
+ transformed_hash[key.to_sym] = nil
+ elsif type =~ /\AArray<(.*)>/i
+ # check to ensure the input is an array given that the attribute
+ # is documented as an array but the input is not
+ if attributes[attribute_map[key]].is_a?(Array)
+ transformed_hash[key.to_sym] = attributes[attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }
+ end
+ elsif !attributes[attribute_map[key]].nil?
+ transformed_hash[key.to_sym] = _deserialize(type, attributes[attribute_map[key]])
+ end
+ end
+ new(transformed_hash)
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def self._deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?.+?), (?.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = Algolia::Ingestion.const_get(type)
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_hash
+ end
+
+ def to_json(*_args)
+ to_hash.to_json
+ end
+
+ # Returns the object in the form of hash
+ # @return [Hash] Returns the object in the form of hash
+ def to_hash
+ hash = {}
+ self.class.attribute_map.each_pair do |attr, param|
+ value = send(attr)
+ if value.nil?
+ is_nullable = self.class.openapi_nullable.include?(attr)
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+ end
+
+ hash[param] = _to_hash(value)
+ end
+ hash
+ end
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+ end
+ end
+end
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/api/IngestionClient.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/api/IngestionClient.scala
index be85ab1de9..eb507b697a 100644
--- a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/api/IngestionClient.scala
+++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/api/IngestionClient.scala
@@ -48,6 +48,7 @@ import algoliasearch.ingestion.SourceSortKeys._
import algoliasearch.ingestion.SourceType._
import algoliasearch.ingestion.SourceUpdate
import algoliasearch.ingestion.SourceUpdateResponse
+import algoliasearch.ingestion.SourceValidateResponse
import algoliasearch.ingestion.Task
import algoliasearch.ingestion.TaskCreate
import algoliasearch.ingestion.TaskCreateResponse
@@ -1139,4 +1140,54 @@ class IngestionClient(
execute[TaskUpdateResponse](request, requestOptions)
}
+ /** Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ *
+ * Required API Key ACLs:
+ * - addObject
+ * - deleteIndex
+ * - editSettings
+ *
+ * @param sourceCreate
+ */
+ def validateSource(sourceCreate: Option[SourceCreate] = None, requestOptions: Option[RequestOptions] = None)(implicit
+ ec: ExecutionContext
+ ): Future[SourceValidateResponse] = Future {
+
+ val request = HttpRequest
+ .builder()
+ .withMethod("POST")
+ .withPath(s"/1/sources/validate")
+ .withBody(sourceCreate)
+ .build()
+ execute[SourceValidateResponse](request, requestOptions)
+ }
+
+ /** Validates an update of a source payload to ensure it can be created and that the data source can be reached by
+ * Algolia.
+ *
+ * Required API Key ACLs:
+ * - addObject
+ * - deleteIndex
+ * - editSettings
+ *
+ * @param sourceID
+ * Unique identifier of a source.
+ */
+ def validateSourceBeforeUpdate(
+ sourceID: String,
+ sourceUpdate: SourceUpdate,
+ requestOptions: Option[RequestOptions] = None
+ )(implicit ec: ExecutionContext): Future[SourceValidateResponse] = Future {
+ requireNotNull(sourceID, "Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.")
+ requireNotNull(sourceUpdate, "Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.")
+
+ val request = HttpRequest
+ .builder()
+ .withMethod("POST")
+ .withPath(s"/1/sources/${escape(sourceID)}/validate")
+ .withBody(sourceUpdate)
+ .build()
+ execute[SourceValidateResponse](request, requestOptions)
+ }
+
}
diff --git a/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/ingestion/SourceValidateResponse.scala b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/ingestion/SourceValidateResponse.scala
new file mode 100644
index 0000000000..d9324a3e01
--- /dev/null
+++ b/clients/algoliasearch-client-scala/src/main/scala/algoliasearch/ingestion/SourceValidateResponse.scala
@@ -0,0 +1,42 @@
+/** Ingestion API The Ingestion API lets you connect third-party services and platforms with Algolia and schedule tasks
+ * to ingest your data. The Ingestion API powers the no-code [data
+ * connectors](https://dashboard.algolia.com/connectors). ## Base URLs The base URLs for requests to the Ingestion API
+ * are: - `https://data.us.algolia.com` - `https://data.eu.algolia.com` Use the URL that matches your [analytics
+ * region](https://dashboard.algolia.com/account/infrastructure/analytics). **All requests must use HTTPS.** ##
+ * Authentication To authenticate your API requests, add these headers: - `x-algolia-application-id`. Your Algolia
+ * application ID. - `x-algolia-api-key`. An API key with the necessary permissions to make the request. The required
+ * access control list (ACL) to make a request is listed in each endpoint's reference. You can find your application ID
+ * and API key in the [Algolia dashboard](https://dashboard.algolia.com/account). ## Request format Request bodies must
+ * be JSON objects. ## Response status and errors Response bodies are JSON objects. Deleting a user token returns an
+ * empty response body with rate-limiting information as headers. Successful responses return a `2xx` status. Client
+ * errors return a `4xx` status. Server errors are indicated by a `5xx` status. Error responses have a `message`
+ * property with more information. The Insights API doesn't validate if the event parameters such as `indexName`,
+ * `objectIDs`, or `userToken`, correspond to anything in the Search API. It justs checks if they're formatted
+ * correctly. Check the [Events](https://dashboard.algolia.com/events/health) health section, whether your events can
+ * be used for Algolia features such as Analytics, or Dynamic Re-Ranking. ## Version The current version of the
+ * Insights API is version 1, as indicated by the `/1/` in each endpoint's URL.
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech Do not edit the class manually.
+ */
+package algoliasearch.ingestion
+
+/** SourceValidateResponse
+ *
+ * @param runID
+ * Universally unique identifier (UUID) of a task run.
+ * @param data
+ * depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery).
+ * @param events
+ * in case of error, observability events will be added to the response, if any.
+ * @param message
+ * a message describing the outcome of a validate run.
+ */
+case class SourceValidateResponse(
+ runID: Option[String] = scala.None,
+ data: Option[Seq[Any]] = scala.None,
+ events: Option[Seq[Event]] = scala.None,
+ message: String
+)
diff --git a/clients/algoliasearch-client-swift/Sources/Ingestion/IngestionClient.swift b/clients/algoliasearch-client-swift/Sources/Ingestion/IngestionClient.swift
index 462c37c158..9a5a0a6d7d 100644
--- a/clients/algoliasearch-client-swift/Sources/Ingestion/IngestionClient.swift
+++ b/clients/algoliasearch-client-swift/Sources/Ingestion/IngestionClient.swift
@@ -2411,4 +2411,120 @@ open class IngestionClient {
requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
)
}
+
+ /// - parameter sourceCreate: (body) (optional)
+ /// - returns: SourceValidateResponse
+ @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
+ open func validateSource(
+ sourceCreate: SourceCreate? = nil,
+ requestOptions: RequestOptions? = nil
+ ) async throws -> SourceValidateResponse {
+ let response: Response = try await validateSourceWithHTTPInfo(
+ sourceCreate: sourceCreate,
+ requestOptions: requestOptions
+ )
+
+ guard let body = response.body else {
+ throw AlgoliaError.missingData
+ }
+
+ return body
+ }
+
+ // Validates a source payload to ensure it can be created and that the data source can be reached by Algolia.
+ // Required API Key ACLs:
+ // - addObject
+ // - deleteIndex
+ // - editSettings
+ //
+ // - parameter sourceCreate: (body) (optional)
+ // - returns: RequestBuilder
+
+ open func validateSourceWithHTTPInfo(
+ sourceCreate: SourceCreate? = nil,
+ requestOptions userRequestOptions: RequestOptions? = nil
+ ) async throws -> Response {
+ let resourcePath = "/1/sources/validate"
+ let body = sourceCreate
+ let queryParameters: [String: Any?]? = nil
+
+ let nillableHeaders: [String: Any?]? = nil
+
+ let headers = APIHelper.rejectNilHeaders(nillableHeaders)
+
+ return try await self.transporter.send(
+ method: "POST",
+ path: resourcePath,
+ data: body ?? AnyCodable(),
+ requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
+ )
+ }
+
+ /// - parameter sourceID: (path) Unique identifier of a source.
+ /// - parameter sourceUpdate: (body)
+ /// - returns: SourceValidateResponse
+ @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
+ open func validateSourceBeforeUpdate(
+ sourceID: String,
+ sourceUpdate: SourceUpdate,
+ requestOptions: RequestOptions? = nil
+ ) async throws -> SourceValidateResponse {
+ let response: Response = try await validateSourceBeforeUpdateWithHTTPInfo(
+ sourceID: sourceID,
+ sourceUpdate: sourceUpdate,
+ requestOptions: requestOptions
+ )
+
+ guard let body = response.body else {
+ throw AlgoliaError.missingData
+ }
+
+ return body
+ }
+
+ // Validates an update of a source payload to ensure it can be created and that the data source can be reached by
+ // Algolia.
+ // Required API Key ACLs:
+ // - addObject
+ // - deleteIndex
+ // - editSettings
+ //
+ // - parameter sourceID: (path) Unique identifier of a source.
+ //
+ // - parameter sourceUpdate: (body)
+ // - returns: RequestBuilder
+
+ open func validateSourceBeforeUpdateWithHTTPInfo(
+ sourceID: String,
+ sourceUpdate: SourceUpdate,
+ requestOptions userRequestOptions: RequestOptions? = nil
+ ) async throws -> Response {
+ guard !sourceID.isEmpty else {
+ throw AlgoliaError.invalidArgument("sourceID", "validateSourceBeforeUpdate")
+ }
+
+ var resourcePath = "/1/sources/{sourceID}/validate"
+ let sourceIDPreEscape = "\(APIHelper.mapValueToPathItem(sourceID))"
+ let sourceIDPostEscape = sourceIDPreEscape
+ .addingPercentEncoding(withAllowedCharacters: .urlPathAlgoliaAllowed) ?? ""
+ resourcePath = resourcePath.replacingOccurrences(
+ of: "{sourceID}",
+ with: sourceIDPostEscape,
+ options: .literal,
+ range: nil
+ )
+ let body = sourceUpdate
+ let queryParameters: [String: Any?]? = nil
+
+ let nillableHeaders: [String: Any?]? = nil
+
+ let headers = APIHelper.rejectNilHeaders(nillableHeaders)
+
+ return try await self.transporter.send(
+ method: "POST",
+ path: resourcePath,
+ data: body,
+ requestOptions: RequestOptions(headers: headers, queryParameters: queryParameters) + userRequestOptions
+ )
+ }
}
diff --git a/clients/algoliasearch-client-swift/Sources/Ingestion/Models/SourceValidateResponse.swift b/clients/algoliasearch-client-swift/Sources/Ingestion/Models/SourceValidateResponse.swift
new file mode 100644
index 0000000000..c319a63ca0
--- /dev/null
+++ b/clients/algoliasearch-client-swift/Sources/Ingestion/Models/SourceValidateResponse.swift
@@ -0,0 +1,60 @@
+// 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 Foundation
+#if canImport(Core)
+ import Core
+#endif
+
+public struct SourceValidateResponse: Codable, JSONEncodable {
+ /// Universally unique identifier (UUID) of a task run.
+ public var runID: String?
+ /// depending on the source type, the validation returns sampling data of your source (JSON, CSV, BigQuery).
+ public var data: [AnyCodable]?
+ /// in case of error, observability events will be added to the response, if any.
+ public var events: [Event]?
+ /// a message describing the outcome of a validate run.
+ public var message: String
+
+ public init(runID: String? = nil, data: [AnyCodable]? = nil, events: [Event]? = nil, message: String) {
+ self.runID = runID
+ self.data = data
+ self.events = events
+ self.message = message
+ }
+
+ public enum CodingKeys: String, CodingKey, CaseIterable {
+ case runID
+ case data
+ case events
+ case message
+ }
+
+ // Encodable protocol methods
+
+ public func encode(to encoder: Encoder) throws {
+ var container = encoder.container(keyedBy: CodingKeys.self)
+ try container.encodeIfPresent(self.runID, forKey: .runID)
+ try container.encodeIfPresent(self.data, forKey: .data)
+ try container.encodeIfPresent(self.events, forKey: .events)
+ try container.encode(self.message, forKey: .message)
+ }
+}
+
+extension SourceValidateResponse: Equatable {
+ public static func ==(lhs: SourceValidateResponse, rhs: SourceValidateResponse) -> Bool {
+ lhs.runID == rhs.runID &&
+ lhs.data == rhs.data &&
+ lhs.events == rhs.events &&
+ lhs.message == rhs.message
+ }
+}
+
+extension SourceValidateResponse: Hashable {
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(self.runID?.hashValue)
+ hasher.combine(self.data?.hashValue)
+ hasher.combine(self.events?.hashValue)
+ hasher.combine(self.message.hashValue)
+ }
+}
diff --git a/snippets/csharp/src/Ingestion.cs b/snippets/csharp/src/Ingestion.cs
index 34964b0c69..6294a4ae2d 100644
--- a/snippets/csharp/src/Ingestion.cs
+++ b/snippets/csharp/src/Ingestion.cs
@@ -775,4 +775,59 @@ public async Task SnippetForIngestionClientUpdateTask()
);
// SEPARATOR<
}
+
+ ///
+ /// Snippet for the ValidateSource method.
+ ///
+ /// validateSource
+ ///
+ public async Task SnippetForIngestionClientValidateSource()
+ {
+ // >SEPARATOR validateSource default
+ // Initialize the client
+ var client = new IngestionClient(
+ new IngestionConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
+ );
+
+ // Call the API
+ var response = await client.ValidateSourceAsync(
+ new SourceCreate
+ {
+ Type = Enum.Parse("Commercetools"),
+ Name = "sourceName",
+ Input = new SourceInput(
+ new SourceCommercetools
+ {
+ StoreKeys = new List { "myStore" },
+ Locales = new List { "de" },
+ Url = "http://commercetools.com",
+ ProjectKey = "keyID",
+ }
+ ),
+ AuthenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ }
+ );
+ // SEPARATOR<
+ }
+
+ ///
+ /// Snippet for the ValidateSourceBeforeUpdate method.
+ ///
+ /// validateSourceBeforeUpdate
+ ///
+ public async Task SnippetForIngestionClientValidateSourceBeforeUpdate()
+ {
+ // >SEPARATOR validateSourceBeforeUpdate default
+ // Initialize the client
+ var client = new IngestionClient(
+ new IngestionConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
+ );
+
+ // Call the API
+ var response = await client.ValidateSourceBeforeUpdateAsync(
+ "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ new SourceUpdate { Name = "newName", }
+ );
+ // SEPARATOR<
+ }
}
diff --git a/snippets/go/src/ingestion.go b/snippets/go/src/ingestion.go
index 419f44a9db..a169291cf7 100644
--- a/snippets/go/src/ingestion.go
+++ b/snippets/go/src/ingestion.go
@@ -1054,3 +1054,62 @@ func SnippetForUpdateTaskOfIngestion() {
print(response)
// SEPARATOR<
}
+func SnippetForValidateSourceOfIngestion() {
+ /*
+ Snippet for the validateSource method.
+
+ validateSource
+ */
+
+ // >SEPARATOR validateSource default
+ // Initialize the client with your application region, eg. ingestion.YOUR_APP_ID_REGION
+ client, err := ingestion.NewClient("YOUR_APP_ID", "YOUR_API_KEY", ingestion.US)
+ if err != nil {
+ // The client can fail to initialize if you pass an invalid parameter.
+ panic(err)
+ }
+
+ // Call the API
+ response, err := client.ValidateSource(client.NewApiValidateSourceRequest().WithSourceCreate(
+ ingestion.NewEmptySourceCreate().SetType(ingestion.SourceType("commercetools")).SetName("sourceName").SetInput(ingestion.SourceCommercetoolsAsSourceInput(
+ ingestion.NewEmptySourceCommercetools().SetStoreKeys(
+ []string{"myStore"}).SetLocales(
+ []string{"de"}).SetUrl("http://commercetools.com").SetProjectKey("keyID"))).SetAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f")))
+ if err != nil {
+ // handle the eventual error
+ panic(err)
+ }
+
+ // use the model directly
+ print(response)
+ // SEPARATOR<
+}
+func SnippetForValidateSourceBeforeUpdateOfIngestion() {
+ /*
+ Snippet for the validateSourceBeforeUpdate method.
+
+ validateSourceBeforeUpdate
+ */
+
+ // >SEPARATOR validateSourceBeforeUpdate default
+ // Initialize the client with your application region, eg. ingestion.YOUR_APP_ID_REGION
+ client, err := ingestion.NewClient("YOUR_APP_ID", "YOUR_API_KEY", ingestion.US)
+ if err != nil {
+ // The client can fail to initialize if you pass an invalid parameter.
+ panic(err)
+ }
+
+ // Call the API
+ response, err := client.ValidateSourceBeforeUpdate(client.NewApiValidateSourceBeforeUpdateRequest(
+ "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ ingestion.NewEmptySourceUpdate().SetName("newName"),
+ ))
+ if err != nil {
+ // handle the eventual error
+ panic(err)
+ }
+
+ // use the model directly
+ print(response)
+ // SEPARATOR<
+}
diff --git a/snippets/java/src/test/java/com/algolia/Ingestion.java b/snippets/java/src/test/java/com/algolia/Ingestion.java
index 6618f9c4d2..6b36d24b03 100644
--- a/snippets/java/src/test/java/com/algolia/Ingestion.java
+++ b/snippets/java/src/test/java/com/algolia/Ingestion.java
@@ -529,4 +529,42 @@ void snippetForUpdateTask() {
client.updateTask("6c02aeb1-775e-418e-870b-1faccd4b2c0f", new TaskUpdate().setEnabled(false));
// SEPARATOR<
}
+
+ // Snippet for the validateSource method.
+ //
+ // validateSource
+ void snippetForValidateSource() {
+ // >SEPARATOR validateSource default
+ // Initialize the client
+ IngestionClient client = new IngestionClient("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION");
+
+ // Call the API
+ client.validateSource(
+ new SourceCreate()
+ .setType(SourceType.COMMERCETOOLS)
+ .setName("sourceName")
+ .setInput(
+ new SourceCommercetools()
+ .setStoreKeys(List.of("myStore"))
+ .setLocales(List.of("de"))
+ .setUrl("http://commercetools.com")
+ .setProjectKey("keyID")
+ )
+ .setAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
+ );
+ // SEPARATOR<
+ }
+
+ // Snippet for the validateSourceBeforeUpdate method.
+ //
+ // validateSourceBeforeUpdate
+ void snippetForValidateSourceBeforeUpdate() {
+ // >SEPARATOR validateSourceBeforeUpdate default
+ // Initialize the client
+ IngestionClient client = new IngestionClient("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION");
+
+ // Call the API
+ client.validateSourceBeforeUpdate("6c02aeb1-775e-418e-870b-1faccd4b2c0f", new SourceUpdate().setName("newName"));
+ // SEPARATOR<
+ }
}
diff --git a/snippets/javascript/src/ingestion.ts b/snippets/javascript/src/ingestion.ts
index f4a759ed9b..e4fbdf53ec 100644
--- a/snippets/javascript/src/ingestion.ts
+++ b/snippets/javascript/src/ingestion.ts
@@ -838,3 +838,56 @@ export async function snippetForUpdateTask(): Promise {
console.log(response);
// SEPARATOR<
}
+
+// Snippet for the validateSource method.
+//
+// validateSource
+export async function snippetForValidateSource(): Promise {
+ // >SEPARATOR validateSource default
+ // Initialize the client
+ const client = ingestionClient(
+ 'YOUR_APP_ID',
+ 'YOUR_API_KEY',
+ 'YOUR_APP_ID_REGION'
+ );
+
+ // Call the API
+ const response = await client.validateSource({
+ type: 'commercetools',
+ name: 'sourceName',
+ input: {
+ storeKeys: ['myStore'],
+ locales: ['de'],
+ url: 'http://commercetools.com',
+ projectKey: 'keyID',
+ },
+ authenticationID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ });
+
+ // use typed response
+ console.log(response);
+ // SEPARATOR<
+}
+
+// Snippet for the validateSourceBeforeUpdate method.
+//
+// validateSourceBeforeUpdate
+export async function snippetForValidateSourceBeforeUpdate(): Promise {
+ // >SEPARATOR validateSourceBeforeUpdate default
+ // Initialize the client
+ const client = ingestionClient(
+ 'YOUR_APP_ID',
+ 'YOUR_API_KEY',
+ 'YOUR_APP_ID_REGION'
+ );
+
+ // Call the API
+ const response = await client.validateSourceBeforeUpdate({
+ sourceID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ sourceUpdate: { name: 'newName' },
+ });
+
+ // use typed response
+ console.log(response);
+ // SEPARATOR<
+}
diff --git a/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Ingestion.kt b/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Ingestion.kt
index 9d6f56871b..6fe6cc690d 100644
--- a/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Ingestion.kt
+++ b/snippets/kotlin/src/main/kotlin/com/algolia/snippets/Ingestion.kt
@@ -681,4 +681,51 @@ class SnippetIngestionClient {
exitProcess(0)
}
+
+ suspend fun snippetForValidateSource() {
+ // >SEPARATOR validateSource default
+ // Initialize the client
+ val client = IngestionClient(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")
+
+ // Call the API
+ var response = client.validateSource(
+ sourceCreate = SourceCreate(
+ type = SourceType.entries.first { it.value == "commercetools" },
+ name = "sourceName",
+ input = SourceCommercetools(
+ storeKeys = listOf("myStore"),
+ locales = listOf("de"),
+ url = "http://commercetools.com",
+ projectKey = "keyID",
+ ),
+ authenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ ),
+ )
+
+ // Use the response
+ println(response)
+ // SEPARATOR<
+
+ exitProcess(0)
+ }
+
+ suspend fun snippetForValidateSourceBeforeUpdate() {
+ // >SEPARATOR validateSourceBeforeUpdate default
+ // Initialize the client
+ val client = IngestionClient(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")
+
+ // Call the API
+ var response = client.validateSourceBeforeUpdate(
+ sourceID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ sourceUpdate = SourceUpdate(
+ name = "newName",
+ ),
+ )
+
+ // Use the response
+ println(response)
+ // SEPARATOR<
+
+ exitProcess(0)
+ }
}
diff --git a/snippets/php/src/Ingestion.php b/snippets/php/src/Ingestion.php
index c2723bc098..ecbaa00533 100644
--- a/snippets/php/src/Ingestion.php
+++ b/snippets/php/src/Ingestion.php
@@ -836,4 +836,60 @@ public function snippetForUpdateTask()
var_dump($response);
// SEPARATOR<
}
+
+ /**
+ * Snippet for the ValidateSource method.
+ *
+ * validateSource
+ */
+ public function snippetForValidateSource()
+ {
+ // >SEPARATOR validateSource default
+ // Initialize the client
+ $client = IngestionClient::create('', '', 'YOUR_APP_ID_REGION');
+
+ // Call the API
+ $response = $client->validateSource(
+ ['type' => 'commercetools',
+ 'name' => 'sourceName',
+ 'input' => ['storeKeys' => [
+ 'myStore',
+ ],
+ 'locales' => [
+ 'de',
+ ],
+ 'url' => 'http://commercetools.com',
+ 'projectKey' => 'keyID',
+ ],
+ 'authenticationID' => '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ ],
+ );
+
+ // play with the response
+ var_dump($response);
+ // SEPARATOR<
+ }
+
+ /**
+ * Snippet for the ValidateSourceBeforeUpdate method.
+ *
+ * validateSourceBeforeUpdate
+ */
+ public function snippetForValidateSourceBeforeUpdate()
+ {
+ // >SEPARATOR validateSourceBeforeUpdate default
+ // Initialize the client
+ $client = IngestionClient::create('', '', 'YOUR_APP_ID_REGION');
+
+ // Call the API
+ $response = $client->validateSourceBeforeUpdate(
+ '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ ['name' => 'newName',
+ ],
+ );
+
+ // play with the response
+ var_dump($response);
+ // SEPARATOR<
+ }
}
diff --git a/snippets/python/ingestion.py b/snippets/python/ingestion.py
index 3755c6a48f..923cda3ea4 100644
--- a/snippets/python/ingestion.py
+++ b/snippets/python/ingestion.py
@@ -913,3 +913,66 @@ async def snippet_for_update_task():
# print the JSON response
print(response.to_json())
# SEPARATOR<
+
+
+async def snippet_for_validate_source():
+ """
+ Snippet for the validateSource method.
+
+ validateSource
+ """
+ # >SEPARATOR validateSource default
+ # Initialize the client
+ _client = IngestionClient("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
+
+ # Call the API
+ response = await _client.validate_source(
+ source_create={
+ "type": "commercetools",
+ "name": "sourceName",
+ "input": {
+ "storeKeys": [
+ "myStore",
+ ],
+ "locales": [
+ "de",
+ ],
+ "url": "http://commercetools.com",
+ "projectKey": "keyID",
+ },
+ "authenticationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ },
+ )
+
+ # use the class directly
+ print(response)
+
+ # print the JSON response
+ print(response.to_json())
+ # SEPARATOR<
+
+
+async def snippet_for_validate_source_before_update():
+ """
+ Snippet for the validateSourceBeforeUpdate method.
+
+ validateSourceBeforeUpdate
+ """
+ # >SEPARATOR validateSourceBeforeUpdate default
+ # Initialize the client
+ _client = IngestionClient("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
+
+ # Call the API
+ response = await _client.validate_source_before_update(
+ source_id="6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ source_update={
+ "name": "newName",
+ },
+ )
+
+ # use the class directly
+ print(response)
+
+ # print the JSON response
+ print(response.to_json())
+ # SEPARATOR<
diff --git a/snippets/ruby/ingestion.rb b/snippets/ruby/ingestion.rb
index 84fa3787fc..b9908aef0f 100644
--- a/snippets/ruby/ingestion.rb
+++ b/snippets/ruby/ingestion.rb
@@ -776,3 +776,56 @@ def snippet_for_update_task
puts response.to_json
# SEPARATOR<
end
+
+# Snippet for the validateSource method.
+#
+# validateSource
+def snippet_for_validate_source
+ # >SEPARATOR validateSource default
+ # Initialize the client
+ client = Algolia::IngestionClient.create('YOUR_APP_ID', 'YOUR_API_KEY', 'YOUR_APP_ID_REGION')
+
+ # Call the API
+ response = client.validate_source(
+ SourceCreate.new(
+ type: 'commercetools',
+ name: "sourceName",
+ input: SourceCommercetools.new(
+ store_keys: ["myStore"],
+ locales: ["de"],
+ url: "http://commercetools.com",
+ project_key: "keyID"
+ ),
+ authentication_id: "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
+ )
+ )
+
+ # use the class directly
+ puts response
+
+ # print the JSON response
+ puts response.to_json
+ # SEPARATOR<
+end
+
+# Snippet for the validateSourceBeforeUpdate method.
+#
+# validateSourceBeforeUpdate
+def snippet_for_validate_source_before_update
+ # >SEPARATOR validateSourceBeforeUpdate default
+ # Initialize the client
+ client = Algolia::IngestionClient.create('YOUR_APP_ID', 'YOUR_API_KEY', 'YOUR_APP_ID_REGION')
+
+ # Call the API
+ response = client.validate_source_before_update(
+ "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ SourceUpdate.new(name: "newName")
+ )
+
+ # use the class directly
+ puts response
+
+ # print the JSON response
+ puts response.to_json
+ # SEPARATOR<
+end
diff --git a/snippets/scala/src/main/scala/Ingestion.scala b/snippets/scala/src/main/scala/Ingestion.scala
index 8d200757ea..913302e116 100644
--- a/snippets/scala/src/main/scala/Ingestion.scala
+++ b/snippets/scala/src/main/scala/Ingestion.scala
@@ -771,4 +771,57 @@ class SnippetIngestionClient {
// SEPARATOR<
}
+ /** Snippet for the validateSource method.
+ *
+ * validateSource
+ */
+ def snippetForIngestionClientValidateSource(): Unit = {
+ // >SEPARATOR validateSource default
+ // Initialize the client
+ val client = IngestionClient(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")
+
+ // Call the API
+ val response = client.validateSource(
+ sourceCreate = Some(
+ SourceCreate(
+ `type` = SourceType.withName("commercetools"),
+ name = "sourceName",
+ input = SourceCommercetools(
+ storeKeys = Some(Seq("myStore")),
+ locales = Some(Seq("de")),
+ url = "http://commercetools.com",
+ projectKey = "keyID"
+ ),
+ authenticationID = Some("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
+ )
+ )
+ )
+
+ // Use the response
+ val value = Await.result(response, Duration(100, "sec"))
+ // SEPARATOR<
+ }
+
+ /** Snippet for the validateSourceBeforeUpdate method.
+ *
+ * validateSourceBeforeUpdate
+ */
+ def snippetForIngestionClientValidateSourceBeforeUpdate(): Unit = {
+ // >SEPARATOR validateSourceBeforeUpdate default
+ // Initialize the client
+ val client = IngestionClient(appId = "YOUR_APP_ID", apiKey = "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")
+
+ // Call the API
+ val response = client.validateSourceBeforeUpdate(
+ sourceID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ sourceUpdate = SourceUpdate(
+ name = Some("newName")
+ )
+ )
+
+ // Use the response
+ val value = Await.result(response, Duration(100, "sec"))
+ // SEPARATOR<
+ }
+
}
diff --git a/snippets/swift/Sources/Ingestion.swift b/snippets/swift/Sources/Ingestion.swift
index 28563063df..a48f4da5de 100644
--- a/snippets/swift/Sources/Ingestion.swift
+++ b/snippets/swift/Sources/Ingestion.swift
@@ -540,4 +540,43 @@ final class IngestionClientSnippet {
)
// SEPARATOR<
}
+
+ /// Snippet for the validateSource method.
+ ///
+ /// validateSource
+ func snippetForValidateSource() async throws {
+ // >SEPARATOR validateSource default
+ // Initialize the client
+ let client = try IngestionClient(appID: "YOUR_APP_ID", apiKey: "YOUR_API_KEY", region: .us)
+
+ // Call the API
+ let response = try await client.validateSource(sourceCreate: SourceCreate(
+ type: SourceType.commercetools,
+ name: "sourceName",
+ input: SourceInput.sourceCommercetools(SourceCommercetools(
+ storeKeys: ["myStore"],
+ locales: ["de"],
+ url: "http://commercetools.com",
+ projectKey: "keyID"
+ )),
+ authenticationID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
+ ))
+ // SEPARATOR<
+ }
+
+ /// Snippet for the validateSourceBeforeUpdate method.
+ ///
+ /// validateSourceBeforeUpdate
+ func snippetForValidateSourceBeforeUpdate() async throws {
+ // >SEPARATOR validateSourceBeforeUpdate default
+ // Initialize the client
+ let client = try IngestionClient(appID: "YOUR_APP_ID", apiKey: "YOUR_API_KEY", region: .us)
+
+ // Call the API
+ let response = try await client.validateSourceBeforeUpdate(
+ sourceID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ sourceUpdate: SourceUpdate(name: "newName")
+ )
+ // SEPARATOR<
+ }
}
diff --git a/specs/bundled/ingestion.doc.yml b/specs/bundled/ingestion.doc.yml
index a3081aef8e..6f52a7ea2d 100644
--- a/specs/bundled/ingestion.doc.yml
+++ b/specs/bundled/ingestion.doc.yml
@@ -4329,6 +4329,328 @@ paths:
)),
authenticationID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
))
+ /1/sources/validate:
+ post:
+ tags:
+ - sources
+ summary: Validates a source payload
+ description: >
+ Validates a source payload to ensure it can be created and that the data
+ source can be reached by Algolia.
+ operationId: validateSource
+ x-acl:
+ - addObject
+ - deleteIndex
+ - editSettings
+ requestBody:
+ description: ''
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SourceCreate'
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SourceValidateResponse'
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ x-codeSamples:
+ - lang: csharp
+ label: C#
+ source: |
+ // Initialize the client
+ var client = new IngestionClient(
+ new IngestionConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
+ );
+
+ // Call the API
+ var response = await client.ValidateSourceAsync(
+ new SourceCreate
+ {
+ Type = Enum.Parse("Commercetools"),
+ Name = "sourceName",
+ Input = new SourceInput(
+ new SourceCommercetools
+ {
+ StoreKeys = new List { "myStore" },
+ Locales = new List { "de" },
+ Url = "http://commercetools.com",
+ ProjectKey = "keyID",
+ }
+ ),
+ AuthenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ }
+ );
+ - lang: go
+ label: Go
+ source: >
+ // Initialize the client with your application region, eg.
+ ingestion.YOUR_APP_ID_REGION
+
+ client, err := ingestion.NewClient("YOUR_APP_ID", "YOUR_API_KEY",
+ ingestion.US)
+
+ if err != nil {
+ // The client can fail to initialize if you pass an invalid parameter.
+ panic(err)
+ }
+
+
+ // Call the API
+
+ response, err :=
+ client.ValidateSource(client.NewApiValidateSourceRequest().WithSourceCreate(
+ ingestion.NewEmptySourceCreate().SetType(ingestion.SourceType("commercetools")).SetName("sourceName").SetInput(ingestion.SourceCommercetoolsAsSourceInput(
+ ingestion.NewEmptySourceCommercetools().SetStoreKeys(
+ []string{"myStore"}).SetLocales(
+ []string{"de"}).SetUrl("http://commercetools.com").SetProjectKey("keyID"))).SetAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f")))
+ if err != nil {
+ // handle the eventual error
+ panic(err)
+ }
+
+
+ // use the model directly
+
+ print(response)
+ - lang: java
+ label: Java
+ source: >
+ // Initialize the client
+
+ IngestionClient client = new IngestionClient("YOUR_APP_ID",
+ "YOUR_API_KEY", "YOUR_APP_ID_REGION");
+
+
+ // Call the API
+
+ client.validateSource(
+ new SourceCreate()
+ .setType(SourceType.COMMERCETOOLS)
+ .setName("sourceName")
+ .setInput(
+ new SourceCommercetools()
+ .setStoreKeys(List.of("myStore"))
+ .setLocales(List.of("de"))
+ .setUrl("http://commercetools.com")
+ .setProjectKey("keyID")
+ )
+ .setAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
+ );
+ - lang: javascript
+ label: JavaScript
+ source: |
+ // Initialize the client
+ const client = ingestionClient(
+ 'YOUR_APP_ID',
+ 'YOUR_API_KEY',
+ 'YOUR_APP_ID_REGION'
+ );
+
+ // Call the API
+ const response = await client.validateSource({
+ type: 'commercetools',
+ name: 'sourceName',
+ input: {
+ storeKeys: ['myStore'],
+ locales: ['de'],
+ url: 'http://commercetools.com',
+ projectKey: 'keyID',
+ },
+ authenticationID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ });
+
+ // use typed response
+ console.log(response);
+ - lang: kotlin
+ label: Kotlin
+ source: >
+ // Initialize the client
+
+ val client = IngestionClient(appId = "YOUR_APP_ID", apiKey =
+ "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")
+
+
+ // Call the API
+
+ var response = client.validateSource(
+ sourceCreate = SourceCreate(
+ type = SourceType.entries.first { it.value == "commercetools" },
+ name = "sourceName",
+ input = SourceCommercetools(
+ storeKeys = listOf("myStore"),
+ locales = listOf("de"),
+ url = "http://commercetools.com",
+ projectKey = "keyID",
+ ),
+ authenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ ),
+ )
+
+
+ // Use the response
+
+ println(response)
+ - lang: php
+ label: PHP
+ source: >
+ // Initialize the client
+
+ $client = IngestionClient::create('', '',
+ 'YOUR_APP_ID_REGION');
+
+
+ // Call the API
+
+ $response = $client->validateSource(
+ ['type' => 'commercetools',
+ 'name' => 'sourceName',
+ 'input' => ['storeKeys' => [
+ 'myStore',
+ ],
+ 'locales' => [
+ 'de',
+ ],
+ 'url' => 'http://commercetools.com',
+ 'projectKey' => 'keyID',
+ ],
+ 'authenticationID' => '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ ],
+ );
+
+
+ // play with the response
+
+ var_dump($response);
+ - lang: python
+ label: Python
+ source: >
+ # Initialize the client
+
+ _client = IngestionClient("YOUR_APP_ID", "YOUR_API_KEY",
+ "YOUR_APP_ID_REGION")
+
+
+ # Call the API
+
+ response = await _client.validate_source(
+ source_create={
+ "type": "commercetools",
+ "name": "sourceName",
+ "input": {
+ "storeKeys": [
+ "myStore",
+ ],
+ "locales": [
+ "de",
+ ],
+ "url": "http://commercetools.com",
+ "projectKey": "keyID",
+ },
+ "authenticationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ },
+ )
+
+
+ # use the class directly
+
+ print(response)
+
+
+ # print the JSON response
+
+ print(response.to_json())
+ - lang: ruby
+ label: Ruby
+ source: >
+ # Initialize the client
+
+ client = Algolia::IngestionClient.create('YOUR_APP_ID',
+ 'YOUR_API_KEY', 'YOUR_APP_ID_REGION')
+
+
+ # Call the API
+
+ response = client.validate_source(
+ SourceCreate.new(
+ type: 'commercetools',
+ name: "sourceName",
+ input: SourceCommercetools.new(
+ store_keys: ["myStore"],
+ locales: ["de"],
+ url: "http://commercetools.com",
+ project_key: "keyID"
+ ),
+ authentication_id: "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
+ )
+ )
+
+
+ # use the class directly
+
+ puts response
+
+
+ # print the JSON response
+
+ puts response.to_json
+ - lang: scala
+ label: Scala
+ source: >
+ // Initialize the client
+
+ val client = IngestionClient(appId = "YOUR_APP_ID", apiKey =
+ "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")
+
+
+ // Call the API
+
+ val response = client.validateSource(
+ sourceCreate = Some(
+ SourceCreate(
+ `type` = SourceType.withName("commercetools"),
+ name = "sourceName",
+ input = SourceCommercetools(
+ storeKeys = Some(Seq("myStore")),
+ locales = Some(Seq("de")),
+ url = "http://commercetools.com",
+ projectKey = "keyID"
+ ),
+ authenticationID = Some("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
+ )
+ )
+ )
+
+
+ // Use the response
+
+ val value = Await.result(response, Duration(100, "sec"))
+ - lang: swift
+ label: Swift
+ source: >
+ // Initialize the client
+
+ let client = try IngestionClient(appID: "YOUR_APP_ID", apiKey:
+ "YOUR_API_KEY", region: .us)
+
+
+ // Call the API
+
+ let response = try await client.validateSource(sourceCreate:
+ SourceCreate(
+ type: SourceType.commercetools,
+ name: "sourceName",
+ input: SourceInput.sourceCommercetools(SourceCommercetools(
+ storeKeys: ["myStore"],
+ locales: ["de"],
+ url: "http://commercetools.com",
+ projectKey: "keyID"
+ )),
+ authenticationID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
+ ))
/1/sources/search:
post:
tags:
@@ -4820,23 +5142,256 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/SourceUpdateResponse'
+ $ref: '#/components/schemas/SourceUpdateResponse'
+ '400':
+ $ref: '#/components/responses/BadRequest'
+ x-codeSamples:
+ - lang: csharp
+ label: C#
+ source: |
+ // Initialize the client
+ var client = new IngestionClient(
+ new IngestionConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
+ );
+
+ // Call the API
+ var response = await client.UpdateSourceAsync(
+ "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ new SourceUpdate { Name = "newName", }
+ );
+ - lang: go
+ label: Go
+ source: >
+ // Initialize the client with your application region, eg.
+ ingestion.YOUR_APP_ID_REGION
+
+ client, err := ingestion.NewClient("YOUR_APP_ID", "YOUR_API_KEY",
+ ingestion.US)
+
+ if err != nil {
+ // The client can fail to initialize if you pass an invalid parameter.
+ panic(err)
+ }
+
+
+ // Call the API
+
+ response, err :=
+ client.UpdateSource(client.NewApiUpdateSourceRequest(
+ "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ ingestion.NewEmptySourceUpdate().SetName("newName"),
+ ))
+
+ if err != nil {
+ // handle the eventual error
+ panic(err)
+ }
+
+
+ // use the model directly
+
+ print(response)
+ - lang: java
+ label: Java
+ source: >
+ // Initialize the client
+
+ IngestionClient client = new IngestionClient("YOUR_APP_ID",
+ "YOUR_API_KEY", "YOUR_APP_ID_REGION");
+
+
+ // Call the API
+
+ client.updateSource("6c02aeb1-775e-418e-870b-1faccd4b2c0f", new
+ SourceUpdate().setName("newName"));
+ - lang: javascript
+ label: JavaScript
+ source: |
+ // Initialize the client
+ const client = ingestionClient(
+ 'YOUR_APP_ID',
+ 'YOUR_API_KEY',
+ 'YOUR_APP_ID_REGION'
+ );
+
+ // Call the API
+ const response = await client.updateSource({
+ sourceID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ sourceUpdate: { name: 'newName' },
+ });
+
+ // use typed response
+ console.log(response);
+ - lang: kotlin
+ label: Kotlin
+ source: >
+ // Initialize the client
+
+ val client = IngestionClient(appId = "YOUR_APP_ID", apiKey =
+ "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")
+
+
+ // Call the API
+
+ var response = client.updateSource(
+ sourceID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ sourceUpdate = SourceUpdate(
+ name = "newName",
+ ),
+ )
+
+
+ // Use the response
+
+ println(response)
+ - lang: php
+ label: PHP
+ source: >
+ // Initialize the client
+
+ $client = IngestionClient::create('', '',
+ 'YOUR_APP_ID_REGION');
+
+
+ // Call the API
+
+ $response = $client->updateSource(
+ '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ ['name' => 'newName',
+ ],
+ );
+
+
+ // play with the response
+
+ var_dump($response);
+ - lang: python
+ label: Python
+ source: >
+ # Initialize the client
+
+ _client = IngestionClient("YOUR_APP_ID", "YOUR_API_KEY",
+ "YOUR_APP_ID_REGION")
+
+
+ # Call the API
+
+ response = await _client.update_source(
+ source_id="6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ source_update={
+ "name": "newName",
+ },
+ )
+
+
+ # use the class directly
+
+ print(response)
+
+
+ # print the JSON response
+
+ print(response.to_json())
+ - lang: ruby
+ label: Ruby
+ source: >
+ # Initialize the client
+
+ client = Algolia::IngestionClient.create('YOUR_APP_ID',
+ 'YOUR_API_KEY', 'YOUR_APP_ID_REGION')
+
+
+ # Call the API
+
+ response = client.update_source(
+ "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ SourceUpdate.new(name: "newName")
+ )
+
+
+ # use the class directly
+
+ puts response
+
+
+ # print the JSON response
+
+ puts response.to_json
+ - lang: scala
+ label: Scala
+ source: >
+ // Initialize the client
+
+ val client = IngestionClient(appId = "YOUR_APP_ID", apiKey =
+ "YOUR_API_KEY", region = "YOUR_APP_ID_REGION")
+
+
+ // Call the API
+
+ val response = client.updateSource(
+ sourceID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ sourceUpdate = SourceUpdate(
+ name = Some("newName")
+ )
+ )
+
+
+ // Use the response
+
+ val value = Await.result(response, Duration(100, "sec"))
+ - lang: swift
+ label: Swift
+ source: >
+ // Initialize the client
+
+ let client = try IngestionClient(appID: "YOUR_APP_ID", apiKey:
+ "YOUR_API_KEY", region: .us)
+
+
+ // Call the API
+
+ let response = try await client.updateSource(
+ sourceID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ sourceUpdate: SourceUpdate(name: "newName")
+ )
+ delete:
+ tags:
+ - sources
+ summary: Delete a source
+ description: >-
+ Deletes a source by its ID. You can't delete sources that are referenced
+ in tasks.
+ operationId: deleteSource
+ x-acl:
+ - addObject
+ - deleteIndex
+ - editSettings
+ parameters:
+ - $ref: '#/components/parameters/pathSourceID'
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/DeleteResponse'
'400':
$ref: '#/components/responses/BadRequest'
x-codeSamples:
- lang: csharp
label: C#
- source: |
+ source: >
// Initialize the client
+
var client = new IngestionClient(
new IngestionConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);
+
// Call the API
- var response = await client.UpdateSourceAsync(
- "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
- new SourceUpdate { Name = "newName", }
- );
+
+ var response = await
+ client.DeleteSourceAsync("6c02aeb1-775e-418e-870b-1faccd4b2c0f");
- lang: go
label: Go
source: >
@@ -4855,9 +5410,8 @@ paths:
// Call the API
response, err :=
- client.UpdateSource(client.NewApiUpdateSourceRequest(
+ client.DeleteSource(client.NewApiDeleteSourceRequest(
"6c02aeb1-775e-418e-870b-1faccd4b2c0f",
- ingestion.NewEmptySourceUpdate().SetName("newName"),
))
if err != nil {
@@ -4880,8 +5434,7 @@ paths:
// Call the API
- client.updateSource("6c02aeb1-775e-418e-870b-1faccd4b2c0f", new
- SourceUpdate().setName("newName"));
+ client.deleteSource("6c02aeb1-775e-418e-870b-1faccd4b2c0f");
- lang: javascript
label: JavaScript
source: |
@@ -4893,9 +5446,8 @@ paths:
);
// Call the API
- const response = await client.updateSource({
+ const response = await client.deleteSource({
sourceID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
- sourceUpdate: { name: 'newName' },
});
// use typed response
@@ -4911,11 +5463,8 @@ paths:
// Call the API
- var response = client.updateSource(
+ var response = client.deleteSource(
sourceID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
- sourceUpdate = SourceUpdate(
- name = "newName",
- ),
)
@@ -4933,10 +5482,8 @@ paths:
// Call the API
- $response = $client->updateSource(
+ $response = $client->deleteSource(
'6c02aeb1-775e-418e-870b-1faccd4b2c0f',
- ['name' => 'newName',
- ],
);
@@ -4954,11 +5501,8 @@ paths:
# Call the API
- response = await _client.update_source(
+ response = await _client.delete_source(
source_id="6c02aeb1-775e-418e-870b-1faccd4b2c0f",
- source_update={
- "name": "newName",
- },
)
@@ -4981,10 +5525,8 @@ paths:
# Call the API
- response = client.update_source(
- "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
- SourceUpdate.new(name: "newName")
- )
+ response =
+ client.delete_source("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
# use the class directly
@@ -5006,11 +5548,8 @@ paths:
// Call the API
- val response = client.updateSource(
- sourceID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
- sourceUpdate = SourceUpdate(
- name = Some("newName")
- )
+ val response = client.deleteSource(
+ sourceID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
)
@@ -5028,48 +5567,52 @@ paths:
// Call the API
- let response = try await client.updateSource(
- sourceID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
- sourceUpdate: SourceUpdate(name: "newName")
- )
- delete:
+ let response = try await client.deleteSource(sourceID:
+ "6c02aeb1-775e-418e-870b-1faccd4b2c0f")
+ /1/sources/{sourceID}/validate:
+ post:
tags:
- sources
- summary: Delete a source
- description: >-
- Deletes a source by its ID. You can't delete sources that are referenced
- in tasks.
- operationId: deleteSource
+ summary: Validates an update of a source payload
+ description: >
+ Validates an update of a source payload to ensure it can be created and
+ that the data source can be reached by Algolia.
+ operationId: validateSourceBeforeUpdate
x-acl:
- addObject
- deleteIndex
- editSettings
parameters:
- $ref: '#/components/parameters/pathSourceID'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SourceUpdate'
+ required: true
responses:
'200':
description: OK
content:
application/json:
schema:
- $ref: '#/components/schemas/DeleteResponse'
+ $ref: '#/components/schemas/SourceValidateResponse'
'400':
$ref: '#/components/responses/BadRequest'
x-codeSamples:
- lang: csharp
label: C#
- source: >
+ source: |
// Initialize the client
-
var client = new IngestionClient(
new IngestionConfig("YOUR_APP_ID", "YOUR_API_KEY", "YOUR_APP_ID_REGION")
);
-
// Call the API
-
- var response = await
- client.DeleteSourceAsync("6c02aeb1-775e-418e-870b-1faccd4b2c0f");
+ var response = await client.ValidateSourceBeforeUpdateAsync(
+ "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ new SourceUpdate { Name = "newName", }
+ );
- lang: go
label: Go
source: >
@@ -5088,8 +5631,9 @@ paths:
// Call the API
response, err :=
- client.DeleteSource(client.NewApiDeleteSourceRequest(
+ client.ValidateSourceBeforeUpdate(client.NewApiValidateSourceBeforeUpdateRequest(
"6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ ingestion.NewEmptySourceUpdate().SetName("newName"),
))
if err != nil {
@@ -5112,7 +5656,8 @@ paths:
// Call the API
- client.deleteSource("6c02aeb1-775e-418e-870b-1faccd4b2c0f");
+ client.validateSourceBeforeUpdate("6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ new SourceUpdate().setName("newName"));
- lang: javascript
label: JavaScript
source: |
@@ -5124,8 +5669,9 @@ paths:
);
// Call the API
- const response = await client.deleteSource({
+ const response = await client.validateSourceBeforeUpdate({
sourceID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ sourceUpdate: { name: 'newName' },
});
// use typed response
@@ -5141,8 +5687,11 @@ paths:
// Call the API
- var response = client.deleteSource(
+ var response = client.validateSourceBeforeUpdate(
sourceID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ sourceUpdate = SourceUpdate(
+ name = "newName",
+ ),
)
@@ -5160,8 +5709,10 @@ paths:
// Call the API
- $response = $client->deleteSource(
+ $response = $client->validateSourceBeforeUpdate(
'6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ ['name' => 'newName',
+ ],
);
@@ -5179,8 +5730,11 @@ paths:
# Call the API
- response = await _client.delete_source(
+ response = await _client.validate_source_before_update(
source_id="6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ source_update={
+ "name": "newName",
+ },
)
@@ -5203,8 +5757,10 @@ paths:
# Call the API
- response =
- client.delete_source("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
+ response = client.validate_source_before_update(
+ "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ SourceUpdate.new(name: "newName")
+ )
# use the class directly
@@ -5226,8 +5782,11 @@ paths:
// Call the API
- val response = client.deleteSource(
- sourceID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
+ val response = client.validateSourceBeforeUpdate(
+ sourceID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ sourceUpdate = SourceUpdate(
+ name = Some("newName")
+ )
)
@@ -5245,8 +5804,10 @@ paths:
// Call the API
- let response = try await client.deleteSource(sourceID:
- "6c02aeb1-775e-418e-870b-1faccd4b2c0f")
+ let response = try await client.validateSourceBeforeUpdate(
+ sourceID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ sourceUpdate: SourceUpdate(name: "newName")
+ )
/1/sources/{sourceID}/discover:
get:
tags:
@@ -9994,6 +10555,93 @@ components:
- sourceID
- name
- createdAt
+ runID:
+ type: string
+ description: Universally unique identifier (UUID) of a task run.
+ example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
+ eventID:
+ type: string
+ description: Universally unique identifier (UUID) of an event.
+ example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
+ EventStatus:
+ type: string
+ enum:
+ - created
+ - started
+ - retried
+ - failed
+ - succeeded
+ - critical
+ EventType:
+ type: string
+ enum:
+ - fetch
+ - record
+ - log
+ - transform
+ publishedAt:
+ type: string
+ description: Date of publish RFC 3339 format.
+ Event:
+ type: object
+ description: An event describe a step of the task execution flow..
+ additionalProperties: false
+ properties:
+ eventID:
+ $ref: '#/components/schemas/eventID'
+ runID:
+ $ref: '#/components/schemas/runID'
+ parentID:
+ type: string
+ description: The parent event, the cause of this event.
+ example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
+ status:
+ $ref: '#/components/schemas/EventStatus'
+ type:
+ $ref: '#/components/schemas/EventType'
+ batchSize:
+ type: integer
+ description: The extracted record batch size.
+ example: 10
+ minimum: 0
+ multipleOf: 1
+ data:
+ type: object
+ additionalProperties: true
+ publishedAt:
+ $ref: '#/components/schemas/publishedAt'
+ required:
+ - eventID
+ - runID
+ - status
+ - type
+ - batchSize
+ - publishedAt
+ SourceValidateResponse:
+ type: object
+ additionalProperties: false
+ properties:
+ runID:
+ $ref: '#/components/schemas/runID'
+ data:
+ type: array
+ description: >-
+ depending on the source type, the validation returns sampling data
+ of your source (JSON, CSV, BigQuery).
+ items:
+ type: object
+ events:
+ description: >-
+ in case of error, observability events will be added to the
+ response, if any.
+ type: array
+ items:
+ $ref: '#/components/schemas/Event'
+ message:
+ description: a message describing the outcome of a validate run.
+ type: string
+ required:
+ - message
SourceSearch:
type: object
additionalProperties: false
@@ -10090,10 +10738,6 @@ components:
DockerSourceStream:
type: object
description: Stream definition (see the Singer specification for details).
- runID:
- type: string
- description: Universally unique identifier (UUID) of a task run.
- example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
ActionType:
type: string
description: Action to perform on the Algolia index.
@@ -10689,22 +11333,6 @@ components:
- runs
- pagination
- window
- EventStatus:
- type: string
- enum:
- - created
- - started
- - retried
- - failed
- - succeeded
- - critical
- EventType:
- type: string
- enum:
- - fetch
- - record
- - log
- - transform
eventSortKeys:
type: string
description: Property by which to sort the list of task run events.
@@ -10712,48 +11340,6 @@ components:
- status
- type
- publishedAt
- eventID:
- type: string
- description: Universally unique identifier (UUID) of an event.
- example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
- publishedAt:
- type: string
- description: Date of publish RFC 3339 format.
- Event:
- type: object
- description: An event describe a step of the task execution flow..
- additionalProperties: false
- properties:
- eventID:
- $ref: '#/components/schemas/eventID'
- runID:
- $ref: '#/components/schemas/runID'
- parentID:
- type: string
- description: The parent event, the cause of this event.
- example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
- status:
- $ref: '#/components/schemas/EventStatus'
- type:
- $ref: '#/components/schemas/EventType'
- batchSize:
- type: integer
- description: The extracted record batch size.
- example: 10
- minimum: 0
- multipleOf: 1
- data:
- type: object
- additionalProperties: true
- publishedAt:
- $ref: '#/components/schemas/publishedAt'
- required:
- - eventID
- - runID
- - status
- - type
- - batchSize
- - publishedAt
responses:
BadRequest:
description: Bad request or request arguments.
diff --git a/specs/bundled/ingestion.yml b/specs/bundled/ingestion.yml
index 2e4bfdbaf3..992c316543 100644
--- a/specs/bundled/ingestion.yml
+++ b/specs/bundled/ingestion.yml
@@ -636,6 +636,34 @@ paths:
$ref: '#/components/schemas/SourceCreateResponse'
'400':
$ref: '#/components/responses/BadRequest'
+ /1/sources/validate:
+ post:
+ tags:
+ - ingestion
+ summary: Validates a source payload
+ description: >
+ Validates a source payload to ensure it can be created and that the data
+ source can be reached by Algolia.
+ operationId: validateSource
+ x-acl:
+ - addObject
+ - deleteIndex
+ - editSettings
+ requestBody:
+ description: ''
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SourceCreate'
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SourceValidateResponse'
+ '400':
+ $ref: '#/components/responses/BadRequest'
/1/sources/search:
post:
tags:
@@ -737,6 +765,36 @@ paths:
$ref: '#/components/schemas/DeleteResponse'
'400':
$ref: '#/components/responses/BadRequest'
+ /1/sources/{sourceID}/validate:
+ post:
+ tags:
+ - ingestion
+ summary: Validates an update of a source payload
+ description: >
+ Validates an update of a source payload to ensure it can be created and
+ that the data source can be reached by Algolia.
+ operationId: validateSourceBeforeUpdate
+ x-acl:
+ - addObject
+ - deleteIndex
+ - editSettings
+ parameters:
+ - $ref: '#/components/parameters/pathSourceID'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SourceUpdate'
+ required: true
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SourceValidateResponse'
+ '400':
+ $ref: '#/components/responses/BadRequest'
/1/sources/{sourceID}/discover:
get:
tags:
@@ -2528,6 +2586,93 @@ components:
- sourceID
- name
- createdAt
+ runID:
+ type: string
+ description: Universally unique identifier (UUID) of a task run.
+ example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
+ eventID:
+ type: string
+ description: Universally unique identifier (UUID) of an event.
+ example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
+ EventStatus:
+ type: string
+ enum:
+ - created
+ - started
+ - retried
+ - failed
+ - succeeded
+ - critical
+ EventType:
+ type: string
+ enum:
+ - fetch
+ - record
+ - log
+ - transform
+ publishedAt:
+ type: string
+ description: Date of publish RFC 3339 format.
+ Event:
+ type: object
+ description: An event describe a step of the task execution flow..
+ additionalProperties: false
+ properties:
+ eventID:
+ $ref: '#/components/schemas/eventID'
+ runID:
+ $ref: '#/components/schemas/runID'
+ parentID:
+ type: string
+ description: The parent event, the cause of this event.
+ example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
+ status:
+ $ref: '#/components/schemas/EventStatus'
+ type:
+ $ref: '#/components/schemas/EventType'
+ batchSize:
+ type: integer
+ description: The extracted record batch size.
+ example: 10
+ minimum: 0
+ multipleOf: 1
+ data:
+ type: object
+ additionalProperties: true
+ publishedAt:
+ $ref: '#/components/schemas/publishedAt'
+ required:
+ - eventID
+ - runID
+ - status
+ - type
+ - batchSize
+ - publishedAt
+ SourceValidateResponse:
+ type: object
+ additionalProperties: false
+ properties:
+ runID:
+ $ref: '#/components/schemas/runID'
+ data:
+ type: array
+ description: >-
+ depending on the source type, the validation returns sampling data
+ of your source (JSON, CSV, BigQuery).
+ items:
+ type: object
+ events:
+ description: >-
+ in case of error, observability events will be added to the
+ response, if any.
+ type: array
+ items:
+ $ref: '#/components/schemas/Event'
+ message:
+ description: a message describing the outcome of a validate run.
+ type: string
+ required:
+ - message
SourceSearch:
type: object
additionalProperties: false
@@ -2624,10 +2769,6 @@ components:
DockerSourceStream:
type: object
description: Stream definition (see the Singer specification for details).
- runID:
- type: string
- description: Universally unique identifier (UUID) of a task run.
- example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
ActionType:
type: string
description: Action to perform on the Algolia index.
@@ -3223,22 +3364,6 @@ components:
- runs
- pagination
- window
- EventStatus:
- type: string
- enum:
- - created
- - started
- - retried
- - failed
- - succeeded
- - critical
- EventType:
- type: string
- enum:
- - fetch
- - record
- - log
- - transform
eventSortKeys:
type: string
description: Property by which to sort the list of task run events.
@@ -3246,48 +3371,6 @@ components:
- status
- type
- publishedAt
- eventID:
- type: string
- description: Universally unique identifier (UUID) of an event.
- example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
- publishedAt:
- type: string
- description: Date of publish RFC 3339 format.
- Event:
- type: object
- description: An event describe a step of the task execution flow..
- additionalProperties: false
- properties:
- eventID:
- $ref: '#/components/schemas/eventID'
- runID:
- $ref: '#/components/schemas/runID'
- parentID:
- type: string
- description: The parent event, the cause of this event.
- example: 6c02aeb1-775e-418e-870b-1faccd4b2c0f
- status:
- $ref: '#/components/schemas/EventStatus'
- type:
- $ref: '#/components/schemas/EventType'
- batchSize:
- type: integer
- description: The extracted record batch size.
- example: 10
- minimum: 0
- multipleOf: 1
- data:
- type: object
- additionalProperties: true
- publishedAt:
- $ref: '#/components/schemas/publishedAt'
- required:
- - eventID
- - runID
- - status
- - type
- - batchSize
- - publishedAt
responses:
BadRequest:
description: Bad request or request arguments.
diff --git a/tests/output/csharp/src/generated/requests/Ingestion.test.cs b/tests/output/csharp/src/generated/requests/Ingestion.test.cs
index 06ffd5ebc3..9fe91d5898 100644
--- a/tests/output/csharp/src/generated/requests/Ingestion.test.cs
+++ b/tests/output/csharp/src/generated/requests/Ingestion.test.cs
@@ -1240,4 +1240,49 @@ await _client.UpdateTaskAsync(
Assert.Equal("PATCH", req.Method.ToString());
JsonAssert.EqualOverrideDefault("{\"enabled\":false}", req.Body, new JsonDiffConfig(false));
}
+
+ [Fact(DisplayName = "validateSource")]
+ public async Task ValidateSourceTest()
+ {
+ await _client.ValidateSourceAsync(
+ new SourceCreate
+ {
+ Type = Enum.Parse("Commercetools"),
+ Name = "sourceName",
+ Input = new SourceInput(
+ new SourceCommercetools
+ {
+ StoreKeys = new List { "myStore" },
+ Locales = new List { "de" },
+ Url = "http://commercetools.com",
+ ProjectKey = "keyID",
+ }
+ ),
+ AuthenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ }
+ );
+
+ var req = _echo.LastResponse;
+ Assert.Equal("/1/sources/validate", req.Path);
+ Assert.Equal("POST", req.Method.ToString());
+ JsonAssert.EqualOverrideDefault(
+ "{\"type\":\"commercetools\",\"name\":\"sourceName\",\"input\":{\"storeKeys\":[\"myStore\"],\"locales\":[\"de\"],\"url\":\"http://commercetools.com\",\"projectKey\":\"keyID\"},\"authenticationID\":\"6c02aeb1-775e-418e-870b-1faccd4b2c0f\"}",
+ req.Body,
+ new JsonDiffConfig(false)
+ );
+ }
+
+ [Fact(DisplayName = "validateSourceBeforeUpdate")]
+ public async Task ValidateSourceBeforeUpdateTest()
+ {
+ await _client.ValidateSourceBeforeUpdateAsync(
+ "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ new SourceUpdate { Name = "newName", }
+ );
+
+ var req = _echo.LastResponse;
+ Assert.Equal("/1/sources/6c02aeb1-775e-418e-870b-1faccd4b2c0f/validate", req.Path);
+ Assert.Equal("POST", req.Method.ToString());
+ JsonAssert.EqualOverrideDefault("{\"name\":\"newName\"}", req.Body, new JsonDiffConfig(false));
+ }
}
diff --git a/tests/output/go/tests/requests/ingestion_test.go b/tests/output/go/tests/requests/ingestion_test.go
index 9d50cecdc0..3f84a9390c 100644
--- a/tests/output/go/tests/requests/ingestion_test.go
+++ b/tests/output/go/tests/requests/ingestion_test.go
@@ -1155,3 +1155,42 @@ func TestIngestion_UpdateTask(t *testing.T) {
ja.Assertf(*echo.Body, `{"enabled":false}`)
})
}
+
+func TestIngestion_ValidateSource(t *testing.T) {
+ client, echo := createIngestionClient(t)
+ _ = echo
+
+ t.Run("validateSource", func(t *testing.T) {
+ _, err := client.ValidateSource(client.NewApiValidateSourceRequest().WithSourceCreate(
+ ingestion.NewEmptySourceCreate().SetType(ingestion.SourceType("commercetools")).SetName("sourceName").SetInput(ingestion.SourceCommercetoolsAsSourceInput(
+ ingestion.NewEmptySourceCommercetools().SetStoreKeys(
+ []string{"myStore"}).SetLocales(
+ []string{"de"}).SetUrl("http://commercetools.com").SetProjectKey("keyID"))).SetAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f")))
+ require.NoError(t, err)
+
+ require.Equal(t, "/1/sources/validate", echo.Path)
+ require.Equal(t, "POST", echo.Method)
+
+ ja := jsonassert.New(t)
+ ja.Assertf(*echo.Body, `{"type":"commercetools","name":"sourceName","input":{"storeKeys":["myStore"],"locales":["de"],"url":"http://commercetools.com","projectKey":"keyID"},"authenticationID":"6c02aeb1-775e-418e-870b-1faccd4b2c0f"}`)
+ })
+}
+
+func TestIngestion_ValidateSourceBeforeUpdate(t *testing.T) {
+ client, echo := createIngestionClient(t)
+ _ = echo
+
+ t.Run("validateSourceBeforeUpdate", func(t *testing.T) {
+ _, err := client.ValidateSourceBeforeUpdate(client.NewApiValidateSourceBeforeUpdateRequest(
+ "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ ingestion.NewEmptySourceUpdate().SetName("newName"),
+ ))
+ require.NoError(t, err)
+
+ require.Equal(t, "/1/sources/6c02aeb1-775e-418e-870b-1faccd4b2c0f/validate", echo.Path)
+ require.Equal(t, "POST", echo.Method)
+
+ ja := jsonassert.New(t)
+ ja.Assertf(*echo.Body, `{"name":"newName"}`)
+ })
+}
diff --git a/tests/output/java/src/test/java/com/algolia/requests/Ingestion.test.java b/tests/output/java/src/test/java/com/algolia/requests/Ingestion.test.java
index 0121f2ed96..99b55a498a 100644
--- a/tests/output/java/src/test/java/com/algolia/requests/Ingestion.test.java
+++ b/tests/output/java/src/test/java/com/algolia/requests/Ingestion.test.java
@@ -1192,4 +1192,46 @@ void updateTaskTest() {
assertEquals("PATCH", req.method);
assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"enabled\":false}", req.body, JSONCompareMode.STRICT));
}
+
+ @Test
+ @DisplayName("validateSource")
+ void validateSourceTest() {
+ assertDoesNotThrow(() -> {
+ client.validateSource(
+ new SourceCreate()
+ .setType(SourceType.COMMERCETOOLS)
+ .setName("sourceName")
+ .setInput(
+ new SourceCommercetools()
+ .setStoreKeys(List.of("myStore"))
+ .setLocales(List.of("de"))
+ .setUrl("http://commercetools.com")
+ .setProjectKey("keyID")
+ )
+ .setAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
+ );
+ });
+ EchoResponse req = echo.getLastResponse();
+ assertEquals("/1/sources/validate", req.path);
+ assertEquals("POST", req.method);
+ assertDoesNotThrow(() ->
+ JSONAssert.assertEquals(
+ "{\"type\":\"commercetools\",\"name\":\"sourceName\",\"input\":{\"storeKeys\":[\"myStore\"],\"locales\":[\"de\"],\"url\":\"http://commercetools.com\",\"projectKey\":\"keyID\"},\"authenticationID\":\"6c02aeb1-775e-418e-870b-1faccd4b2c0f\"}",
+ req.body,
+ JSONCompareMode.STRICT
+ )
+ );
+ }
+
+ @Test
+ @DisplayName("validateSourceBeforeUpdate")
+ void validateSourceBeforeUpdateTest() {
+ assertDoesNotThrow(() -> {
+ client.validateSourceBeforeUpdate("6c02aeb1-775e-418e-870b-1faccd4b2c0f", new SourceUpdate().setName("newName"));
+ });
+ EchoResponse req = echo.getLastResponse();
+ assertEquals("/1/sources/6c02aeb1-775e-418e-870b-1faccd4b2c0f/validate", req.path);
+ assertEquals("POST", req.method);
+ assertDoesNotThrow(() -> JSONAssert.assertEquals("{\"name\":\"newName\"}", req.body, JSONCompareMode.STRICT));
+ }
}
diff --git a/tests/output/javascript/src/requests/ingestion.test.ts b/tests/output/javascript/src/requests/ingestion.test.ts
index 3f603dec11..c6db44b19a 100644
--- a/tests/output/javascript/src/requests/ingestion.test.ts
+++ b/tests/output/javascript/src/requests/ingestion.test.ts
@@ -1049,3 +1049,50 @@ describe('updateTask', () => {
expect(req.searchParams).toStrictEqual(undefined);
});
});
+
+describe('validateSource', () => {
+ test('validateSource', async () => {
+ const req = (await client.validateSource({
+ type: 'commercetools',
+ name: 'sourceName',
+ input: {
+ storeKeys: ['myStore'],
+ locales: ['de'],
+ url: 'http://commercetools.com',
+ projectKey: 'keyID',
+ },
+ authenticationID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ })) as unknown as EchoResponse;
+
+ expect(req.path).toEqual('/1/sources/validate');
+ expect(req.method).toEqual('POST');
+ expect(req.data).toEqual({
+ type: 'commercetools',
+ name: 'sourceName',
+ input: {
+ storeKeys: ['myStore'],
+ locales: ['de'],
+ url: 'http://commercetools.com',
+ projectKey: 'keyID',
+ },
+ authenticationID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ });
+ expect(req.searchParams).toStrictEqual(undefined);
+ });
+});
+
+describe('validateSourceBeforeUpdate', () => {
+ test('validateSourceBeforeUpdate', async () => {
+ const req = (await client.validateSourceBeforeUpdate({
+ sourceID: '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ sourceUpdate: { name: 'newName' },
+ })) as unknown as EchoResponse;
+
+ expect(req.path).toEqual(
+ '/1/sources/6c02aeb1-775e-418e-870b-1faccd4b2c0f/validate'
+ );
+ expect(req.method).toEqual('POST');
+ expect(req.data).toEqual({ name: 'newName' });
+ expect(req.searchParams).toStrictEqual(undefined);
+ });
+});
diff --git a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/IngestionTest.kt b/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/IngestionTest.kt
index d1a471076f..544f6fa059 100644
--- a/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/IngestionTest.kt
+++ b/tests/output/kotlin/src/commonTest/kotlin/com/algolia/requests/IngestionTest.kt
@@ -1194,4 +1194,53 @@ class IngestionTest {
},
)
}
+
+ // validateSource
+
+ @Test
+ fun `validateSource`() = runTest {
+ client.runTest(
+ call = {
+ validateSource(
+ sourceCreate = SourceCreate(
+ type = SourceType.entries.first { it.value == "commercetools" },
+ name = "sourceName",
+ input = SourceCommercetools(
+ storeKeys = listOf("myStore"),
+ locales = listOf("de"),
+ url = "http://commercetools.com",
+ projectKey = "keyID",
+ ),
+ authenticationID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ ),
+ )
+ },
+ intercept = {
+ assertEquals("/1/sources/validate".toPathSegments(), it.url.pathSegments)
+ assertEquals(HttpMethod.parse("POST"), it.method)
+ assertJsonBody("""{"type":"commercetools","name":"sourceName","input":{"storeKeys":["myStore"],"locales":["de"],"url":"http://commercetools.com","projectKey":"keyID"},"authenticationID":"6c02aeb1-775e-418e-870b-1faccd4b2c0f"}""", it.body)
+ },
+ )
+ }
+
+ // validateSourceBeforeUpdate
+
+ @Test
+ fun `validateSourceBeforeUpdate`() = runTest {
+ client.runTest(
+ call = {
+ validateSourceBeforeUpdate(
+ sourceID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ sourceUpdate = SourceUpdate(
+ name = "newName",
+ ),
+ )
+ },
+ intercept = {
+ assertEquals("/1/sources/6c02aeb1-775e-418e-870b-1faccd4b2c0f/validate".toPathSegments(), it.url.pathSegments)
+ assertEquals(HttpMethod.parse("POST"), it.method)
+ assertJsonBody("""{"name":"newName"}""", it.body)
+ },
+ )
+ }
}
diff --git a/tests/output/php/src/requests/IngestionTest.php b/tests/output/php/src/requests/IngestionTest.php
index d46023df1d..af3d02f771 100644
--- a/tests/output/php/src/requests/IngestionTest.php
+++ b/tests/output/php/src/requests/IngestionTest.php
@@ -1429,6 +1429,60 @@ public function testUpdateTask()
]);
}
+ /**
+ * Test case for ValidateSource
+ * validateSource.
+ */
+ public function testValidateSource()
+ {
+ $client = $this->getClient();
+ $client->validateSource(
+ ['type' => 'commercetools',
+ 'name' => 'sourceName',
+ 'input' => ['storeKeys' => [
+ 'myStore',
+ ],
+ 'locales' => [
+ 'de',
+ ],
+ 'url' => 'http://commercetools.com',
+ 'projectKey' => 'keyID',
+ ],
+ 'authenticationID' => '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ ],
+ );
+
+ $this->assertRequests([
+ [
+ 'path' => '/1/sources/validate',
+ 'method' => 'POST',
+ 'body' => json_decode('{"type":"commercetools","name":"sourceName","input":{"storeKeys":["myStore"],"locales":["de"],"url":"http://commercetools.com","projectKey":"keyID"},"authenticationID":"6c02aeb1-775e-418e-870b-1faccd4b2c0f"}'),
+ ],
+ ]);
+ }
+
+ /**
+ * Test case for ValidateSourceBeforeUpdate
+ * validateSourceBeforeUpdate.
+ */
+ public function testValidateSourceBeforeUpdate()
+ {
+ $client = $this->getClient();
+ $client->validateSourceBeforeUpdate(
+ '6c02aeb1-775e-418e-870b-1faccd4b2c0f',
+ ['name' => 'newName',
+ ],
+ );
+
+ $this->assertRequests([
+ [
+ 'path' => '/1/sources/6c02aeb1-775e-418e-870b-1faccd4b2c0f/validate',
+ 'method' => 'POST',
+ 'body' => json_decode('{"name":"newName"}'),
+ ],
+ ]);
+ }
+
protected function union($expected, $received)
{
if (is_array($expected)) {
diff --git a/tests/output/python/tests/requests/ingestion_test.py b/tests/output/python/tests/requests/ingestion_test.py
index 562ee1aa9d..1319eb507d 100644
--- a/tests/output/python/tests/requests/ingestion_test.py
+++ b/tests/output/python/tests/requests/ingestion_test.py
@@ -1152,3 +1152,50 @@ async def test_update_task_(self):
assert _req.query_parameters.items() == {}.items()
assert _req.headers.items() >= {}.items()
assert loads(_req.data) == loads("""{"enabled":false}""")
+
+ async def test_validate_source_(self):
+ """
+ validateSource
+ """
+ _req = await self._client.validate_source_with_http_info(
+ source_create={
+ "type": "commercetools",
+ "name": "sourceName",
+ "input": {
+ "storeKeys": [
+ "myStore",
+ ],
+ "locales": [
+ "de",
+ ],
+ "url": "http://commercetools.com",
+ "projectKey": "keyID",
+ },
+ "authenticationID": "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ },
+ )
+
+ assert _req.path == "/1/sources/validate"
+ assert _req.verb == "POST"
+ assert _req.query_parameters.items() == {}.items()
+ assert _req.headers.items() >= {}.items()
+ assert loads(_req.data) == loads(
+ """{"type":"commercetools","name":"sourceName","input":{"storeKeys":["myStore"],"locales":["de"],"url":"http://commercetools.com","projectKey":"keyID"},"authenticationID":"6c02aeb1-775e-418e-870b-1faccd4b2c0f"}"""
+ )
+
+ async def test_validate_source_before_update_(self):
+ """
+ validateSourceBeforeUpdate
+ """
+ _req = await self._client.validate_source_before_update_with_http_info(
+ source_id="6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ source_update={
+ "name": "newName",
+ },
+ )
+
+ assert _req.path == "/1/sources/6c02aeb1-775e-418e-870b-1faccd4b2c0f/validate"
+ assert _req.verb == "POST"
+ assert _req.query_parameters.items() == {}.items()
+ assert _req.headers.items() >= {}.items()
+ assert loads(_req.data) == loads("""{"name":"newName"}""")
diff --git a/tests/output/ruby/test/requests/ingestion_test.rb b/tests/output/ruby/test/requests/ingestion_test.rb
index 971185043e..de46c47908 100644
--- a/tests/output/ruby/test/requests/ingestion_test.rb
+++ b/tests/output/ruby/test/requests/ingestion_test.rb
@@ -917,4 +917,42 @@ def test_update_task
assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
assert_equal(JSON.parse('{"enabled":false}'), JSON.parse(req.body))
end
+
+ # validateSource
+ def test_validate_source
+ req = @client.validate_source_with_http_info(
+ SourceCreate.new(
+ type: 'commercetools',
+ name: "sourceName",
+ input: SourceCommercetools.new(
+ store_keys: ["myStore"],
+ locales: ["de"],
+ url: "http://commercetools.com",
+ project_key: "keyID"
+ ),
+ authentication_id: "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
+ )
+ )
+
+ assert_equal(:post, req.method)
+ assert_equal('/1/sources/validate', req.path)
+ assert_equal({}.to_a, req.query_params.to_a)
+ assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
+ assert_equal(
+ JSON.parse('{"type":"commercetools","name":"sourceName","input":{"storeKeys":["myStore"],"locales":["de"],"url":"http://commercetools.com","projectKey":"keyID"},"authenticationID":"6c02aeb1-775e-418e-870b-1faccd4b2c0f"}'), JSON.parse(req.body)
+ )
+ end
+
+ # validateSourceBeforeUpdate
+ def test_validate_source_before_update
+ req = @client.validate_source_before_update_with_http_info(
+ "6c02aeb1-775e-418e-870b-1faccd4b2c0f", SourceUpdate.new(name: "newName")
+ )
+
+ assert_equal(:post, req.method)
+ assert_equal('/1/sources/6c02aeb1-775e-418e-870b-1faccd4b2c0f/validate', req.path)
+ assert_equal({}.to_a, req.query_params.to_a)
+ assert(({}.to_a - req.headers.to_a).empty?, req.headers.to_s)
+ assert_equal(JSON.parse('{"name":"newName"}'), JSON.parse(req.body))
+ end
end
diff --git a/tests/output/scala/src/test/scala/algoliasearch/requests/IngestionTest.scala b/tests/output/scala/src/test/scala/algoliasearch/requests/IngestionTest.scala
index 160803f775..f0c5c5f7b9 100644
--- a/tests/output/scala/src/test/scala/algoliasearch/requests/IngestionTest.scala
+++ b/tests/output/scala/src/test/scala/algoliasearch/requests/IngestionTest.scala
@@ -1245,4 +1245,53 @@ class IngestionTest extends AnyFunSuite {
assert(actualBody == expectedBody)
}
+ test("validateSource") {
+ val (client, echo) = testClient()
+ val future = client.validateSource(
+ sourceCreate = Some(
+ SourceCreate(
+ `type` = SourceType.withName("commercetools"),
+ name = "sourceName",
+ input = SourceCommercetools(
+ storeKeys = Some(Seq("myStore")),
+ locales = Some(Seq("de")),
+ url = "http://commercetools.com",
+ projectKey = "keyID"
+ ),
+ authenticationID = Some("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
+ )
+ )
+ )
+
+ Await.ready(future, Duration.Inf)
+ val res = echo.lastResponse.get
+
+ assert(res.path == "/1/sources/validate")
+ assert(res.method == "POST")
+ val expectedBody = parse(
+ """{"type":"commercetools","name":"sourceName","input":{"storeKeys":["myStore"],"locales":["de"],"url":"http://commercetools.com","projectKey":"keyID"},"authenticationID":"6c02aeb1-775e-418e-870b-1faccd4b2c0f"}"""
+ )
+ val actualBody = parse(res.body.get)
+ assert(actualBody == expectedBody)
+ }
+
+ test("validateSourceBeforeUpdate") {
+ val (client, echo) = testClient()
+ val future = client.validateSourceBeforeUpdate(
+ sourceID = "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ sourceUpdate = SourceUpdate(
+ name = Some("newName")
+ )
+ )
+
+ Await.ready(future, Duration.Inf)
+ val res = echo.lastResponse.get
+
+ assert(res.path == "/1/sources/6c02aeb1-775e-418e-870b-1faccd4b2c0f/validate")
+ assert(res.method == "POST")
+ val expectedBody = parse("""{"name":"newName"}""")
+ val actualBody = parse(res.body.get)
+ assert(actualBody == expectedBody)
+ }
+
}
diff --git a/tests/output/swift/Tests/requests/IngestionTests.swift b/tests/output/swift/Tests/requests/IngestionTests.swift
index 3ccd75cc58..9b4cd4ae78 100644
--- a/tests/output/swift/Tests/requests/IngestionTests.swift
+++ b/tests/output/swift/Tests/requests/IngestionTests.swift
@@ -1874,4 +1874,75 @@ final class IngestionClientRequestsTests: XCTestCase {
XCTAssertNil(echoResponse.queryParameters)
}
+
+ /// validateSource
+ func testValidateSourceTest() async throws {
+ let configuration = try IngestionClientConfiguration(
+ appID: IngestionClientRequestsTests.APPLICATION_ID,
+ apiKey: IngestionClientRequestsTests.API_KEY,
+ region: Region.us
+ )
+ let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder())
+ let client = IngestionClient(configuration: configuration, transporter: transporter)
+
+ let response = try await client.validateSourceWithHTTPInfo(sourceCreate: SourceCreate(
+ type: SourceType.commercetools,
+ name: "sourceName",
+ input: SourceInput.sourceCommercetools(SourceCommercetools(
+ storeKeys: ["myStore"],
+ locales: ["de"],
+ url: "http://commercetools.com",
+ projectKey: "keyID"
+ )),
+ authenticationID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f"
+ ))
+ let responseBodyData = try XCTUnwrap(response.bodyData)
+ let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData)
+
+ let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData)
+ let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString)
+
+ let expectedBodyData =
+ "{\"type\":\"commercetools\",\"name\":\"sourceName\",\"input\":{\"storeKeys\":[\"myStore\"],\"locales\":[\"de\"],\"url\":\"http://commercetools.com\",\"projectKey\":\"keyID\"},\"authenticationID\":\"6c02aeb1-775e-418e-870b-1faccd4b2c0f\"}"
+ .data(using: .utf8)
+ let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString)
+
+ XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON)
+
+ XCTAssertEqual(echoResponse.path, "/1/sources/validate")
+ XCTAssertEqual(echoResponse.method, HTTPMethod.post)
+
+ XCTAssertNil(echoResponse.queryParameters)
+ }
+
+ /// validateSourceBeforeUpdate
+ func testValidateSourceBeforeUpdateTest() async throws {
+ let configuration = try IngestionClientConfiguration(
+ appID: IngestionClientRequestsTests.APPLICATION_ID,
+ apiKey: IngestionClientRequestsTests.API_KEY,
+ region: Region.us
+ )
+ let transporter = Transporter(configuration: configuration, requestBuilder: EchoRequestBuilder())
+ let client = IngestionClient(configuration: configuration, transporter: transporter)
+
+ let response = try await client.validateSourceBeforeUpdateWithHTTPInfo(
+ sourceID: "6c02aeb1-775e-418e-870b-1faccd4b2c0f",
+ sourceUpdate: SourceUpdate(name: "newName")
+ )
+ let responseBodyData = try XCTUnwrap(response.bodyData)
+ let echoResponse = try CodableHelper.jsonDecoder.decode(EchoResponse.self, from: responseBodyData)
+
+ let echoResponseBodyData = try XCTUnwrap(echoResponse.originalBodyData)
+ let echoResponseBodyJSON = try XCTUnwrap(echoResponseBodyData.jsonString)
+
+ let expectedBodyData = "{\"name\":\"newName\"}".data(using: .utf8)
+ let expectedBodyJSON = try XCTUnwrap(expectedBodyData?.jsonString)
+
+ XCTAssertEqual(echoResponseBodyJSON, expectedBodyJSON)
+
+ XCTAssertEqual(echoResponse.path, "/1/sources/6c02aeb1-775e-418e-870b-1faccd4b2c0f/validate")
+ XCTAssertEqual(echoResponse.method, HTTPMethod.post)
+
+ XCTAssertNil(echoResponse.queryParameters)
+ }
}