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
17 changes: 15 additions & 2 deletions Apps.Optimizely/Actions/ContentActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,24 @@ namespace Apps.Optimizely.Actions;
public class ContentActions(InvocationContext invocationContext, IFileManagementClient fileManagementClient) : Invocable(invocationContext)
{
[BlueprintActionDefinition(BlueprintAction.SearchContent)]
[Action("Search content", Description = "Search direct child content items under the specified root content.")]
[Action("Search content", Description = "Search content items under the specified root content.")]
public async Task<List<Models.Entities.ContentItemEntity>> SearchContent([ActionParameter] SearchContentRequest input)
{
var service = new OptimizelyContentService(Client);
return await service.SearchContentAsync(input.RootContentId, input.NameContains);
return await service.SearchContentAsync(new SearchContentFilters
{
RootContentId = input.RootContentId,
ContentReferenceGuid = input.ContentReferenceGuid,
ContentType = input.ContentType,
NameContains = input.NameContains,
CategoryId = input.CategoryId,
Locale = input.Locale,
PublishedAfter = input.PublishedAfter,
PublishedBefore = input.PublishedBefore,
IncludeUnpublished = input.IncludeUnpublished,
MaxDepth = input.MaxDepth,
MaxResults = input.MaxResults
});
}

[BlueprintActionDefinition(BlueprintAction.DownloadContent)]
Expand Down
2 changes: 1 addition & 1 deletion Apps.Optimizely/Api/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public RestRequest CreateTokenRequest()
return request;
}

public async Task<List<OptimizelyContentSummaryDto>> GetChildrenAsync(string rootContentId, CancellationToken cancellationToken = default)
public virtual async Task<List<OptimizelyContentSummaryDto>> GetChildrenAsync(string rootContentId, CancellationToken cancellationToken = default)
{
var request = await CreateAuthenticatedRequestAsync(string.Format(ApiConstants.ContentChildrenResource, rootContentId), Method.Get, cancellationToken);
return await ExecuteWithErrorHandling<List<OptimizelyContentSummaryDto>>(request);
Expand Down
2 changes: 1 addition & 1 deletion Apps.Optimizely/Apps.Optimizely.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<Product>Optimizely [Beta]</Product>
<Description>Optimizely Content Management System (CMS) is a high-performance, SaaS-based platform that enables marketers and developers to create, manage, and deliver personalized, multi-channel digital experiences. Formerly Episerver, it combines a user-friendly editorial interface with flexible headless capabilities, robust APIs, and built-in AI tools for optimized content delivery.</Description>
<Version>1.0.1</Version>
<Version>1.0.2</Version>
<AssemblyName>Apps.Optimizely</AssemblyName>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ public class ContentDataSourceHandler(InvocationContext invocationContext) : Inv
public async Task<IEnumerable<DataSourceItem>> GetDataAsync(DataSourceContext context, CancellationToken cancellationToken)
{
var service = new OptimizelyContentService(Client);
var contentItems = await service.SearchContentAsync("1", context.SearchString, cancellationToken);
var contentItems = await service.SearchContentAsync(new SearchContentFilters
{
RootContentId = "1",
NameContains = context.SearchString,
IncludeUnpublished = true,
MaxDepth = 5,
MaxResults = 50
}, cancellationToken);

return contentItems
.Select(item => new DataSourceItem(item.ContentId, $"{item.Name} ({item.ContentId})"));
Expand Down
3 changes: 3 additions & 0 deletions Apps.Optimizely/Models/Dtos/OptimizelyContentReferenceDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ public class OptimizelyContentReferenceDto
[JsonProperty("id")]
public int Id { get; set; }

[JsonProperty("guidValue")]
public string? GuidValue { get; set; }

[JsonProperty("url")]
public string? Url { get; set; }
}
18 changes: 18 additions & 0 deletions Apps.Optimizely/Models/Dtos/OptimizelyContentSummaryDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,27 @@ public class OptimizelyContentSummaryDto
[JsonProperty("language")]
public OptimizelyLanguageDto? Language { get; set; }

[JsonProperty("existingLanguages")]
public List<OptimizelyLanguageDto>? ExistingLanguages { get; set; }

[JsonProperty("contentType")]
public List<string>? ContentType { get; set; }

[JsonProperty("parentLink")]
public OptimizelyContentReferenceDto? ParentLink { get; set; }

[JsonProperty("startPublish")]
public DateTime? StartPublish { get; set; }

[JsonProperty("status")]
public string? Status { get; set; }

[JsonProperty("category")]
public OptimizelyCategoryDto? Category { get; set; }
}

public class OptimizelyCategoryDto
{
[JsonProperty("value")]
public List<int>? Value { get; set; }
}
29 changes: 28 additions & 1 deletion Apps.Optimizely/Models/Requests/SearchContentRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,35 @@ public class SearchContentRequest
{
[Display("Root content ID")]
[DataSource(typeof(ContentDataSourceHandler))]
public string? RootContentId { get; set; }
public string RootContentId { get; set; } = string.Empty;

[Display("Content reference GUID")]
public string? ContentReferenceGuid { get; set; }

[Display("Content type")]
public string? ContentType { get; set; }

[Display("Name contains")]
public string? NameContains { get; set; }

[Display("Category ID")]
public int? CategoryId { get; set; }

[Display("Locale")]
public string? Locale { get; set; }

[Display("Published after")]
public DateTime? PublishedAfter { get; set; }

[Display("Published before")]
public DateTime? PublishedBefore { get; set; }

[Display("Include unpublished")]
public bool? IncludeUnpublished { get; set; }

[Display("Max depth")]
public int? MaxDepth { get; set; }

[Display("Max results")]
public int? MaxResults { get; set; }
}
Loading