Skip to content

Commit

Permalink
fix(specs): update search api specs [skip-bc] (#3760) (generated) [sk…
Browse files Browse the repository at this point in the history
…ip ci]

Co-authored-by: Thomas Raffray <[email protected]>
  • Loading branch information
algolia-bot and Fluf22 committed Sep 16, 2024
1 parent 638058e commit 9db7daf
Show file tree
Hide file tree
Showing 84 changed files with 955 additions and 1,688 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,10 @@ public HighlightResult(Dictionary<string, HighlightResult> actualInstance)

/// <summary>
/// Initializes a new instance of the HighlightResult class
/// with a Dictionary{string, HighlightResultOption}
/// with a List{HighlightResult}
/// </summary>
/// <param name="actualInstance">An instance of Dictionary&lt;string, HighlightResultOption&gt;.</param>
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)
/// <param name="actualInstance">An instance of List&lt;HighlightResult&gt;.</param>
public HighlightResult(List<HighlightResult> actualInstance)
{
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
Expand Down Expand Up @@ -87,23 +77,13 @@ public Dictionary<string, HighlightResult> AsDictionaryHighlightResult()
}

/// <summary>
/// Get the actual instance of `Dictionary{string, HighlightResultOption}`. If the actual instance is not `Dictionary{string, HighlightResultOption}`,
/// Get the actual instance of `List{HighlightResult}`. If the actual instance is not `List{HighlightResult}`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of Dictionary&lt;string, HighlightResultOption&gt;</returns>
public Dictionary<string, HighlightResultOption> AsDictionaryHighlightResultOption()
/// <returns>An instance of List&lt;HighlightResult&gt;</returns>
public List<HighlightResult> AsListHighlightResult()
{
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> AsListHighlightResultOption()
{
return (List<HighlightResultOption>)ActualInstance;
return (List<HighlightResult>)ActualInstance;
}


Expand All @@ -126,21 +106,12 @@ public bool IsDictionaryHighlightResult()
}

