Skip to content

Commit 1e93019

Browse files
feat(specs): add fields for metadata in composition injectedItems (generated)
algolia/api-clients-automation#5241 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Gavin Wade <[email protected]>
1 parent a183fdb commit 1e93019

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed

algoliasearch/Models/Composition/Hit.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ public Hit(string objectID)
6868
[JsonPropertyName("_distinctSeqID")]
6969
public int? DistinctSeqID { get; set; }
7070

71+
/// <summary>
72+
/// Gets or Sets Extra
73+
/// </summary>
74+
[JsonPropertyName("_extra")]
75+
public HitMetadata Extra { get; set; }
76+
7177
/// <summary>
7278
/// Gets or Sets additional properties
7379
/// </summary>
@@ -87,6 +93,7 @@ public override string ToString()
8793
sb.Append(" SnippetResult: ").Append(SnippetResult).Append("\n");
8894
sb.Append(" RankingInfo: ").Append(RankingInfo).Append("\n");
8995
sb.Append(" DistinctSeqID: ").Append(DistinctSeqID).Append("\n");
96+
sb.Append(" Extra: ").Append(Extra).Append("\n");
9097
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
9198
sb.Append("}\n");
9299
return sb.ToString();
@@ -131,6 +138,7 @@ public override bool Equals(object obj)
131138
|| (RankingInfo != null && RankingInfo.Equals(input.RankingInfo))
132139
)
133140
&& (DistinctSeqID == input.DistinctSeqID || DistinctSeqID.Equals(input.DistinctSeqID))
141+
&& (Extra == input.Extra || (Extra != null && Extra.Equals(input.Extra)))
134142
&& (
135143
AdditionalProperties.Count == input.AdditionalProperties.Count
136144
&& !AdditionalProperties.Except(input.AdditionalProperties).Any()
@@ -163,6 +171,10 @@ public override int GetHashCode()
163171
hashCode = (hashCode * 59) + RankingInfo.GetHashCode();
164172
}
165173
hashCode = (hashCode * 59) + DistinctSeqID.GetHashCode();
174+
if (Extra != null)
175+
{
176+
hashCode = (hashCode * 59) + Extra.GetHashCode();
177+
}
166178
if (AdditionalProperties != null)
167179
{
168180
hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode();
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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+
/// An object that contains the extra key-value pairs provided in the injectedItem definition.
16+
/// </summary>
17+
public partial class HitMetadata
18+
{
19+
/// <summary>
20+
/// Initializes a new instance of the HitMetadata class.
21+
/// </summary>
22+
public HitMetadata()
23+
{
24+
AdditionalProperties = new Dictionary<string, object>();
25+
}
26+
27+
/// <summary>
28+
/// The key of the injectedItem that inserted this metadata.
29+
/// </summary>
30+
/// <value>The key of the injectedItem that inserted this metadata.</value>
31+
[JsonPropertyName("_injectedItemKey")]
32+
public string InjectedItemKey { get; set; }
33+
34+
/// <summary>
35+
/// Gets or Sets additional properties
36+
/// </summary>
37+
[JsonExtensionData]
38+
public IDictionary<string, object> AdditionalProperties { get; set; }
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 HitMetadata {\n");
48+
sb.Append(" InjectedItemKey: ").Append(InjectedItemKey).Append("\n");
49+
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).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 HitMetadata input)
71+
{
72+
return false;
73+
}
74+
75+
return (
76+
InjectedItemKey == input.InjectedItemKey
77+
|| (InjectedItemKey != null && InjectedItemKey.Equals(input.InjectedItemKey))
78+
)
79+
&& (
80+
AdditionalProperties.Count == input.AdditionalProperties.Count
81+
&& !AdditionalProperties.Except(input.AdditionalProperties).Any()
82+
);
83+
}
84+
85+
/// <summary>
86+
/// Gets the hash code
87+
/// </summary>
88+
/// <returns>Hash code</returns>
89+
public override int GetHashCode()
90+
{
91+
unchecked // Overflow is fine, just wrap
92+
{
93+
int hashCode = 41;
94+
if (InjectedItemKey != null)
95+
{
96+
hashCode = (hashCode * 59) + InjectedItemKey.GetHashCode();
97+
}
98+
if (AdditionalProperties != null)
99+
{
100+
hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode();
101+
}
102+
return hashCode;
103+
}
104+
}
105+
}

0 commit comments

Comments
 (0)