Skip to content

Commit 76d0f9a

Browse files
algolia-botben-kalmusClaraMuller
committed
feat(specs): add compositions deduplication setting (generated)
algolia/api-clients-automation#5418 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Ben Kalmus <[email protected]> Co-authored-by: Clara Muller <[email protected]>
1 parent 563efc9 commit 76d0f9a

File tree

3 files changed

+137
-0
lines changed

3 files changed

+137
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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.Composition;
13+
14+
/// <summary>
15+
/// Deduplication positioning configures how a duplicate result should be resolved between an injected item and main search results. Current configuration supports: - 'highest': always select the item in the highest position, and remove duplicates that appear lower in the results. - 'highestInjected': duplicate result will be moved to its highest possible injected position, but not higher. If a duplicate appears higher in main search results, it will be removed to stay it's intended group position (which could be lower than main).
16+
/// </summary>
17+
/// <value>Deduplication positioning configures how a duplicate result should be resolved between an injected item and main search results. Current configuration supports: - 'highest': always select the item in the highest position, and remove duplicates that appear lower in the results. - 'highestInjected': duplicate result will be moved to its highest possible injected position, but not higher. If a duplicate appears higher in main search results, it will be removed to stay it's intended group position (which could be lower than main). </value>
18+
[JsonConverter(typeof(Serializer.JsonStringEnumConverter<DedupPositioning>))]
19+
public enum DedupPositioning
20+
{
21+
/// <summary>
22+
/// Enum Highest for value: highest
23+
/// </summary>
24+
[JsonPropertyName("highest")]
25+
Highest = 1,
26+
27+
/// <summary>
28+
/// Enum HighestInjected for value: highestInjected
29+
/// </summary>
30+
[JsonPropertyName("highestInjected")]
31+
HighestInjected = 2,
32+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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.Composition;
13+
14+
/// <summary>
15+
/// Deduplication configures the methods used to resolve duplicate items between main search results and injected group results.
16+
/// </summary>
17+
public partial class Deduplication
18+
{
19+
/// <summary>
20+
/// Gets or Sets Positioning
21+
/// </summary>
22+
[JsonPropertyName("positioning")]
23+
public DedupPositioning? Positioning { get; set; }
24+
25+
/// <summary>
26+
/// Initializes a new instance of the Deduplication class.
27+
/// </summary>
28+
[JsonConstructor]
29+
public Deduplication() { }
30+
31+
/// <summary>
32+
/// Initializes a new instance of the Deduplication class.
33+
/// </summary>
34+
/// <param name="positioning">positioning (required).</param>
35+
public Deduplication(DedupPositioning? positioning)
36+
{
37+
Positioning = positioning;
38+
}
39+
40+
/// <summary>
41+
/// Returns the string presentation of the object
42+
/// </summary>
43+
/// <returns>String presentation of the object</returns>
44+
public override string ToString()
45+
{
46+
StringBuilder sb = new StringBuilder();
47+
sb.Append("class Deduplication {\n");
48+
sb.Append(" Positioning: ").Append(Positioning).Append("\n");
49+
sb.Append("}\n");
50+
return sb.ToString();
51+
}
52+
53+
/// <summary>
54+
/// Returns the JSON string presentation of the object
55+
/// </summary>
56+
/// <returns>JSON string presentation of the object</returns>
57+
public virtual string ToJson()
58+
{
59+
return JsonSerializer.Serialize(this, JsonConfig.Options);
60+
}
61+
62+
/// <summary>
63+
/// Returns true if objects are equal
64+
/// </summary>
65+
/// <param name="obj">Object to be compared</param>
66+
/// <returns>Boolean</returns>
67+
public override bool Equals(object obj)
68+
{
69+
if (obj is not Deduplication input)
70+
{
71+
return false;
72+
}
73+
74+
return (Positioning == input.Positioning || Positioning.Equals(input.Positioning));
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+
hashCode = (hashCode * 59) + Positioning.GetHashCode();
87+
return hashCode;
88+
}
89+
}
90+
}

algoliasearch/Models/Composition/Injection.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ public Injection(Main main)
4444
[JsonPropertyName("injectedItems")]
4545
public List<InjectedItem> InjectedItems { get; set; }
4646

47+
/// <summary>
48+
/// Gets or Sets Deduplication
49+
/// </summary>
50+
[JsonPropertyName("deduplication")]
51+
public Deduplication Deduplication { get; set; }
52+
4753
/// <summary>
4854
/// Returns the string presentation of the object
4955
/// </summary>
@@ -54,6 +60,7 @@ public override string ToString()
5460
sb.Append("class Injection {\n");
5561
sb.Append(" Main: ").Append(Main).Append("\n");
5662
sb.Append(" InjectedItems: ").Append(InjectedItems).Append("\n");
63+
sb.Append(" Deduplication: ").Append(Deduplication).Append("\n");
5764
sb.Append("}\n");
5865
return sb.ToString();
5966
}
@@ -85,6 +92,10 @@ public override bool Equals(object obj)
8592
|| InjectedItems != null
8693
&& input.InjectedItems != null
8794
&& InjectedItems.SequenceEqual(input.InjectedItems)
95+
)
96+
&& (
97+
Deduplication == input.Deduplication
98+
|| (Deduplication != null && Deduplication.Equals(input.Deduplication))
8899
);
89100
}
90101

@@ -105,6 +116,10 @@ public override int GetHashCode()
105116
{
106117
hashCode = (hashCode * 59) + InjectedItems.GetHashCode();
107118
}
119+
if (Deduplication != null)
120+
{
121+
hashCode = (hashCode * 59) + Deduplication.GetHashCode();
122+
}
108123
return hashCode;
109124
}
110125
}

0 commit comments

Comments
 (0)