Skip to content

Commit

Permalink
chore: generated code for commit 4108aba. [skip ci]
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Millot <[email protected]>
  • Loading branch information
algolia-bot and millotp committed Feb 2, 2024
1 parent 4108aba commit 3a3d05a
Show file tree
Hide file tree
Showing 77 changed files with 2,772 additions and 410 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ public HighlightResult(Dictionary<string, HighlightResultOption> actualInstance)
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}

/// <summary>
/// Initializes a new instance of the HighlightResult class
/// with a List{HighlightResultOption}
/// </summary>
/// <param name="actualInstance">An instance of List&lt;HighlightResultOption&gt;.</param>
public HighlightResult(List<HighlightResultOption> actualInstance)
{
IsNullable = false;
SchemaType = "oneOf";
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}


/// <summary>
/// Gets or Sets ActualInstance
Expand All @@ -77,6 +89,16 @@ public Dictionary<string, HighlightResultOption> AsDictionary()
return (Dictionary<string, HighlightResultOption>)ActualInstance;
}

/// <summary>
/// Get the actual instance of `List{HighlightResultOption}`. If the actual instance is not `List{HighlightResultOption}`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of List&lt;HighlightResultOption&gt;</returns>
public List<HighlightResultOption> AsList()
{
return (List<HighlightResultOption>)ActualInstance;
}


/// <summary>
/// Check if the actual instance is of `HighlightResultOption` type.
Expand All @@ -96,6 +118,15 @@ public bool IsDictionary()
return ActualInstance.GetType() == typeof(Dictionary<string, HighlightResultOption>);
}

/// <summary>
/// Check if the actual instance is of `List{HighlightResultOption}` type.
/// </summary>
/// <returns>Whether or not the instance is the type</returns>
public bool IsList()
{
return ActualInstance.GetType() == typeof(List<HighlightResultOption>);
}

/// <summary>
/// Returns the string presentation of the object
/// </summary>
Expand Down Expand Up @@ -149,6 +180,15 @@ public static HighlightResult FromJson(string jsonString)
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize `{jsonString}` into Dictionary<string, HighlightResultOption>: {exception}");
}
try
{
return new HighlightResult(JsonConvert.DeserializeObject<List<HighlightResultOption>>(jsonString, AdditionalPropertiesSerializerSettings));
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize `{jsonString}` into List<HighlightResultOption>: {exception}");
}

throw new InvalidDataException($"The JSON string `{jsonString}` cannot be deserialized into any schema defined.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ public SnippetResult(Dictionary<string, SnippetResultOption> actualInstance)
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}

/// <summary>
/// Initializes a new instance of the SnippetResult class
/// with a List{SnippetResultOption}
/// </summary>
/// <param name="actualInstance">An instance of List&lt;SnippetResultOption&gt;.</param>
public SnippetResult(List<SnippetResultOption> actualInstance)
{
IsNullable = false;
SchemaType = "oneOf";
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}


/// <summary>
/// Gets or Sets ActualInstance
Expand All @@ -77,6 +89,16 @@ public Dictionary<string, SnippetResultOption> AsDictionary()
return (Dictionary<string, SnippetResultOption>)ActualInstance;
}

/// <summary>
/// Get the actual instance of `List{SnippetResultOption}`. If the actual instance is not `List{SnippetResultOption}`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of List&lt;SnippetResultOption&gt;</returns>
public List<SnippetResultOption> AsList()
{
return (List<SnippetResultOption>)ActualInstance;
}


/// <summary>
/// Check if the actual instance is of `SnippetResultOption` type.
Expand All @@ -96,6 +118,15 @@ public bool IsDictionary()
return ActualInstance.GetType() == typeof(Dictionary<string, SnippetResultOption>);
}

/// <summary>
/// Check if the actual instance is of `List{SnippetResultOption}` type.
/// </summary>
/// <returns>Whether or not the instance is the type</returns>
public bool IsList()
{
return ActualInstance.GetType() == typeof(List<SnippetResultOption>);
}

/// <summary>
/// Returns the string presentation of the object
/// </summary>
Expand Down Expand Up @@ -149,6 +180,15 @@ public static SnippetResult FromJson(string jsonString)
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize `{jsonString}` into Dictionary<string, SnippetResultOption>: {exception}");
}
try
{
return new SnippetResult(JsonConvert.DeserializeObject<List<SnippetResultOption>>(jsonString, AdditionalPropertiesSerializerSettings));
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize `{jsonString}` into List<SnippetResultOption>: {exception}");
}

