Skip to content

Commit a1324e4

Browse files
Merge branch 'main' into fix/allow-update-secrets (generated)
Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 913454d commit a1324e4

File tree

49 files changed

+439
-209
lines changed

Some content is hidden

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

49 files changed

+439
-209
lines changed

clients/algoliasearch-client-csharp/algoliasearch/Models/Ingestion/AuthInputPartial.cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ public AuthInputPartial(AuthAlgoliaInsightsPartial actualInstance)
8080
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
8181
}
8282

83+
/// <summary>
84+
/// Initializes a new instance of the AuthInputPartial class
85+
/// with a Dictionary{string, string}
86+
/// </summary>
87+
/// <param name="actualInstance">An instance of Dictionary&lt;string, string&gt;.</param>
88+
public AuthInputPartial(Dictionary<string, string> actualInstance)
89+
{
90+
ActualInstance = actualInstance;
91+
}
92+
8393

8494
/// <summary>
8595
/// Gets or Sets ActualInstance
@@ -146,6 +156,16 @@ public AuthAlgoliaInsightsPartial AsAuthAlgoliaInsightsPartial()
146156
return (AuthAlgoliaInsightsPartial)ActualInstance;
147157
}
148158

159+
/// <summary>
160+
/// Get the actual instance of `Dictionary{string, string}`. If the actual instance is not `Dictionary{string, string}`,
161+
/// the InvalidClassException will be thrown
162+
/// </summary>
163+
/// <returns>An instance of Dictionary&lt;string, string&gt;</returns>
164+
public Dictionary<string, string> AsDictionaryString()
165+
{
166+
return (Dictionary<string, string>)ActualInstance;
167+
}
168+
149169

150170
/// <summary>
151171
/// Check if the actual instance is of `AuthGoogleServiceAccountPartial` type.
@@ -201,6 +221,15 @@ public bool IsAuthAlgoliaInsightsPartial()
201221
return ActualInstance.GetType() == typeof(AuthAlgoliaInsightsPartial);
202222
}
203223

224+
/// <summary>
225+
/// Check if the actual instance is of `Dictionary{string, string}` type.
226+
/// </summary>
227+
/// <returns>Whether or not the instance is the type</returns>
228+
public bool IsDictionaryString()
229+
{
230+
return ActualInstance.GetType() == typeof(Dictionary<string, string>);
231+
}
232+
204233
/// <summary>
205234
/// Returns the string presentation of the object
206235
/// </summary>
@@ -357,6 +386,18 @@ public override AuthInputPartial Read(ref Utf8JsonReader reader, Type typeToConv
357386
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into AuthAlgoliaInsightsPartial: {exception}");
358387
}
359388
}
389+
if (root.ValueKind == JsonValueKind.Object)
390+
{
391+
try
392+
{
393+
return new AuthInputPartial(jsonDocument.Deserialize<Dictionary<string, string>>(JsonConfig.Options));
394+
}
395+
catch (Exception exception)
396+
{
397+
// deserialization failed, try the next one
398+
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into Dictionary<string, string>: {exception}");
399+
}
400+
}
360401
throw new InvalidDataException($"The JSON string cannot be deserialized into any schema defined.");
361402
}
362403

clients/algoliasearch-client-go/algolia/abtesting/client.go

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

clients/algoliasearch-client-go/algolia/analytics/client.go

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

clients/algoliasearch-client-go/algolia/ingestion/model_auth_input_partial.go

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

clients/algoliasearch-client-go/algolia/insights/client.go

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

clients/algoliasearch-client-go/algolia/monitoring/client.go

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

clients/algoliasearch-client-go/algolia/personalization/client.go

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

clients/algoliasearch-client-go/algolia/query-suggestions/client.go

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

clients/algoliasearch-client-go/algolia/recommend/client.go

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

clients/algoliasearch-client-go/algolia/search/api_search.go

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

clients/algoliasearch-client-go/algolia/search/client.go

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

clients/algoliasearch-client-java/algoliasearch/src/main/java/com/algolia/model/ingestion/AuthInputPartial.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,44 @@
66
import com.algolia.exceptions.AlgoliaRuntimeException;
77
import com.fasterxml.jackson.annotation.*;
88
import com.fasterxml.jackson.core.*;
9+
import com.fasterxml.jackson.core.type.TypeReference;
910
import com.fasterxml.jackson.databind.*;
1011
import com.fasterxml.jackson.databind.annotation.*;
1112
import java.io.IOException;
13+
import java.util.Map;
1214
import java.util.logging.Logger;
1315

1416
/** AuthInputPartial */
1517
@JsonDeserialize(using = AuthInputPartial.Deserializer.class)
1618
public interface AuthInputPartial {
19+
// AuthInputPartial as Map<String, String> wrapper.
20+
static AuthInputPartial of(Map<String, String> value) {
21+
return new MapOfStringStringWrapper(value);
22+
}
23+
24+
// AuthInputPartial as Map<String, String> wrapper.
25+
@JsonSerialize(using = MapOfStringStringWrapper.Serializer.class)
26+
class MapOfStringStringWrapper implements AuthInputPartial {
27+
28+
private final Map<String, String> value;
29+
30+
MapOfStringStringWrapper(Map<String, String> value) {
31+
this.value = value;
32+
}
33+
34+
public Map<String, String> getValue() {
35+
return value;
36+
}
37+
38+
static class Serializer extends JsonSerializer<MapOfStringStringWrapper> {
39+
40+
@Override
41+
public void serialize(MapOfStringStringWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException {
42+
gen.writeObject(value.getValue());
43+
}
44+
}
45+
}
46+
1747
class Deserializer extends JsonDeserializer<AuthInputPartial> {
1848

1949
private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName());
@@ -81,6 +111,16 @@ public AuthInputPartial deserialize(JsonParser jp, DeserializationContext ctxt)
81111
);
82112
}
83113
}
114+
// deserialize Map<String, String>
115+
if (tree.isObject()) {
116+
try (JsonParser parser = tree.traverse(jp.getCodec())) {
117+
Map<String, String> value = parser.readValueAs(new TypeReference<Map<String, String>>() {});
118+
return new AuthInputPartial.MapOfStringStringWrapper(value);
119+
} catch (Exception e) {
120+
// deserialization failed, continue
121+
LOGGER.finest("Failed to deserialize oneOf Map<String, String> (error: " + e.getMessage() + ") (type: Map<String, String>)");
122+
}
123+
}
84124
throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree));
85125
}
86126

clients/algoliasearch-client-javascript/packages/ingestion/model/authInputPartial.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ export type AuthInputPartial =
1313
| AuthAPIKeyPartial
1414
| AuthOAuthPartial
1515
| AuthAlgoliaPartial
16-
| AuthAlgoliaInsightsPartial;
16+
| AuthAlgoliaInsightsPartial
17+
| { [key: string]: string };

0 commit comments

Comments
 (0)