-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add search archive document by from- and to-date
GetNextDocumentsUri will now accept from- and to-date to search for documents archived between the given point in time. The api will page as normal on limit-size.
- Loading branch information
Showing
6 changed files
with
108 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
Digipost.Api.Client.Common.Tests/Relations/ApiRelationsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Digipost.Api.Client.Common.Enums; | ||
using Digipost.Api.Client.Common.Relations; | ||
using Digipost.Api.Client.Common.Utilities; | ||
using Xunit; | ||
|
||
namespace Digipost.Api.Client.Common.Tests.Utilities | ||
{ | ||
public class ApiRelationsTests | ||
{ | ||
private static readonly Uri BaseUri = new Uri("https://api.io/api/archive/search?id=123"); | ||
|
||
[Fact] | ||
public void should_produce_archive_search_url_query() | ||
{ | ||
Assert.Equal("https://api.io:443/api/archive/search?id=123", | ||
ArchiveNextDocumentsUri.ToUri(BaseUri, new Dictionary<string, string>(), null, null)); | ||
|
||
Assert.Equal("https://api.io:443/api/archive/search?id=123&attributes=aWQsMTIz", | ||
ArchiveNextDocumentsUri.ToUri(BaseUri, new Dictionary<string, string>() | ||
{ | ||
["id"] = "123", | ||
}, | ||
null, null | ||
)); | ||
|
||
var url = ArchiveNextDocumentsUri.ToUri(BaseUri, new Dictionary<string, string>(), | ||
DateTime.Parse("2024-10-26 14:50:14Z"), | ||
DateTime.Parse("2024-10-28 14:50:14Z") | ||
); | ||
Assert.Contains("fromDate=2024-10-26T", url); | ||
Assert.Contains("toDate=2024-10-28T", url); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters