Skip to content

Commit 02bbcf2

Browse files
algolia-api-clients-automation-bot[bot]raed667Fluf22
committed
feat(specs): update Recommend rules to support trending-items [PRED-5025] (generated)
algolia/api-clients-automation#7188 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Raed <raed.chammam@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
1 parent e502e7a commit 02bbcf2

6 files changed

Lines changed: 453 additions & 11 deletions

File tree

‎algoliasearch/Clients/RecommendClient.cs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Algolia.Search.Clients;
2121
public interface IRecommendClient
2222
{
2323
/// <summary>
24-
/// Create or update a batch of Recommend Rules. Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead).
24+
/// Create or update a batch of Recommend Rules. Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead). Trending Items requests have no source item, so rules for the `trending-items` model differ: - Condition `filters` and consequence `automaticFacetFilters` are unavailable. - Condition `requestScope` applies the rule to requests without a facet, or to requests for a specific facet.
2525
/// </summary>
2626
///
2727
/// Required API Key ACLs:
@@ -44,7 +44,7 @@ Task<RecommendUpdatedAtResponse> BatchRecommendRulesAsync(
4444
);
4545

4646
/// <summary>
47-
/// Create or update a batch of Recommend Rules. Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead). (Synchronous version)
47+
/// Create or update a batch of Recommend Rules. Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead). Trending Items requests have no source item, so rules for the `trending-items` model differ: - Condition `filters` and consequence `automaticFacetFilters` are unavailable. - Condition `requestScope` applies the rule to requests without a facet, or to requests for a specific facet. (Synchronous version)
4848
/// </summary>
4949
///
5050
/// Required API Key ACLs:
@@ -67,7 +67,7 @@ RecommendUpdatedAtResponse BatchRecommendRules(
6767
);
6868

6969
/// <summary>
70-
/// Create or update a batch of Recommend Rules. Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead).
70+
/// Create or update a batch of Recommend Rules. Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead). Trending Items requests have no source item, so rules for the `trending-items` model differ: - Condition `filters` and consequence `automaticFacetFilters` are unavailable. - Condition `requestScope` applies the rule to requests without a facet, or to requests for a specific facet.
7171
/// </summary>
7272
///
7373
/// Required API Key ACLs:
@@ -90,7 +90,7 @@ Task<AlgoliaHttpResponse> BatchRecommendRulesWithHTTPInfoAsync(
9090
);
9191

9292
/// <summary>
93-
/// Create or update a batch of Recommend Rules. Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead). (Synchronous version)
93+
/// Create or update a batch of Recommend Rules. Each Recommend Rule is created or updated, depending on whether a Recommend Rule with the same `objectID` already exists. You may also specify `true` for `clearExistingRules`, in which case the batch will atomically replace all the existing Recommend Rules. Recommend Rules are similar to Search Rules, except that the conditions and consequences apply to a [source item](/doc/guides/algolia-recommend/overview/#recommend-models) instead of a query. The main differences are the following: - Conditions `pattern` and `anchoring` are unavailable. - Condition `filters` triggers if the source item matches the specified filters. - Condition `filters` accepts numeric filters. - Consequence `params` only covers filtering parameters. - Consequence `automaticFacetFilters` doesn't require a facet value placeholder (it tries to match the data source item's attributes instead). Trending Items requests have no source item, so rules for the `trending-items` model differ: - Condition `filters` and consequence `automaticFacetFilters` are unavailable. - Condition `requestScope` applies the rule to requests without a facet, or to requests for a specific facet. (Synchronous version)
9494
/// </summary>
9595
///
9696
/// Required API Key ACLs:

‎algoliasearch/Models/Recommend/Condition.cs‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ public Condition() { }
3535
[JsonPropertyName("context")]
3636
public string Context { get; set; }
3737

38+
/// <summary>
39+
/// Gets or Sets RequestScope
40+
/// </summary>
41+
[JsonPropertyName("requestScope")]
42+
public RequestScope RequestScope { get; set; }
43+
3844
/// <summary>
3945
/// Returns the string presentation of the object
4046
/// </summary>
@@ -45,6 +51,7 @@ public override string ToString()
4551
sb.Append("class Condition {\n");
4652
sb.Append(" Filters: ").Append(Filters).Append("\n");
4753
sb.Append(" Context: ").Append(Context).Append("\n");
54+
sb.Append(" RequestScope: ").Append(RequestScope).Append("\n");
4855
sb.Append("}\n");
4956
return sb.ToString();
5057
}
@@ -71,7 +78,11 @@ public override bool Equals(object obj)
7178
}
7279

