Skip to content

Commit f665353

Browse files
algolia-botben-kalmusClaraMuller
committed
feat(specs): add compositions deduplication setting (#5418) (generated) [skip ci]
Co-authored-by: Ben Kalmus <[email protected]> Co-authored-by: Clara Muller <[email protected]>
1 parent 7de9435 commit f665353

File tree

99 files changed

+6689
-1605
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+6689
-1605
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+
}

clients/algoliasearch-client-csharp/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
}

clients/algoliasearch-client-dart/packages/client_composition/lib/algolia_client_composition.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export 'src/model/composition_source.dart';
3232
export 'src/model/composition_source_search.dart';
3333
export 'src/model/compositions_search_response.dart';
3434
export 'src/model/condition.dart';
35+
export 'src/model/dedup_positioning.dart';
36+
export 'src/model/deduplication.dart';
3537
export 'src/model/delete_composition_action.dart';
3638
export 'src/model/delete_composition_rule_action.dart';
3739
export 'src/model/error_base.dart';

clients/algoliasearch-client-dart/packages/client_composition/lib/src/deserialize.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import 'package:algolia_client_composition/src/model/composition_source.dart';
2525
import 'package:algolia_client_composition/src/model/composition_source_search.dart';
2626
import 'package:algolia_client_composition/src/model/compositions_search_response.dart';
2727
import 'package:algolia_client_composition/src/model/condition.dart';
28+
import 'package:algolia_client_composition/src/model/dedup_positioning.dart';
29+
import 'package:algolia_client_composition/src/model/deduplication.dart';
2830
import 'package:algolia_client_composition/src/model/delete_composition_action.dart';
2931
import 'package:algolia_client_composition/src/model/delete_composition_rule_action.dart';
3032
import 'package:algolia_client_composition/src/model/error_base.dart';
@@ -184,6 +186,11 @@ ReturnType deserialize<ReturnType, BaseType>(dynamic value, String targetType,
184186
as ReturnType;
185187
case 'Condition':
186188
return Condition.fromJson(value as Map<String, dynamic>) as ReturnType;
189+
case 'DedupPositioning':
190+
return DedupPositioning.fromJson(value) as ReturnType;
191+
case 'Deduplication':
192+
return Deduplication.fromJson(value as Map<String, dynamic>)
193+
as ReturnType;
187194
case 'DeleteCompositionAction':
188195
return DeleteCompositionAction.fromJson(value as Map<String, dynamic>)
189196
as ReturnType;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// 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.
2+
// ignore_for_file: unused_element
3+
import 'package:json_annotation/json_annotation.dart';
4+
5+
/// 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).
6+
@JsonEnum(valueField: 'raw')
7+
enum DedupPositioning {
8+
highest(r'highest'),
9+
highestInjected(r'highestInjected');
10+
11+
const DedupPositioning(this.raw);
12+
final dynamic raw;
13+
14+
dynamic toJson() => raw;
15+
16+
static DedupPositioning fromJson(dynamic json) {
17+
for (final value in values) {
18+
if (value.raw == json) return value;
19+
}
20+
throw ArgumentError.value(json, "raw", "No enum value with that value");
21+
}
22+
23+
@override
24+
String toString() => raw.toString();
25+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// 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.
2+
// ignore_for_file: unused_element
3+
import 'package:algolia_client_composition/src/model/dedup_positioning.dart';
4+
5+
import 'package:json_annotation/json_annotation.dart';
6+
7+
part 'deduplication.g.dart';
8+
9+
@JsonSerializable()
10+
final class Deduplication {
11+
/// Returns a new [Deduplication] instance.
12+
const Deduplication({
13+
required this.positioning,
14+
});
15+
16+
@JsonKey(name: r'positioning')
17+
final DedupPositioning positioning;
18+
19+
@override
20+
bool operator ==(Object other) =>
21+
identical(this, other) ||
22+
other is Deduplication && other.positioning == positioning;
23+
24+
@override
25+
int get hashCode => positioning.hashCode;
26+
27+
factory Deduplication.fromJson(Map<String, dynamic> json) =>
28+
_$DeduplicationFromJson(json);
29+
30+
Map<String, dynamic> toJson() => _$DeduplicationToJson(this);
31+
32+
@override
33+
String toString() {
34+
return toJson().toString();
35+
}
36+
}

clients/algoliasearch-client-dart/packages/client_composition/lib/src/model/deduplication.g.dart

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/algoliasearch-client-dart/packages/client_composition/lib/src/model/injection.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// ignore_for_file: unused_element
33
import 'package:algolia_client_composition/src/model/injected_item.dart';
44
import 'package:algolia_client_composition/src/model/main.dart';
5+
import 'package:algolia_client_composition/src/model/deduplication.dart';
56

67
import 'package:json_annotation/json_annotation.dart';
78

@@ -13,6 +14,7 @@ final class Injection {
1314
const Injection({
1415
required this.main,
1516
this.injectedItems,
17+
this.deduplication,
1618
});
1719

1820
@JsonKey(name: r'main')
@@ -22,15 +24,20 @@ final class Injection {
2224
@JsonKey(name: r'injectedItems')
2325
final List<InjectedItem>? injectedItems;
2426

27+
@JsonKey(name: r'deduplication')
28+
final Deduplication? deduplication;
29+
2530
@override
2631
bool operator ==(Object other) =>
2732
identical(this, other) ||
2833
other is Injection &&
2934
other.main == main &&
30-
other.injectedItems == injectedItems;
35+
other.injectedItems == injectedItems &&
36+
other.deduplication == deduplication;
3137

3238
@override
33-
int get hashCode => main.hashCode + injectedItems.hashCode;
39+
int get hashCode =>
40+
main.hashCode + injectedItems.hashCode + deduplication.hashCode;
3441

3542
factory Injection.fromJson(Map<String, dynamic> json) =>
3643
_$InjectionFromJson(json);

clients/algoliasearch-client-dart/packages/client_composition/lib/src/model/injection.g.dart

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)