Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Automated Tests
name: Crontab

on:
schedule:
Expand Down
5 changes: 3 additions & 2 deletions src/Mindee/V2/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,13 @@ public async Task<bool> DeleteExtractionRagDocumentAsync(
/// <param name="ct">Cancellation token.</param>
/// <returns>A search response containing the matching resources.</returns>
public async Task<TSearchResponse> SearchAsync<TSearchResponse>(
BaseSearchParameters searchParameters, CancellationToken ct = default)
BaseSearchParameters<TSearchResponse> searchParameters, CancellationToken ct = default)
where TSearchResponse : BaseSearchResponse, new()
Comment thread
ianardee marked this conversation as resolved.
{
if (searchParameters == null)
throw new ArgumentNullException(nameof(searchParameters));
return await _mindeeApi.ReqGetSearchAsync<TSearchResponse>(searchParameters, ct);

return await _mindeeApi.ReqGetSearchAsync(searchParameters, ct);
}

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion src/Mindee/V2/ClientOptions/BaseSearchParameters.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using System;
using System.Collections.Generic;
using Mindee.V2.Parsing.Search;

namespace Mindee.V2.ClientOptions
{
/// <summary>
/// Base parameters for searches.
/// </summary>
public abstract class BaseSearchParameters
public abstract class BaseSearchParameters<TSearchResponse>
where TSearchResponse : BaseSearchResponse, new()
Comment thread
ianardee marked this conversation as resolved.
{
/// <summary>
/// 1-based page index.
Expand Down
4 changes: 2 additions & 2 deletions src/Mindee/V2/Http/HttpApiV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ public abstract Task<TResponse> ReqGetResultByUrlAsync<TResponse>(
/// <summary>
/// Retrieves a list of resources with the given criteria.
/// </summary>
/// <param name="parameters"><see cref="BaseSearchParameters"/></param>
/// <param name="parameters"><see cref="BaseSearchParameters{TSearchResponse}"/></param>
/// <param name="cancellationToken">Cancellation token.</param>
public abstract Task<TSearchResponse> ReqGetSearchAsync<TSearchResponse>(
BaseSearchParameters parameters, CancellationToken cancellationToken = default)
BaseSearchParameters<TSearchResponse> parameters, CancellationToken cancellationToken = default)
where TSearchResponse : BaseSearchResponse, new();

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Mindee/V2/Http/MindeeApiV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ InputSource inputSource
}

public override async Task<TSearchResponse> ReqGetSearchAsync<TSearchResponse>(
BaseSearchParameters parameters, CancellationToken cancellationToken = default)
BaseSearchParameters<TSearchResponse> parameters, CancellationToken cancellationToken = default)
{
var searchType = typeof(TSearchResponse);
var productAttributes = searchType.GetCustomAttribute<ProductAttributes>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public RagDocumentUploadParameters(string modelId)
/// <summary>
/// Gets the request parameters for the upload request.
/// </summary>
/// <returns></returns>
public virtual Dictionary<string, string> GetRequestParameters()
{
var parameters = new Dictionary<string, string>();
Expand Down
10 changes: 7 additions & 3 deletions src/Mindee/V2/Search/Models/ModelSearchParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Mindee.V2.Search.Models
/// If no search filters are given, all models belonging to the organization are returned.
/// Results are paginated.
/// </summary>
public class ModelSearchParameters : BaseSearchParameters
public class ModelSearchParameters : BaseSearchParameters<ModelSearchResponse>
{
/// <summary>
/// Filter models by partial name match, case-insensitive.
Expand All @@ -27,8 +27,12 @@ public class ModelSearchParameters : BaseSearchParameters
/// </summary>
/// <param name="name"><see cref="Name"/></param>
/// <param name="modelType"><see cref="ModelType"/></param>
/// <param name="page"><see cref="BaseSearchParameters.Page"/></param>
/// <param name="perPage"><see cref="BaseSearchParameters.PerPage"/></param>
/// <param name="page">
/// <see cref="BaseSearchParameters{ModelSearchResponse}.Page"/>
/// </param>
/// <param name="perPage">
/// <see cref="BaseSearchParameters{ModelSearchResponse}.PerPage"/>
/// </param>
public ModelSearchParameters(
string name = null, string modelType = null, int? page = null, int? perPage = null)
: base(page, perPage)
Expand Down
10 changes: 7 additions & 3 deletions src/Mindee/V2/Search/RagDocuments/RagDocumentSearchParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Mindee.V2.Search.RagDocuments
/// <summary>
/// Search parameters for RAG Documents.
/// </summary>
public class RagDocumentSearchParameters : BaseSearchParameters
public class RagDocumentSearchParameters : BaseSearchParameters<RagDocumentSearchResponse>
{
/// <summary>
/// Model identifier to search in.
Expand All @@ -24,8 +24,12 @@ public class RagDocumentSearchParameters : BaseSearchParameters
/// </summary>
/// <param name="modelId"><see cref="ModelId"/></param>
/// <param name="filename"><see cref="Filename"/></param>
/// <param name="page"><see cref="BaseSearchParameters.Page"/></param>
/// <param name="perPage"><see cref="BaseSearchParameters.PerPage"/></param>
/// <param name="page">
/// <see cref="BaseSearchParameters{RagDocumentSearchResponse}.Page"/>
/// </param>
/// <param name="perPage">
/// <see cref="BaseSearchParameters{RagDocumentSearchResponse}.PerPage"/>
/// </param>
public RagDocumentSearchParameters(
string modelId = null, string filename = null, int? page = null, int? perPage = null)
: base(page, perPage)
Expand Down
2 changes: 1 addition & 1 deletion tests/Mindee.IntegrationTests/V2/Search/ModelSearchTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task ModelSearch_mustHaveResults()
[Fact(Timeout = 180000)]
public async Task ModelSearch_mustReturnEmpty()
{
var response = await _client.SearchAsync<ModelSearchResponse>(
var response = await _client.SearchAsync(
new ModelSearchParameters(name: "je n'existe pas tralala"));
Assert.NotNull(response);
Assert.NotNull(response.Models);
Expand Down
1 change: 0 additions & 1 deletion tests/Mindee.UnitTests/V1/ClientTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Threading;
using Microsoft.Extensions.Logging.Abstractions;
using Mindee.Input;
using Mindee.Pdf;
Expand Down
1 change: 0 additions & 1 deletion tests/Mindee.UnitTests/V1/Http/MindeeApiTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Net;
using Microsoft.Extensions.DependencyInjection;
using Mindee.Exceptions;
using Mindee.V1.Exceptions;
using Mindee.V1.Http;
using Mindee.V1.Product.Invoice;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Mindee.UnitTests.V1.Parsing.Common
{
[Trait("Category", "V1")]
[Trait("Category", "AsyncPredictResponse")]
public class AsyncPredictResponseTest
{
Expand Down
1 change: 1 addition & 0 deletions tests/Mindee.UnitTests/V1/Parsing/Common/CropperTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Mindee.UnitTests.V1.Parsing.Common
{
[Trait("Category", "V1")]
[Trait("Category", "Cropper")]
public class CropperTest
{
Expand Down
1 change: 1 addition & 0 deletions tests/Mindee.UnitTests/V1/Parsing/Common/ErrorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Parsing.Common
{
[Trait("Category", "V1")]
[Trait("Category", "Error property")]
public class ErrorTest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Mindee.UnitTests.V1.Parsing.Common
{
[Trait("Category", "V1")]
[Trait("Category", "FullTextOcr")]
public class FullTextOcrTest
{
Expand Down
1 change: 1 addition & 0 deletions tests/Mindee.UnitTests/V1/Parsing/Common/OcrTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Mindee.UnitTests.V1.Parsing.Common
{
[Trait("Category", "V1")]
[Trait("Category", "OCR")]
public class OcrTest
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Mindee.UnitTests/V1/Parsing/LocalResponseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace Mindee.UnitTests.V1.Parsing
{
[Trait("Category", "JSON Response loading")]
[Trait("Category", "V1")]
[Trait("Category", "Load Local Response")]
public class LocalResponseTest
{
// Fake secret key.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Parsing.Standard
{
[Trait("Category", "V1")]
[Trait("Category", "Standard DateField")]
public class DateFieldTest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Mindee.UnitTests.V1.Parsing.Standard
{
[Trait("Category", "V1")]
[Trait("Category", "Standard DecimalField")]
public class DecimalFieldTest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.BarcodeReader
{
[Trait("Category", "V1")]
[Trait("Category", "BarcodeReaderV1")]
public class BarcodeReaderV1Test
{
Expand Down
1 change: 1 addition & 0 deletions tests/Mindee.UnitTests/V1/Product/Cropper/CropperV1Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.Cropper
{
[Trait("Category", "V1")]
[Trait("Category", "CropperV1")]
public class CropperV1Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.FinancialDocument
{
[Trait("Category", "V1")]
[Trait("Category", "Financial V1")]
public class FinancialDocumentV1Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.Fr.BankAccountDetails
{
[Trait("Category", "V1")]
[Trait("Category", "BankAccountDetailsV1")]
public class BankAccountDetailsV1Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.Fr.BankAccountDetails
{
[Trait("Category", "V1")]
[Trait("Category", "BankAccountDetailsV2")]
public class BankAccountDetailsV2Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.Fr.CarteGrise
{
[Trait("Category", "V1")]
[Trait("Category", "CarteGriseV1")]
public class CarteGriseV1Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.Fr.HealthCard
{
[Trait("Category", "V1")]
[Trait("Category", "HealthCardV1")]
public class HealthCardV1Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Mindee.UnitTests.V1.Product.Fr.IdCard
{
[Trait("Category", "V1")]
[Trait("Category", "IdCardV1")]
public class IdCardV1Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Mindee.UnitTests.V1.Product.Fr.IdCard
{
[Trait("Category", "V1")]
[Trait("Category", "IdCardV2")]
public class IdCardV2Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.Fr.Payslip
{
[Trait("Category", "V1")]
[Trait("Category", "PayslipV3")]
public class PayslipV3Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Mindee.UnitTests.V1.Product.Generated
{
[Trait("Category", "V1")]
[Trait("Category", "Generated API")]
public class GeneratedV1Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Mindee.UnitTests.V1.Product.InternationalId
{
[Trait("Category", "V1")]
[Trait("Category", "InternationalIdV2")]
public class InternationalIdV2Test
{
Expand Down
1 change: 1 addition & 0 deletions tests/Mindee.UnitTests/V1/Product/Invoice/InvoiceV4Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Mindee.UnitTests.V1.Product.Invoice
{
[Trait("Category", "V1")]
[Trait("Category", "InvoiceV4")]
public class InvoiceV4Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.InvoiceSplitter
{
[Trait("Category", "V1")]
[Trait("Category", "InvoiceSplitterV1")]
public class InvoiceSplitterV1Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.MultiReceiptsDetector
{
[Trait("Category", "V1")]
[Trait("Category", "MultiReceiptsDetectorV1")]
public class MultiReceiptsDetectorV1Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.Passport
{
[Trait("Category", "V1")]
[Trait("Category", "PassportV1")]
public class PassportV1Test
{
Expand Down
1 change: 1 addition & 0 deletions tests/Mindee.UnitTests/V1/Product/Receipt/ReceiptV4Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.Receipt
{
[Trait("Category", "V1")]
[Trait("Category", "Receipt V4")]
public class ReceiptV4Test
{
Expand Down
1 change: 1 addition & 0 deletions tests/Mindee.UnitTests/V1/Product/Receipt/ReceiptV5Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Mindee.UnitTests.V1.Product.Receipt
{
[Trait("Category", "V1")]
[Trait("Category", "ReceiptV5")]
public class ReceiptV5Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.Us.BankCheck
{
[Trait("Category", "V1")]
[Trait("Category", "BankCheckV1")]
public class BankCheckV1Test
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Mindee.UnitTests.V1.Product.Us.PayrollCheckRegister
{
[Trait("Category", "V1")]
[Trait("Category", "PayrollCheckRegisterV1")]
public class PayrollCheckRegisterV1Test
{
Expand Down
Loading