throw new InvalidDataException($"The JSON string `{jsonString}` cannot be deserialized into any schema defined.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ public HighlightResult(Dictionary<string, HighlightResultOption> actualInstance)
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}

/// <summary>
/// Initializes a new instance of the HighlightResult class
/// with a List{HighlightResultOption}
/// </summary>
/// <param name="actualInstance">An instance of List&lt;HighlightResultOption&gt;.</param>
public HighlightResult(List<HighlightResultOption> actualInstance)
{
IsNullable = false;
SchemaType = "oneOf";
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}


/// <summary>
/// Gets or Sets ActualInstance
Expand All @@ -77,6 +89,16 @@ public Dictionary<string, HighlightResultOption> AsDictionary()
return (Dictionary<string, HighlightResultOption>)ActualInstance;
}

/// <summary>
/// Get the actual instance of `List{HighlightResultOption}`. If the actual instance is not `List{HighlightResultOption}`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of List&lt;HighlightResultOption&gt;</returns>
public List<HighlightResultOption> AsList()
{
return (List<HighlightResultOption>)ActualInstance;
}


/// <summary>
/// Check if the actual instance is of `HighlightResultOption` type.
Expand All @@ -96,6 +118,15 @@ public bool IsDictionary()
return ActualInstance.GetType() == typeof(Dictionary<string, HighlightResultOption>);
}

/// <summary>
/// Check if the actual instance is of `List{HighlightResultOption}` type.
/// </summary>
/// <returns>Whether or not the instance is the type</returns>
public bool IsList()
{
return ActualInstance.GetType() == typeof(List<HighlightResultOption>);
}

/// <summary>
/// Returns the string presentation of the object
/// </summary>
Expand Down Expand Up @@ -149,6 +180,15 @@ public static HighlightResult FromJson(string jsonString)
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize `{jsonString}` into Dictionary<string, HighlightResultOption>: {exception}");
}
try
{
return new HighlightResult(JsonConvert.DeserializeObject<List<HighlightResultOption>>(jsonString, AdditionalPropertiesSerializerSettings));
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize `{jsonString}` into List<HighlightResultOption>: {exception}");
}

throw new InvalidDataException($"The JSON string `{jsonString}` cannot be deserialized into any schema defined.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ public SnippetResult(Dictionary<string, SnippetResultOption> actualInstance)
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}

/// <summary>
/// Initializes a new instance of the SnippetResult class
/// with a List{SnippetResultOption}
/// </summary>
/// <param name="actualInstance">An instance of List&lt;SnippetResultOption&gt;.</param>
public SnippetResult(List<SnippetResultOption> actualInstance)
{
IsNullable = false;
SchemaType = "oneOf";
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}


/// <summary>
/// Gets or Sets ActualInstance
Expand All @@ -77,6 +89,16 @@ public Dictionary<string, SnippetResultOption> AsDictionary()
return (Dictionary<string, SnippetResultOption>)ActualInstance;
}

/// <summary>
/// Get the actual instance of `List{SnippetResultOption}`. If the actual instance is not `List{SnippetResultOption}`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of List&lt;SnippetResultOption&gt;</returns>
public List<SnippetResultOption> AsList()
{
return (List<SnippetResultOption>)ActualInstance;
}


/// <summary>
/// Check if the actual instance is of `SnippetResultOption` type.
Expand All @@ -96,6 +118,15 @@ public bool IsDictionary()
return ActualInstance.GetType() == typeof(Dictionary<string, SnippetResultOption>);
}

/// <summary>
/// Check if the actual instance is of `List{SnippetResultOption}` type.
/// </summary>
/// <returns>Whether or not the instance is the type</returns>
public bool IsList()
{
return ActualInstance.GetType() == typeof(List<SnippetResultOption>);
}

/// <summary>
/// Returns the string presentation of the object
/// </summary>
Expand Down Expand Up @@ -149,6 +180,15 @@ public static SnippetResult FromJson(string jsonString)
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize `{jsonString}` into Dictionary<string, SnippetResultOption>: {exception}");
}
try
{
return new SnippetResult(JsonConvert.DeserializeObject<List<SnippetResultOption>>(jsonString, AdditionalPropertiesSerializerSettings));
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize `{jsonString}` into List<SnippetResultOption>: {exception}");
}

