Skip to content

Commit 8663dc7

Browse files
feat(specs): add v2 endpoints for ingestion
algolia/api-clients-automation#3416 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 2713196 commit 8663dc7

File tree

4 files changed

+345
-0
lines changed

4 files changed

+345
-0
lines changed

algoliasearch/Clients/IngestionClient.cs

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,32 @@ public interface IIngestionClient
995995
/// <returns>ListTransformationsResponse</returns>
996996
ListTransformationsResponse ListTransformations(SortKeys? sort = default, OrderKeys? order = default, RequestOptions options = null, CancellationToken cancellationToken = default);
997997

998+
/// <summary>
999+
/// Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints.
1000+
/// </summary>
1001+
/// <param name="taskID">Unique identifier of a task.</param>
1002+
/// <param name="batchWriteParams">Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.</param>
1003+
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
1004+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
1005+
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
1006+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
1007+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
1008+
/// <returns>Task of RunResponse</returns>
1009+
Task<RunResponse> PushTaskAsync(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default);
1010+
1011+
/// <summary>
1012+
/// Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints. (Synchronous version)
1013+
/// </summary>
1014+
/// <param name="taskID">Unique identifier of a task.</param>
1015+
/// <param name="batchWriteParams">Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.</param>
1016+
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
1017+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
1018+
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
1019+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
1020+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
1021+
/// <returns>RunResponse</returns>
1022+
RunResponse PushTask(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default);
1023+
9981024
/// <summary>
9991025
/// Runs a task. You can check the status of task runs with the observability endpoints.
10001026
/// </summary>
@@ -3273,6 +3299,61 @@ public ListTransformationsResponse ListTransformations(SortKeys? sort = default,
32733299
AsyncHelper.RunSync(() => ListTransformationsAsync(sort, order, options, cancellationToken));
32743300

32753301

3302+
/// <summary>
3303+
/// Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints.
3304+
/// </summary>
3305+
///
3306+
/// Required API Key ACLs:
3307+
/// - addObject
3308+
/// - deleteIndex
3309+
/// - editSettings
3310+
/// <param name="taskID">Unique identifier of a task.</param>
3311+
/// <param name="batchWriteParams">Request body of a Search API &#x60;batch&#x60; request that will be pushed in the Connectors pipeline.</param>
3312+
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
3313+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
3314+
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
3315+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
3316+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
3317+
/// <returns>Task of RunResponse</returns>
3318+
public async Task<RunResponse> PushTaskAsync(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default)
3319+
{
3320+
3321+
if (taskID == null)
3322+
throw new ArgumentException("Parameter `taskID` is required when calling `PushTask`.");
3323+
3324+
3325+
if (batchWriteParams == null)
3326+
throw new ArgumentException("Parameter `batchWriteParams` is required when calling `PushTask`.");
3327+
3328+
var requestOptions = new InternalRequestOptions(options);
3329+
3330+
requestOptions.PathParameters.Add("taskID", QueryStringHelper.ParameterToString(taskID));
3331+
3332+
requestOptions.Data = batchWriteParams;
3333+
return await _transport.ExecuteRequestAsync<RunResponse>(new HttpMethod("POST"), "/2/tasks/{taskID}/push", requestOptions, cancellationToken).ConfigureAwait(false);
3334+
}
3335+
3336+
3337+
/// <summary>
3338+
/// Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints. (Synchronous version)
3339+
/// </summary>
3340+
///
3341+
/// Required API Key ACLs:
3342+
/// - addObject
3343+
/// - deleteIndex
3344+
/// - editSettings
3345+
/// <param name="taskID">Unique identifier of a task.</param>
3346+
/// <param name="batchWriteParams">Request body of a Search API &#x60;batch&#x60; request that will be pushed in the Connectors pipeline.</param>
3347+
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
3348+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
3349+
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
3350+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
3351+
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
3352+
/// <returns>RunResponse</returns>
3353+
public RunResponse PushTask(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default) =>
3354+
AsyncHelper.RunSync(() => PushTaskAsync(taskID, batchWriteParams, options, cancellationToken));
3355+
3356+
32763357
/// <summary>
32773358
/// Runs a task. You can check the status of task runs with the observability endpoints.
32783359
/// </summary>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
//
2+
// 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.
3+
//
4+
using System;
5+
using System.Text;
6+
using System.Linq;
7+
using System.Text.Json.Serialization;
8+
using System.Collections.Generic;
9+
using Algolia.Search.Serializer;
10+
using System.Text.Json;
11+
12+
namespace Algolia.Search.Models.Ingestion;
13+
14+
/// <summary>
15+
/// Type of indexing operation.
16+
/// </summary>
17+
/// <value>Type of indexing operation.</value>
18+
public enum Action
19+
{
20+
/// <summary>
21+
/// Enum AddObject for value: addObject
22+
/// </summary>
23+
[JsonPropertyName("addObject")]
24+
AddObject = 1,
25+
26+
/// <summary>
27+
/// Enum UpdateObject for value: updateObject
28+
/// </summary>
29+
[JsonPropertyName("updateObject")]
30+
UpdateObject = 2,
31+
32+
/// <summary>
33+
/// Enum PartialUpdateObject for value: partialUpdateObject
34+
/// </summary>
35+
[JsonPropertyName("partialUpdateObject")]
36+
PartialUpdateObject = 3,
37+
38+
/// <summary>
39+
/// Enum PartialUpdateObjectNoCreate for value: partialUpdateObjectNoCreate
40+
/// </summary>
41+
[JsonPropertyName("partialUpdateObjectNoCreate")]
42+
PartialUpdateObjectNoCreate = 4,
43+
44+
/// <summary>
45+
/// Enum DeleteObject for value: deleteObject
46+
/// </summary>
47+
[JsonPropertyName("deleteObject")]
48+
DeleteObject = 5,
49+
50+
/// <summary>
51+
/// Enum Delete for value: delete
52+
/// </summary>
53+
[JsonPropertyName("delete")]
54+
Delete = 6,
55+
56+
/// <summary>
57+
/// Enum Clear for value: clear
58+
/// </summary>
59+
[JsonPropertyName("clear")]
60+
Clear = 7
61+
}
62+
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
//
2+
// 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.
3+
//
4+
using System;
5+
using System.Text;
6+
using System.Linq;
7+
using System.Text.Json.Serialization;
8+
using System.Collections.Generic;
9+
using Algolia.Search.Serializer;
10+
using System.Text.Json;
11+
12+
namespace Algolia.Search.Models.Ingestion;
13+
14+
/// <summary>
15+
/// BatchRequest
16+
/// </summary>
17+
public partial class BatchRequest
18+
{
19+
20+
/// <summary>
21+
/// Gets or Sets Action
22+
/// </summary>
23+
[JsonPropertyName("action")]
24+
public Action? Action { get; set; }
25+
/// <summary>
26+
/// Initializes a new instance of the BatchRequest class.
27+
/// </summary>
28+
[JsonConstructor]
29+
public BatchRequest() { }
30+
/// <summary>
31+
/// Initializes a new instance of the BatchRequest class.
32+
/// </summary>
33+
/// <param name="action">action (required).</param>
34+
/// <param name="body">Operation arguments (varies with specified &#x60;action&#x60;). (required).</param>
35+
public BatchRequest(Action? action, object body)
36+
{
37+
Action = action;
38+
Body = body ?? throw new ArgumentNullException(nameof(body));
39+
}
40+
41+
/// <summary>
42+
/// Operation arguments (varies with specified `action`).
43+
/// </summary>
44+
/// <value>Operation arguments (varies with specified `action`).</value>
45+
[JsonPropertyName("body")]
46+
public object Body { get; set; }
47+
48+
/// <summary>
49+
/// Returns the string presentation of the object
50+
/// </summary>
51+
/// <returns>String presentation of the object</returns>
52+
public override string ToString()
53+
{
54+
StringBuilder sb = new StringBuilder();
55+
sb.Append("class BatchRequest {\n");
56+
sb.Append(" Action: ").Append(Action).Append("\n");
57+
sb.Append(" Body: ").Append(Body).Append("\n");
58+
sb.Append("}\n");
59+
return sb.ToString();
60+
}
61+
62+
/// <summary>
63+
/// Returns the JSON string presentation of the object
64+
/// </summary>
65+
/// <returns>JSON string presentation of the object</returns>
66+
public virtual string ToJson()
67+
{
68+
return JsonSerializer.Serialize(this, JsonConfig.Options);
69+
}
70+
71+
/// <summary>
72+
/// Returns true if objects are equal
73+
/// </summary>
74+
/// <param name="obj">Object to be compared</param>
75+
/// <returns>Boolean</returns>
76+
public override bool Equals(object obj)
77+
{
78+
if (obj is not BatchRequest input)
79+
{
80+
return false;
81+
}
82+
83+
return
84+
(Action == input.Action || Action.Equals(input.Action)) &&
85+
(Body == input.Body || (Body != null && Body.Equals(input.Body)));
86+
}
87+
88+
/// <summary>
89+
/// Gets the hash code
90+
/// </summary>
91+
/// <returns>Hash code</returns>
92+
public override int GetHashCode()
93+
{
94+
unchecked // Overflow is fine, just wrap
95+
{
96+
int hashCode = 41;
97+
hashCode = (hashCode * 59) + Action.GetHashCode();
98+
if (Body != null)
99+
{
100+
hashCode = (hashCode * 59) + Body.GetHashCode();
101+
}
102+
return hashCode;
103+
}
104+
}
105+
106+
}
107+
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
//
2+
// 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.
3+
//
4+
using System;
5+
using System.Text;
6+
using System.Linq;
7+
using System.Text.Json.Serialization;
8+
using System.Collections.Generic;
9+
using Algolia.Search.Serializer;
10+
using System.Text.Json;
11+
12+
namespace Algolia.Search.Models.Ingestion;
13+
14+
/// <summary>
15+
/// Batch parameters.
16+
/// </summary>
17+
public partial class BatchWriteParams
18+
{
19+
/// <summary>
20+
/// Initializes a new instance of the BatchWriteParams class.
21+
/// </summary>
22+
[JsonConstructor]
23+
public BatchWriteParams() { }
24+
/// <summary>
25+
/// Initializes a new instance of the BatchWriteParams class.
26+
/// </summary>
27+
/// <param name="requests">requests (required).</param>
28+
public BatchWriteParams(List<BatchRequest> requests)
29+
{
30+
Requests = requests ?? throw new ArgumentNullException(nameof(requests));
31+
}
32+
33+
/// <summary>
34+
/// Gets or Sets Requests
35+
/// </summary>
36+
[JsonPropertyName("requests")]
37+
public List<BatchRequest> Requests { get; set; }
38+
39+
/// <summary>
40+
/// Returns the string presentation of the object
41+
/// </summary>
42+
/// <returns>String presentation of the object</returns>
43+
public override string ToString()
44+
{
45+
StringBuilder sb = new StringBuilder();
46+
sb.Append("class BatchWriteParams {\n");
47+
sb.Append(" Requests: ").Append(Requests).Append("\n");
48+
sb.Append("}\n");
49+
return sb.ToString();
50+
}
51+
52+
/// <summary>
53+
/// Returns the JSON string presentation of the object
54+
/// </summary>
55+
/// <returns>JSON string presentation of the object</returns>
56+
public virtual string ToJson()
57+
{
58+
return JsonSerializer.Serialize(this, JsonConfig.Options);
59+
}
60+
61+
/// <summary>
62+
/// Returns true if objects are equal
63+
/// </summary>
64+
/// <param name="obj">Object to be compared</param>
65+
/// <returns>Boolean</returns>
66+
public override bool Equals(object obj)
67+
{
68+
if (obj is not BatchWriteParams input)
69+
{
70+
return false;
71+
}
72+
73+
return
74+
(Requests == input.Requests || Requests != null && input.Requests != null && Requests.SequenceEqual(input.Requests));
75+
}
76+
77+
/// <summary>
78+
/// Gets the hash code
79+
/// </summary>
80+
/// <returns>Hash code</returns>
81+
public override int GetHashCode()
82+
{
83+
unchecked // Overflow is fine, just wrap
84+
{
85+
int hashCode = 41;
86+
if (Requests != null)
87+
{
88+
hashCode = (hashCode * 59) + Requests.GetHashCode();
89+
}
90+
return hashCode;
91+
}
92+
}
93+
94+
}
95+

0 commit comments

Comments
 (0)