diff --git a/Apps.Contentful/Actions/EntryActions.cs b/Apps.Contentful/Actions/EntryActions.cs index 209a56f..81808a8 100644 --- a/Apps.Contentful/Actions/EntryActions.cs +++ b/Apps.Contentful/Actions/EntryActions.cs @@ -1235,6 +1235,11 @@ private static void ApplyListEntriesRequestFilters(NameValueCollection queryStri { queryString.Add("metadata.tags.sys.id[in]", string.Join(",", request.Tags)); } + + if (!string.IsNullOrWhiteSpace(request.UpdatedBy)) + { + queryString.Add("sys.updatedBy.sys.id", request.UpdatedBy); + } if (request.ExcludeTags is not null && request.ExcludeTags.Any()) { diff --git a/Apps.Contentful/Apps.Contentful.csproj b/Apps.Contentful/Apps.Contentful.csproj index 2f09caf..9e85137 100644 --- a/Apps.Contentful/Apps.Contentful.csproj +++ b/Apps.Contentful/Apps.Contentful.csproj @@ -6,7 +6,7 @@ enable Contentful The headless content management system - 1.8.16 + 1.8.17 Apps.Contentful diff --git a/Apps.Contentful/Models/Requests/ListEntriesRequest.cs b/Apps.Contentful/Models/Requests/ListEntriesRequest.cs index a1f0f67..8215023 100644 --- a/Apps.Contentful/Models/Requests/ListEntriesRequest.cs +++ b/Apps.Contentful/Models/Requests/ListEntriesRequest.cs @@ -1,4 +1,5 @@ -using Apps.Contentful.DataSourceHandlers.Tags; +using Apps.Contentful.DataSourceHandlers; +using Apps.Contentful.DataSourceHandlers.Tags; using Apps.Contentful.Models.Identifiers; using Blackbird.Applications.Sdk.Common; using Blackbird.Applications.Sdk.Common.Dynamic; @@ -42,4 +43,7 @@ public class ListEntriesRequest : ContentModelOptionalIdentifier [Display("Search term", Description = "Full‑text search across all text and symbol fields")] public string? SearchTerm { get; set; } + + [Display("Updated by"), DataSource(typeof(UserDataSourceHandler))] + public string? UpdatedBy { get; set; } } \ No newline at end of file diff --git a/Tests.Contentful/Base/TestBase.cs b/Tests.Contentful/Base/TestBase.cs index 08039ae..6082cdc 100644 --- a/Tests.Contentful/Base/TestBase.cs +++ b/Tests.Contentful/Base/TestBase.cs @@ -1,6 +1,7 @@ using Blackbird.Applications.Sdk.Common.Authentication; using Blackbird.Applications.Sdk.Common.Invocation; using Microsoft.Extensions.Configuration; +using Newtonsoft.Json; namespace Tests.Contentful.Base; @@ -30,4 +31,9 @@ protected TestBase() FileManager = new FileManager(); } + + protected static void PrintJsonResult(object result) + { + Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented)); + } } \ No newline at end of file diff --git a/Tests.Contentful/DataHandlerTests.cs b/Tests.Contentful/DataHandlerTests.cs index 4278670..f256a45 100644 --- a/Tests.Contentful/DataHandlerTests.cs +++ b/Tests.Contentful/DataHandlerTests.cs @@ -55,4 +55,18 @@ public async Task LocaleDataSourceHandler_ReturnsLocales() Assert.IsNotNull(result); Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented)); } + + [TestMethod] + public async Task UserDataSourceHandler_ReturnsUsers() + { + // Arrange + var handler = new UserDataSourceHandler(InvocationContext); + + // Act + var result = await handler.GetDataAsync(new(), default); + + // Assert + Assert.IsNotNull(result); + PrintJsonResult(result); + } } \ No newline at end of file diff --git a/Tests.Contentful/EntryActionsTests.cs b/Tests.Contentful/EntryActionsTests.cs index fdc073c..2bdafe5 100644 --- a/Tests.Contentful/EntryActionsTests.cs +++ b/Tests.Contentful/EntryActionsTests.cs @@ -29,14 +29,11 @@ public async Task ListEntries_NotExistingEnvironment_ShouldFailWithException() public async Task ListEntries_ValidEnvironment_ShouldReturnAllEntries() { var entryActions = new EntryActions(InvocationContext, FileManager); - var listEntriesRequest = new ListEntriesRequest { Environment = "dev", SearchTerm = "The perfect partner" }; + var listEntriesRequest = new ListEntriesRequest { Environment = "master", UpdatedBy = "5UuNOI1TXxCkHgBChqQP9z" }; var entriesResponse = await entryActions.ListEntries(listEntriesRequest); - foreach (var entry in entriesResponse.Entries) - { - Console.WriteLine($"{entry.ContentId}"); - } + PrintJsonResult(entriesResponse); } [TestMethod]