/// <summary>
/// Check if the actual instance is of `Dictionary{string, HighlightResultOption}` type.
/// Check if the actual instance is of `List{HighlightResult}` type.
/// </summary>
/// <returns>Whether or not the instance is the type</returns>
public bool IsDictionaryHighlightResultOption()
public bool IsListHighlightResult()
{
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 IsListHighlightResultOption()
{
return ActualInstance.GetType() == typeof(List<HighlightResultOption>);
return ActualInstance.GetType() == typeof(List<HighlightResult>);
}

/// <summary>
Expand Down Expand Up @@ -251,28 +222,16 @@ public override HighlightResult Read(ref Utf8JsonReader reader, Type typeToConve
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into Dictionary<string, HighlightResult>: {exception}");
}
}
if (root.ValueKind == JsonValueKind.Object)
{
try
{
return new HighlightResult(jsonDocument.Deserialize<Dictionary<string, HighlightResultOption>>(JsonConfig.Options));
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into Dictionary<string, HighlightResultOption>: {exception}");
}
}
if (root.ValueKind == JsonValueKind.Array)
{
try
{
return new HighlightResult(jsonDocument.Deserialize<List<HighlightResultOption>>(JsonConfig.Options));
return new HighlightResult(jsonDocument.Deserialize<List<HighlightResult>>(JsonConfig.Options));
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into List<HighlightResultOption>: {exception}");
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into List<HighlightResult>: {exception}");
}
}
throw new InvalidDataException($"The JSON string cannot be deserialized into any schema defined.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,10 @@ public RecommendationsResults() { }
/// Initializes a new instance of the RecommendationsResults class.
/// </summary>
/// <param name="processingTimeMS">Time the server took to process the request, in milliseconds. (required).</param>
/// <param name="page">Page of search results to retrieve. (required) (default to 0).</param>
/// <param name="nbHits">Number of results (hits). (required).</param>
/// <param name="nbPages">Number of pages of results. (required).</param>
/// <param name="hitsPerPage">Number of hits per page. (required) (default to 20).</param>
/// <param name="hits">hits (required).</param>
public RecommendationsResults(int processingTimeMS, int page, int nbHits, int nbPages, int hitsPerPage, List<RecommendationsHit> hits)
public RecommendationsResults(int processingTimeMS, List<RecommendationsHit> hits)
{
ProcessingTimeMS = processingTimeMS;
Page = page;
NbHits = nbHits;
NbPages = nbPages;
HitsPerPage = hitsPerPage;
Hits = hits ?? throw new ArgumentNullException(nameof(hits));
}

Expand Down Expand Up @@ -220,28 +212,28 @@ public RecommendationsResults(int processingTimeMS, int page, int nbHits, int nb
/// </summary>
/// <value>Page of search results to retrieve.</value>
[JsonPropertyName("page")]
public int Page { get; set; }
public int? Page { get; set; }

/// <summary>
/// Number of results (hits).
/// </summary>
/// <value>Number of results (hits).</value>
[JsonPropertyName("nbHits")]
public int NbHits { get; set; }
public int? NbHits { get; set; }

/// <summary>
/// Number of pages of results.
/// </summary>
/// <value>Number of pages of results.</value>
[JsonPropertyName("nbPages")]
public int NbPages { get; set; }
public int? NbPages { get; set; }

/// <summary>
/// Number of hits per page.
/// </summary>
/// <value>Number of hits per page.</value>
[JsonPropertyName("hitsPerPage")]
public int HitsPerPage { get; set; }
public int? HitsPerPage { get; set; }

/// <summary>
/// Gets or Sets Hits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,10 @@ public SnippetResult(Dictionary<string, SnippetResult> actualInstance)

/// <summary>
/// Initializes a new instance of the SnippetResult class
/// with a Dictionary{string, SnippetResultOption}
/// with a List{SnippetResult}
/// </summary>
/// <param name="actualInstance">An instance of Dictionary&lt;string, SnippetResultOption&gt;.</param>
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)
/// <param name="actualInstance">An instance of List&lt;SnippetResult&gt;.</param>
public SnippetResult(List<SnippetResult> actualInstance)
{
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
Expand Down Expand Up @@ -87,23 +77,13 @@ public Dictionary<string, SnippetResult> AsDictionarySnippetResult()
}

/// <summary>
/// Get the actual instance of `Dictionary{string, SnippetResultOption}`. If the actual instance is not `Dictionary{string, SnippetResultOption}`,
/// Get the actual instance of `List{SnippetResult}`. If the actual instance is not `List{SnippetResult}`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of Dictionary&lt;string, SnippetResultOption&gt;</returns>
public Dictionary<string, SnippetResultOption> AsDictionarySnippetResultOption()
/// <returns>An instance of List&lt;SnippetResult&gt;</returns>
public List<SnippetResult> AsListSnippetResult()
{
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> AsListSnippetResultOption()
{
return (List<SnippetResultOption>)ActualInstance;
return (List<SnippetResult>)ActualInstance;
}


Expand All @@ -126,21 +106,12 @@ public bool IsDictionarySnippetResult()
}

/// <summary>
/// Check if the actual instance is of `Dictionary{string, SnippetResultOption}` type.
/// Check if the actual instance is of `List{SnippetResult}` type.
/// </summary>
/// <returns>Whether or not the instance is the type</returns>
public bool IsDictionarySnippetResultOption()
public bool IsListSnippetResult()
{
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 IsListSnippetResultOption()
{
return ActualInstance.GetType() == typeof(List<SnippetResultOption>);
return ActualInstance.GetType() == typeof(List<SnippetResult>);
}

/// <summary>
Expand Down Expand Up @@ -251,28 +222,16 @@ public override SnippetResult Read(ref Utf8JsonReader reader, Type typeToConvert
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into Dictionary<string, SnippetResult>: {exception}");
}
}
if (root.ValueKind == JsonValueKind.Object)
{
try
{
return new SnippetResult(jsonDocument.Deserialize<Dictionary<string, SnippetResultOption>>(JsonConfig.Options));
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into Dictionary<string, SnippetResultOption>: {exception}");
}
}
if (root.ValueKind == JsonValueKind.Array)
{
try
{
return new SnippetResult(jsonDocument.Deserialize<List<SnippetResultOption>>(JsonConfig.Options));
return new SnippetResult(jsonDocument.Deserialize<List<SnippetResult>>(JsonConfig.Options));
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into List<SnippetResultOption>: {exception}");
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into List<SnippetResult>: {exception}");
}
}
throw new InvalidDataException($"The JSON string cannot be deserialized into any schema defined.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,10 @@ public HighlightResult(Dictionary<string, HighlightResult> actualInstance)

/// <summary>
/// Initializes a new instance of the HighlightResult class
/// with a Dictionary{string, HighlightResultOption}
/// with a List{HighlightResult}
/// </summary>
/// <param name="actualInstance">An instance of Dictionary&lt;string, HighlightResultOption&gt;.</param>
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)
/// <param name="actualInstance">An instance of List&lt;HighlightResult&gt;.</param>
public HighlightResult(List<HighlightResult> actualInstance)
{
ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null.");
}
Expand Down Expand Up @@ -87,23 +77,13 @@ public Dictionary<string, HighlightResult> AsDictionaryHighlightResult()
}

