From 431272c31bc2fd3d8d3b48fa209198c5d66a0f71 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 8 Jun 2026 16:18:24 +0200 Subject: [PATCH 1/3] :sparkles: add webhook information for model search --- src/Mindee/V2/Parsing/Search/ModelWebhook.cs | 37 ++++++++++++++++++ .../{PaginationMetadata.cs => Pagination.cs} | 5 ++- src/Mindee/V2/Parsing/Search/SearchModel.cs | 7 ++++ .../V2/Parsing/Search/SearchResponse.cs | 20 ++++++++-- .../Mindee.UnitTests/V2/Parsing/SearchTest.cs | 39 +++++++++++++++++++ 5 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 src/Mindee/V2/Parsing/Search/ModelWebhook.cs rename src/Mindee/V2/Parsing/Search/{PaginationMetadata.cs => Pagination.cs} (93%) create mode 100644 tests/Mindee.UnitTests/V2/Parsing/SearchTest.cs diff --git a/src/Mindee/V2/Parsing/Search/ModelWebhook.cs b/src/Mindee/V2/Parsing/Search/ModelWebhook.cs new file mode 100644 index 00000000..021c53c8 --- /dev/null +++ b/src/Mindee/V2/Parsing/Search/ModelWebhook.cs @@ -0,0 +1,37 @@ +using System.Text.Json.Serialization; + +namespace Mindee.V2.Parsing.Search +{ + /// + /// Model webhook information. + /// + public class ModelWebhook + { + /// + /// ID of the webhook. + /// + [JsonPropertyName("id")] + public string Id { get; set; } + + /// + /// Name of the webhook. + /// + [JsonPropertyName("name")] + public string Name { get; set; } + + /// + /// URL of the webhook. + /// + [JsonPropertyName("url")] + public string Url { get; set; } + + /// + /// String representation of the webhook. + /// + /// + public override string ToString() + { + return $":Name: {Name}\n:ID: {Id}\n:URL: {Url}"; + } + } +} diff --git a/src/Mindee/V2/Parsing/Search/PaginationMetadata.cs b/src/Mindee/V2/Parsing/Search/Pagination.cs similarity index 93% rename from src/Mindee/V2/Parsing/Search/PaginationMetadata.cs rename to src/Mindee/V2/Parsing/Search/Pagination.cs index 7a35ad60..f3da7354 100644 --- a/src/Mindee/V2/Parsing/Search/PaginationMetadata.cs +++ b/src/Mindee/V2/Parsing/Search/Pagination.cs @@ -4,10 +4,11 @@ namespace Mindee.V2.Parsing.Search { /// - /// PaginationMetadata data associated with model search. + /// Pagination metadata associated with model search. /// - public class PaginationMetadata + public class Pagination { + /// /// Number of items per page. /// diff --git a/src/Mindee/V2/Parsing/Search/SearchModel.cs b/src/Mindee/V2/Parsing/Search/SearchModel.cs index 55312939..6deecacc 100644 --- a/src/Mindee/V2/Parsing/Search/SearchModel.cs +++ b/src/Mindee/V2/Parsing/Search/SearchModel.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Text.Json.Serialization; namespace Mindee.V2.Parsing.Search @@ -25,6 +26,12 @@ public class SearchModel [JsonPropertyName("model_type")] public string ModelType { get; set; } + /// + /// Webhooks associated with the model. + /// + [JsonPropertyName("webhooks")] + public List Webhooks { get; set; } + /// /// String representation of the model. /// diff --git a/src/Mindee/V2/Parsing/Search/SearchResponse.cs b/src/Mindee/V2/Parsing/Search/SearchResponse.cs index 0875511f..69fa678a 100644 --- a/src/Mindee/V2/Parsing/Search/SearchResponse.cs +++ b/src/Mindee/V2/Parsing/Search/SearchResponse.cs @@ -1,3 +1,4 @@ +using System; using System.Text; using System.Text.Json.Serialization; using Mindee.Parsing; @@ -8,7 +9,7 @@ namespace Mindee.V2.Parsing.Search /// /// Models search response. /// - public class SearchResponse + public class SearchResponse : BaseResponse { /// /// List of all models matching the search query. @@ -18,10 +19,21 @@ public class SearchResponse public SearchModels Models { get; set; } /// - /// PaginationMetadata metadata. + /// Pagination metadata (Obsolete). + /// + [JsonIgnore] + [Obsolete("Use Pagination instead.")] + public Pagination PaginationMetadata + { + get => Pagination; + set => Pagination = value; + } + + /// + /// Pagination metadata. /// [JsonPropertyName("pagination")] - public PaginationMetadata PaginationMetadata { get; set; } + public Pagination Pagination { get; set; } /// @@ -35,7 +47,7 @@ public override string ToString() stringBuilder.Append('\n'); stringBuilder.Append("Pagination Metadata\n"); stringBuilder.Append("###################\n"); - stringBuilder.Append(PaginationMetadata); + stringBuilder.Append(Pagination); stringBuilder.Append('\n'); return SummaryHelper.Clean(stringBuilder.ToString()); diff --git a/tests/Mindee.UnitTests/V2/Parsing/SearchTest.cs b/tests/Mindee.UnitTests/V2/Parsing/SearchTest.cs new file mode 100644 index 00000000..ca813868 --- /dev/null +++ b/tests/Mindee.UnitTests/V2/Parsing/SearchTest.cs @@ -0,0 +1,39 @@ +using Mindee.V2.Parsing; +using Mindee.V2.Parsing.Search; + +namespace Mindee.UnitTests.V2.Parsing +{ + [Trait("Category", "V2")] + [Trait("Category", "Search")] + public class SearchTest + { + [Fact] + public void SearchModels_LoadsLocally() + { + var localResponse = new LocalResponse( + new FileInfo(Constants.V2RootDir + "search/models.json")); + SearchResponse modelsResponse = localResponse.DeserializeResponse(); + + Assert.NotNull(modelsResponse); + + Assert.Equal(5, modelsResponse.Models.Count); + Assert.Equal(5, modelsResponse.Pagination.TotalItems); + Assert.Equal(1, modelsResponse.Pagination.Page); + Assert.Equal(50, modelsResponse.Pagination.PerPage); + Assert.Equal(1, modelsResponse.Pagination.TotalPages); + + var firstModel = modelsResponse.Models.First(); + Assert.Equal("Extraction With Webhooks", firstModel.Name); + Assert.Equal("afde5151-aa11-aa11-9289-fa04e50ca3b9", firstModel.Id); + Assert.Equal("extraction", firstModel.ModelType); + + Assert.Equal(2, firstModel.Webhooks.Count); + Assert.Equal("a2286ed9-aa11-aa11-bdc5-2f8496c5641a", firstModel.Webhooks[0].Id); + Assert.Equal("FAILURE", firstModel.Webhooks[0].Name); + Assert.Equal("https://failure.mindee.com", firstModel.Webhooks[0].Url); + var lastModel = modelsResponse.Models.Last(); + Assert.Equal("Extraction Without Webhooks Key", lastModel.Name); + Assert.Equal("e14e0923-ee55-ee55-a335-8d2110917d7b", lastModel.Id); + } + } +} From f141729a21912c4e46b68fd3634f4523fee06e61 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 8 Jun 2026 16:23:32 +0200 Subject: [PATCH 2/3] reverse class name --- .../Parsing/Search/{Pagination.cs => PaginationMetadata.cs} | 2 +- src/Mindee/V2/Parsing/Search/SearchResponse.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/Mindee/V2/Parsing/Search/{Pagination.cs => PaginationMetadata.cs} (97%) diff --git a/src/Mindee/V2/Parsing/Search/Pagination.cs b/src/Mindee/V2/Parsing/Search/PaginationMetadata.cs similarity index 97% rename from src/Mindee/V2/Parsing/Search/Pagination.cs rename to src/Mindee/V2/Parsing/Search/PaginationMetadata.cs index f3da7354..06179c2e 100644 --- a/src/Mindee/V2/Parsing/Search/Pagination.cs +++ b/src/Mindee/V2/Parsing/Search/PaginationMetadata.cs @@ -6,7 +6,7 @@ namespace Mindee.V2.Parsing.Search /// /// Pagination metadata associated with model search. /// - public class Pagination + public class PaginationMetadata { /// diff --git a/src/Mindee/V2/Parsing/Search/SearchResponse.cs b/src/Mindee/V2/Parsing/Search/SearchResponse.cs index 69fa678a..3a204307 100644 --- a/src/Mindee/V2/Parsing/Search/SearchResponse.cs +++ b/src/Mindee/V2/Parsing/Search/SearchResponse.cs @@ -23,7 +23,7 @@ public class SearchResponse : BaseResponse /// [JsonIgnore] [Obsolete("Use Pagination instead.")] - public Pagination PaginationMetadata + public PaginationMetadata PaginationMetadata { get => Pagination; set => Pagination = value; @@ -33,7 +33,7 @@ public Pagination PaginationMetadata /// Pagination metadata. /// [JsonPropertyName("pagination")] - public Pagination Pagination { get; set; } + public PaginationMetadata Pagination { get; set; } /// From 6512c861e1cb120511265bcbfbd9ee1764271bd1 Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Mon, 8 Jun 2026 17:05:52 +0200 Subject: [PATCH 3/3] fix docstrings --- src/Mindee/V2/Parsing/Search/ModelWebhook.cs | 2 +- src/Mindee/V2/Parsing/Search/SearchModel.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mindee/V2/Parsing/Search/ModelWebhook.cs b/src/Mindee/V2/Parsing/Search/ModelWebhook.cs index 021c53c8..393b1c79 100644 --- a/src/Mindee/V2/Parsing/Search/ModelWebhook.cs +++ b/src/Mindee/V2/Parsing/Search/ModelWebhook.cs @@ -3,7 +3,7 @@ namespace Mindee.V2.Parsing.Search { /// - /// Model webhook information. + /// Information about a model's webhook. /// public class ModelWebhook { diff --git a/src/Mindee/V2/Parsing/Search/SearchModel.cs b/src/Mindee/V2/Parsing/Search/SearchModel.cs index 6deecacc..adf07556 100644 --- a/src/Mindee/V2/Parsing/Search/SearchModel.cs +++ b/src/Mindee/V2/Parsing/Search/SearchModel.cs @@ -27,7 +27,7 @@ public class SearchModel public string ModelType { get; set; } /// - /// Webhooks associated with the model. + /// List of webhooks associated with the model. /// [JsonPropertyName("webhooks")] public List Webhooks { get; set; }