7380
return (Filters == input.Filters || (Filters != null && Filters.Equals(input.Filters)))
74-
&& (Context == input.Context || (Context != null && Context.Equals(input.Context)));
81+
&& (Context == input.Context || (Context != null && Context.Equals(input.Context)))
82+
&& (
83+
RequestScope == input.RequestScope
84+
|| (RequestScope != null && RequestScope.Equals(input.RequestScope))
85+
);
7586
}
7687

7788
/// <summary>
@@ -91,6 +102,10 @@ public override int GetHashCode()
91102
{
92103
hashCode = (hashCode * 59) + Context.GetHashCode();
93104
}
105+
if (RequestScope != null)
106+
{
107+
hashCode = (hashCode * 59) + RequestScope.GetHashCode();
108+
}
94109
return hashCode;
95110
}
96111
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
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.Collections.Generic;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Text.Json;
9+
using System.Text.Json.Serialization;
10+
using Algolia.Search.Serializer;
11+
12+
namespace Algolia.Search.Models.Recommend;
13+
14+
/// <summary>
15+
/// Apply the rule only to Trending Items requests with the same `facetName` and `facetValue`.
16+
/// </summary>
17+
public partial class FacetRequestScope
18+
{
19+
/// <summary>
20+
/// Initializes a new instance of the FacetRequestScope class.
21+
/// </summary>
22+
[JsonConstructor]
23+
public FacetRequestScope() { }
24+
25+
/// <summary>
26+
/// Initializes a new instance of the FacetRequestScope class.
27+
/// </summary>
28+
/// <param name="facetName">Facet attribute of the Trending Items request. (required).</param>
29+
/// <param name="facetValue">Facet value of the Trending Items request. (required).</param>
30+
public FacetRequestScope(string facetName, string facetValue)
31+
{
32+
FacetName = facetName ?? throw new ArgumentNullException(nameof(facetName));
33+
FacetValue = facetValue ?? throw new ArgumentNullException(nameof(facetValue));
34+
}
35+
36+
/// <summary>
37+
/// Facet attribute of the Trending Items request.
38+
/// </summary>
39+
/// <value>Facet attribute of the Trending Items request.</value>
40+
[JsonPropertyName("facetName")]
41+
public string FacetName { get; set; }
42+
43+
/// <summary>
44+
/// Facet value of the Trending Items request.
45+
/// </summary>
46+
/// <value>Facet value of the Trending Items request.</value>
47+
[JsonPropertyName("facetValue")]
48+
public string FacetValue { get; set; }
49+
50+
/// <summary>
51+
/// Returns the string presentation of the object
52+
/// </summary>
53+
/// <returns>String presentation of the object</returns>
54+
public override string ToString()
55+
{
56+
StringBuilder sb = new StringBuilder();
57+
sb.Append("class FacetRequestScope {\n");
58+
sb.Append(" FacetName: ").Append(FacetName).Append("\n");
59+
sb.Append(" FacetValue: ").Append(FacetValue).Append("\n");
60+
sb.Append("}\n");
61+
return sb.ToString();
62+
}
63+
64+
/// <summary>
65+
/// Returns the JSON string presentation of the object
66+
/// </summary>
67+
/// <returns>JSON string presentation of the object</returns>
68+
public virtual string ToJson()
69+
{
70+
return JsonSerializer.Serialize(this, JsonConfig.Options);
71+
}
72+
73+
/// <summary>
74+
/// Returns true if objects are equal
75+
/// </summary>
76+
/// <param name="obj">Object to be compared</param>
77+
/// <returns>Boolean</returns>
78+
public override bool Equals(object obj)
79+
{
80+
if (obj is not FacetRequestScope input)
81+
{
82+
return false;
83+
}
84+
85+
return (
86+
FacetName == input.FacetName || (FacetName != null && FacetName.Equals(input.FacetName))
87+
)
88+
&& (
89+
FacetValue == input.FacetValue
90+
|| (FacetValue != null && FacetValue.Equals(input.FacetValue))
91+
);
92+
}
93+
94+
/// <summary>
95+
/// Gets the hash code
96+
/// </summary>
97+
/// <returns>Hash code</returns>
98+
public override int GetHashCode()
99+
{
100+
unchecked // Overflow is fine, just wrap
101+
{
102+
int hashCode = 41;
103+
if (FacetName != null)
104+
{
105+
hashCode = (hashCode * 59) + FacetName.GetHashCode();
106+
}
107+
if (FacetValue != null)
108+
{
109+
hashCode = (hashCode * 59) + FacetValue.GetHashCode();
110+
}
111+
return hashCode;
112+
}
113+
}
114+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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.Collections.Generic;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Text.Json;
9+
using System.Text.Json.Serialization;
10+
using Algolia.Search.Serializer;
11+
12+
namespace Algolia.Search.Models.Recommend;
13+
14+
/// <summary>
15+
/// Apply the rule only to Trending Items requests without `facetName` and `facetValue`.
16+
/// </summary>
17+
public partial class GlobalRequestScope
18+
{
19+
/// <summary>
20+
/// Initializes a new instance of the GlobalRequestScope class.
21+
/// </summary>
22+
[JsonConstructor]
23+
public GlobalRequestScope() { }
24+
25+
/// <summary>
26+
/// Initializes a new instance of the GlobalRequestScope class.
27+
/// </summary>
28+
/// <param name="global">Whether the rule applies to requests without a facet. Must be `true`. (required).</param>
29+
public GlobalRequestScope(bool global)
30+
{
31+
Global = global;
32+
}
33+
34+
/// <summary>
35+
/// Whether the rule applies to requests without a facet. Must be `true`.
36+
/// </summary>
37+
/// <value>Whether the rule applies to requests without a facet. Must be `true`.</value>
38+
[JsonPropertyName("global")]
39+
public bool Global { get; set; }
40+
41+
/// <summary>
42+
/// Returns the string presentation of the object
43+
/// </summary>
44+
/// <returns>String presentation of the object</returns>
45+
public override string ToString()
46+
{
47+
StringBuilder sb = new StringBuilder();
48+
sb.Append("class GlobalRequestScope {\n");
49+
sb.Append(" Global: ").Append(Global).Append("\n");
50+
sb.Append("}\n");
51+
return sb.ToString();
52+
}
53+
54+
/// <summary>
55+
/// Returns the JSON string presentation of the object
56+
/// </summary>
57+
/// <returns>JSON string presentation of the object</returns>
58+
public virtual string ToJson()
59+
{
60+
return JsonSerializer.Serialize(this, JsonConfig.Options);
61+
}
62+
63+
/// <summary>
64+
/// Returns true if objects are equal
65+
/// </summary>
66+
/// <param name="obj">Object to be compared</param>
67+
/// <returns>Boolean</returns>
68+
public override bool Equals(object obj)
69+
{
70+
if (obj is not GlobalRequestScope input)
71+
{
72+
return false;
73+
}
74+
75+
return (Global == input.Global || Global.Equals(input.Global));
76+
}
77+
78+
/// <summary>
79+
/// Gets the hash code
80+
/// </summary>
81+
/// <returns>Hash code</returns>
82+
public override int GetHashCode()
83+
{
84+
unchecked // Overflow is fine, just wrap
85+
{
86+
int hashCode = 41;
87+
hashCode = (hashCode * 59) + Global.GetHashCode();
88+
return hashCode;
89+
}
90+
}
91+
}

‎algoliasearch/Models/Recommend/RecommendModels.cs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ public enum RecommendModels
3030
BoughtTogether = 2,
3131

3232
/// <summary>
33-
/// Enum TrendingFacets for value: trending-facets
33+
/// Enum TrendingItems for value: trending-items
3434
/// </summary>
35-
[JsonPropertyName("trending-facets")]
36-
TrendingFacets = 3,
35+
[JsonPropertyName("trending-items")]
36+
TrendingItems = 3,
3737

3838
/// <summary>
39-
/// Enum TrendingItems for value: trending-items
39+
/// Enum LookingSimilar for value: looking-similar
4040
/// </summary>
41-
[JsonPropertyName("trending-items")]
42-
TrendingItems = 4,
41+
[JsonPropertyName("looking-similar")]
42+
LookingSimilar = 4,
4343
}

0 commit comments

Comments
 (0)