throw new InvalidDataException($"The JSON string `{jsonString}` cannot be deserialized into any schema defined.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ final class UserHighlightResult {

/// One of types:
/// - [Map<String, HighlightResultOption>]
/// - [List<HighlightResultOption>]
/// - [HighlightResultOption]
@JsonKey(name: r'userID')
final dynamic userID;

/// One of types:
/// - [Map<String, HighlightResultOption>]
/// - [List<HighlightResultOption>]
/// - [HighlightResultOption]
@JsonKey(name: r'clusterName')
final dynamic clusterName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,16 @@ func (o ErrorBase) MarshalJSON() ([]byte, error) {
return serialized, nil
}

func (o *ErrorBase) UnmarshalJSON(bytes []byte) (err error) {
func (o *ErrorBase) UnmarshalJSON(bytes []byte) error {
varErrorBase := _ErrorBase{}

if err = json.Unmarshal(bytes, &varErrorBase); err == nil {
*o = ErrorBase(varErrorBase)
err := json.Unmarshal(bytes, &varErrorBase)
if err != nil {
return fmt.Errorf("failed to unmarshal ErrorBase: %w", err)
}

*o = ErrorBase(varErrorBase)

additionalProperties := make(map[string]any)

err = json.Unmarshal(bytes, &additionalProperties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,16 @@ func (o ErrorBase) MarshalJSON() ([]byte, error) {
return serialized, nil
}

func (o *ErrorBase) UnmarshalJSON(bytes []byte) (err error) {
func (o *ErrorBase) UnmarshalJSON(bytes []byte) error {
varErrorBase := _ErrorBase{}

if err = json.Unmarshal(bytes, &varErrorBase); err == nil {
*o = ErrorBase(varErrorBase)
err := json.Unmarshal(bytes, &varErrorBase)
if err != nil {
return fmt.Errorf("failed to unmarshal ErrorBase: %w", err)
}

*o = ErrorBase(varErrorBase)

additionalProperties := make(map[string]any)

err = json.Unmarshal(bytes, &additionalProperties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,16 @@ func (o ErrorBase) MarshalJSON() ([]byte, error) {
return serialized, nil
}

func (o *ErrorBase) UnmarshalJSON(bytes []byte) (err error) {
func (o *ErrorBase) UnmarshalJSON(bytes []byte) error {
varErrorBase := _ErrorBase{}

if err = json.Unmarshal(bytes, &varErrorBase); err == nil {
*o = ErrorBase(varErrorBase)
err := json.Unmarshal(bytes, &varErrorBase)
if err != nil {
return fmt.Errorf("failed to unmarshal ErrorBase: %w", err)
}

*o = ErrorBase(varErrorBase)

additionalProperties := make(map[string]any)

err = json.Unmarshal(bytes, &additionalProperties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,16 @@ func (o ErrorBase) MarshalJSON() ([]byte, error) {
return serialized, nil
}

func (o *ErrorBase) UnmarshalJSON(bytes []byte) (err error) {
func (o *ErrorBase) UnmarshalJSON(bytes []byte) error {
varErrorBase := _ErrorBase{}

if err = json.Unmarshal(bytes, &varErrorBase); err == nil {
*o = ErrorBase(varErrorBase)
err := json.Unmarshal(bytes, &varErrorBase)
if err != nil {
return fmt.Errorf("failed to unmarshal ErrorBase: %w", err)
}

*o = ErrorBase(varErrorBase)

additionalProperties := make(map[string]any)

err = json.Unmarshal(bytes, &additionalProperties)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,16 @@ func (o ErrorBase) MarshalJSON() ([]byte, error) {
return serialized, nil
}

func (o *ErrorBase) UnmarshalJSON(bytes []byte) (err error) {
func (o *ErrorBase) UnmarshalJSON(bytes []byte) error {
varErrorBase := _ErrorBase{}

if err = json.Unmarshal(bytes, &varErrorBase); err == nil {
*o = ErrorBase(varErrorBase)
err := json.Unmarshal(bytes, &varErrorBase)
if err != nil {
return fmt.Errorf("failed to unmarshal ErrorBase: %w", err)
}

*o = ErrorBase(varErrorBase)

additionalProperties := make(map[string]any)

err = json.Unmarshal(bytes, &additionalProperties)
Expand Down
Loading

0 comments on commit 3a3d05a

Please sign in to comment.