Skip to content

Commit

Permalink
feat(specs): add runSource endpoint (#3453) (generated) [skip ci]
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
algolia-bot and millotp committed Aug 2, 2024
1 parent b90bef2 commit 1ab9deb
Show file tree
Hide file tree
Showing 66 changed files with 4,271 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,32 @@ public interface IIngestionClient
/// <returns>RunResponse</returns>
RunResponse PushTask(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default);

/// <summary>
/// Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task.
/// </summary>
/// <param name="sourceID">Unique identifier of a source.</param>
/// <param name="runSourcePayload"> (optional)</param>
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>Task of RunSourceResponse</returns>
Task<RunSourceResponse> RunSourceAsync(string sourceID, RunSourcePayload runSourcePayload = default, RequestOptions options = null, CancellationToken cancellationToken = default);

/// <summary>
/// Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task. (Synchronous version)
/// </summary>
/// <param name="sourceID">Unique identifier of a source.</param>
/// <param name="runSourcePayload"> (optional)</param>
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>RunSourceResponse</returns>
RunSourceResponse RunSource(string sourceID, RunSourcePayload runSourcePayload = default, RequestOptions options = null, CancellationToken cancellationToken = default);

/// <summary>
/// Runs a task. You can check the status of task runs with the observability endpoints.
/// </summary>
Expand Down Expand Up @@ -3354,6 +3380,57 @@ public RunResponse PushTask(string taskID, BatchWriteParams batchWriteParams, Re
AsyncHelper.RunSync(() => PushTaskAsync(taskID, batchWriteParams, options, cancellationToken));


/// <summary>
/// Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task.
/// </summary>
///
/// Required API Key ACLs:
/// - addObject
/// - deleteIndex
/// - editSettings
/// <param name="sourceID">Unique identifier of a source.</param>
/// <param name="runSourcePayload"> (optional)</param>
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>Task of RunSourceResponse</returns>
public async Task<RunSourceResponse> RunSourceAsync(string sourceID, RunSourcePayload runSourcePayload = default, RequestOptions options = null, CancellationToken cancellationToken = default)
{

if (sourceID == null)
throw new ArgumentException("Parameter `sourceID` is required when calling `RunSource`.");

var requestOptions = new InternalRequestOptions(options);

requestOptions.PathParameters.Add("sourceID", QueryStringHelper.ParameterToString(sourceID));

requestOptions.Data = runSourcePayload;
return await _transport.ExecuteRequestAsync<RunSourceResponse>(new HttpMethod("POST"), "/1/sources/{sourceID}/run", requestOptions, cancellationToken).ConfigureAwait(false);
}


/// <summary>
/// Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task. (Synchronous version)
/// </summary>
///
/// Required API Key ACLs:
/// - addObject
/// - deleteIndex
/// - editSettings
/// <param name="sourceID">Unique identifier of a source.</param>
/// <param name="runSourcePayload"> (optional)</param>
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>RunSourceResponse</returns>
public RunSourceResponse RunSource(string sourceID, RunSourcePayload runSourcePayload = default, RequestOptions options = null, CancellationToken cancellationToken = default) =>
AsyncHelper.RunSync(() => RunSourceAsync(sourceID, runSourcePayload, options, cancellationToken));


/// <summary>
/// Runs a task. You can check the status of task runs with the observability endpoints.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// 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;

/// <summary>
/// Type of entity to update.
/// </summary>
/// <value>Type of entity to update.</value>
public enum EntityType
{
/// <summary>
/// Enum Product for value: product
/// </summary>
[JsonPropertyName("product")]
Product = 1,

/// <summary>
/// Enum Collection for value: collection
/// </summary>
[JsonPropertyName("collection")]
Collection = 2
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
//
// 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;

/// <summary>
/// RunSourcePayload
/// </summary>
public partial class RunSourcePayload
{

/// <summary>
/// Gets or Sets EntityType
/// </summary>
[JsonPropertyName("entityType")]
public EntityType? EntityType { get; set; }
/// <summary>
/// Initializes a new instance of the RunSourcePayload class.
/// </summary>
public RunSourcePayload()
{
}

/// <summary>
/// List of index names to include in reidexing/update.
/// </summary>
/// <value>List of index names to include in reidexing/update.</value>
[JsonPropertyName("indexToInclude")]
public List<string> IndexToInclude { get; set; }

/// <summary>
/// List of index names to exclude in reidexing/update.
/// </summary>
/// <value>List of index names to exclude in reidexing/update.</value>
[JsonPropertyName("indexToExclude")]
public List<string> IndexToExclude { get; set; }

/// <summary>
/// List of entityID to update.
/// </summary>
/// <value>List of entityID to update.</value>
[JsonPropertyName("entityIDs")]
public List<string> EntityIDs { get; set; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class RunSourcePayload {\n");
sb.Append(" IndexToInclude: ").Append(IndexToInclude).Append("\n");
sb.Append(" IndexToExclude: ").Append(IndexToExclude).Append("\n");
sb.Append(" EntityIDs: ").Append(EntityIDs).Append("\n");
sb.Append(" EntityType: ").Append(EntityType).Append("\n");
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return JsonSerializer.Serialize(this, JsonConfig.Options);
}

/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (obj is not RunSourcePayload input)
{
return false;
}

return
(IndexToInclude == input.IndexToInclude || IndexToInclude != null && input.IndexToInclude != null && IndexToInclude.SequenceEqual(input.IndexToInclude)) &&
(IndexToExclude == input.IndexToExclude || IndexToExclude != null && input.IndexToExclude != null && IndexToExclude.SequenceEqual(input.IndexToExclude)) &&
(EntityIDs == input.EntityIDs || EntityIDs != null && input.EntityIDs != null && EntityIDs.SequenceEqual(input.EntityIDs)) &&
(EntityType == input.EntityType || EntityType.Equals(input.EntityType));
}

/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (IndexToInclude != null)
{
hashCode = (hashCode * 59) + IndexToInclude.GetHashCode();
}
if (IndexToExclude != null)
{
hashCode = (hashCode * 59) + IndexToExclude.GetHashCode();
}
if (EntityIDs != null)
{
hashCode = (hashCode * 59) + EntityIDs.GetHashCode();
}
hashCode = (hashCode * 59) + EntityType.GetHashCode();
return hashCode;
}
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//
// 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;

/// <summary>
/// RunSourceResponse
/// </summary>
public partial class RunSourceResponse
{
/// <summary>
/// Initializes a new instance of the RunSourceResponse class.
/// </summary>
[JsonConstructor]
public RunSourceResponse() { }
/// <summary>
/// Initializes a new instance of the RunSourceResponse class.
/// </summary>
/// <param name="taskWithRunID">Map of taskID sent for reindex with the corresponding runID. (required).</param>
/// <param name="createdAt">Date of creation in RFC 3339 format. (required).</param>
public RunSourceResponse(Dictionary<string, string> taskWithRunID, string createdAt)
{
TaskWithRunID = taskWithRunID ?? throw new ArgumentNullException(nameof(taskWithRunID));
CreatedAt = createdAt ?? throw new ArgumentNullException(nameof(createdAt));
}

/// <summary>
/// Map of taskID sent for reindex with the corresponding runID.
/// </summary>
/// <value>Map of taskID sent for reindex with the corresponding runID.</value>
[JsonPropertyName("taskWithRunID")]
public Dictionary<string, string> TaskWithRunID { get; set; }

/// <summary>
/// Date of creation in RFC 3339 format.
/// </summary>
/// <value>Date of creation in RFC 3339 format.</value>
[JsonPropertyName("createdAt")]
public string CreatedAt { get; set; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class RunSourceResponse {\n");
sb.Append(" TaskWithRunID: ").Append(TaskWithRunID).Append("\n");
sb.Append(" CreatedAt: ").Append(CreatedAt).Append("\n");
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return JsonSerializer.Serialize(this, JsonConfig.Options);
}

/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="obj">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object obj)
{
if (obj is not RunSourceResponse input)
{
return false;
}

return
(TaskWithRunID == input.TaskWithRunID || TaskWithRunID != null && input.TaskWithRunID != null && TaskWithRunID.SequenceEqual(input.TaskWithRunID)) &&
(CreatedAt == input.CreatedAt || (CreatedAt != null && CreatedAt.Equals(input.CreatedAt)));
}

/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (TaskWithRunID != null)
{
hashCode = (hashCode * 59) + TaskWithRunID.GetHashCode();
}
if (CreatedAt != null)
{
hashCode = (hashCode * 59) + CreatedAt.GetHashCode();
}
return hashCode;
}
}

}

Loading

0 comments on commit 1ab9deb

Please sign in to comment.