Skip to content

Commit 12035a7

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 4c5b57a commit 12035a7

File tree

2 files changed

+95
-1
lines changed

2 files changed

+95
-1
lines changed

algoliasearch/src/main/java/com/algolia/model/composition/Hit.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public class Hit {
3030
@JsonProperty("_distinctSeqID")
3131
private Integer distinctSeqID;
3232

33+
@JsonProperty("_extra")
34+
private HitMetadata extra;
35+
3336
private Map<String, Object> additionalProperties = new HashMap<>();
3437

3538
@JsonAnyGetter
@@ -114,6 +117,17 @@ public Integer getDistinctSeqID() {
114117
return distinctSeqID;
115118
}
116119

120+
public Hit setExtra(HitMetadata extra) {
121+
this.extra = extra;
122+
return this;
123+
}
124+
125+
/** Get extra */
126+
@javax.annotation.Nullable
127+
public HitMetadata getExtra() {
128+
return extra;
129+
}
130+
117131
@Override
118132
public boolean equals(Object o) {
119133
if (this == o) {
@@ -129,13 +143,14 @@ public boolean equals(Object o) {
129143
Objects.equals(this.snippetResult, hit.snippetResult) &&
130144
Objects.equals(this.rankingInfo, hit.rankingInfo) &&
131145
Objects.equals(this.distinctSeqID, hit.distinctSeqID) &&
146+
Objects.equals(this.extra, hit.extra) &&
132147
super.equals(o)
133148
);
134149
}
135150

136151
@Override
137152
public int hashCode() {
138-
return Objects.hash(objectID, highlightResult, snippetResult, rankingInfo, distinctSeqID, super.hashCode());
153+
return Objects.hash(objectID, highlightResult, snippetResult, rankingInfo, distinctSeqID, extra, super.hashCode());
139154
}
140155

141156
@Override
@@ -148,6 +163,7 @@ public String toString() {
148163
sb.append(" snippetResult: ").append(toIndentedString(snippetResult)).append("\n");
149164
sb.append(" rankingInfo: ").append(toIndentedString(rankingInfo)).append("\n");
150165
sb.append(" distinctSeqID: ").append(toIndentedString(distinctSeqID)).append("\n");
166+
sb.append(" extra: ").append(toIndentedString(extra)).append("\n");
151167
sb.append("}");
152168
return sb.toString();
153169
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
2+
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
package com.algolia.model.composition;
5+
6+
import com.fasterxml.jackson.annotation.*;
7+
import com.fasterxml.jackson.databind.annotation.*;
8+
import java.util.HashMap;
9+
import java.util.Map;
10+
import java.util.Objects;
11+
12+
/** An object that contains the extra key-value pairs provided in the injectedItem definition. */
13+
public class HitMetadata {
14+
15+
@JsonProperty("_injectedItemKey")
16+
private String injectedItemKey;
17+
18+
private Map<String, Object> additionalProperties = new HashMap<>();
19+
20+
@JsonAnyGetter
21+
public Map<String, Object> getAdditionalProperties() {
22+
return this.additionalProperties;
23+
}
24+
25+
@JsonAnySetter
26+
public HitMetadata setAdditionalProperty(String name, Object value) {
27+
this.additionalProperties.put(name, value);
28+
return this;
29+
}
30+
31+
public HitMetadata setInjectedItemKey(String injectedItemKey) {
32+
this.injectedItemKey = injectedItemKey;
33+
return this;
34+
}
35+
36+
/** The key of the injectedItem that inserted this metadata. */
37+
@javax.annotation.Nullable
38+
public String getInjectedItemKey() {
39+
return injectedItemKey;
40+
}
41+
42+
@Override
43+
public boolean equals(Object o) {
44+
if (this == o) {
45+
return true;
46+
}
47+
if (o == null || getClass() != o.getClass()) {
48+
return false;
49+
}
50+
HitMetadata hitMetadata = (HitMetadata) o;
51+
return Objects.equals(this.injectedItemKey, hitMetadata.injectedItemKey) && super.equals(o);
52+
}
53+
54+
@Override
55+
public int hashCode() {
56+
return Objects.hash(injectedItemKey, super.hashCode());
57+
}
58+
59+
@Override
60+
public String toString() {
61+
StringBuilder sb = new StringBuilder();
62+
sb.append("class HitMetadata {\n");
63+
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
64+
sb.append(" injectedItemKey: ").append(toIndentedString(injectedItemKey)).append("\n");
65+
sb.append("}");
66+
return sb.toString();
67+
}
68+
69+
/**
70+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
71+
*/
72+
private String toIndentedString(Object o) {
73+
if (o == null) {
74+
return "null";
75+
}
76+
return o.toString().replace("\n", "\n ");
77+
}
78+
}

0 commit comments

Comments
 (0)