/// <summary>
/// Get the actual instance of `Dictionary{string, HighlightResultOption}`. If the actual instance is not `Dictionary{string, HighlightResultOption}`,
/// Get the actual instance of `List{HighlightResult}`. If the actual instance is not `List{HighlightResult}`,
/// the InvalidClassException will be thrown
/// </summary>
/// <returns>An instance of Dictionary&lt;string, HighlightResultOption&gt;</returns>
public Dictionary<string, HighlightResultOption> AsDictionaryHighlightResultOption()
/// <returns>An instance of List&lt;HighlightResult&gt;</returns>
public List<HighlightResult> AsListHighlightResult()
{
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> AsListHighlightResultOption()
{
return (List<HighlightResultOption>)ActualInstance;
return (List<HighlightResult>)ActualInstance;
}


Expand All @@ -126,21 +106,12 @@ public bool IsDictionaryHighlightResult()
}

/// <summary>
/// Check if the actual instance is of `Dictionary{string, HighlightResultOption}` type.
/// Check if the actual instance is of `List{HighlightResult}` type.
/// </summary>
/// <returns>Whether or not the instance is the type</returns>
public bool IsDictionaryHighlightResultOption()
public bool IsListHighlightResult()
{
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 IsListHighlightResultOption()
{
return ActualInstance.GetType() == typeof(List<HighlightResultOption>);
return ActualInstance.GetType() == typeof(List<HighlightResult>);
}

/// <summary>
Expand Down Expand Up @@ -251,28 +222,16 @@ public override HighlightResult Read(ref Utf8JsonReader reader, Type typeToConve
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into Dictionary<string, HighlightResult>: {exception}");
}
}
if (root.ValueKind == JsonValueKind.Object)
{
try
{
return new HighlightResult(jsonDocument.Deserialize<Dictionary<string, HighlightResultOption>>(JsonConfig.Options));
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into Dictionary<string, HighlightResultOption>: {exception}");
}
}
if (root.ValueKind == JsonValueKind.Array)
{
try
{
return new HighlightResult(jsonDocument.Deserialize<List<HighlightResultOption>>(JsonConfig.Options));
return new HighlightResult(jsonDocument.Deserialize<List<HighlightResult>>(JsonConfig.Options));
}
catch (Exception exception)
{
// deserialization failed, try the next one
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into List<HighlightResultOption>: {exception}");
System.Diagnostics.Debug.WriteLine($"Failed to deserialize into List<HighlightResult>: {exception}");
}
}
throw new InvalidDataException($"The JSON string cannot be deserialized into any schema defined.");
Expand Down
Loading

0 comments on commit 9db7daf

Please sign in to comment.