diff --git a/Apps.Wordpress/Apps.Wordpress.csproj b/Apps.Wordpress/Apps.Wordpress.csproj
index 2e85d21..abee31d 100644
--- a/Apps.Wordpress/Apps.Wordpress.csproj
+++ b/Apps.Wordpress/Apps.Wordpress.csproj
@@ -4,7 +4,7 @@
enable
enable
Wordpress (+ Polylang)
- 1.2.0
+ 1.2.1
The world’s most popular website builder
Apps.Wordpress
diff --git a/Apps.Wordpress/Events/Polling/PollingList.cs b/Apps.Wordpress/Events/Polling/PollingList.cs
index a3a62b4..8c65e77 100644
--- a/Apps.Wordpress/Events/Polling/PollingList.cs
+++ b/Apps.Wordpress/Events/Polling/PollingList.cs
@@ -5,11 +5,13 @@
using Apps.Wordpress.Events.Polling.Models.Memory;
using Apps.Wordpress.Models.Dtos;
using Apps.Wordpress.Models.Entities;
+using Apps.Wordpress.Models.Requests;
using Blackbird.Applications.Sdk.Common;
using Blackbird.Applications.Sdk.Common.Dynamic;
using Blackbird.Applications.Sdk.Common.Invocation;
using Blackbird.Applications.Sdk.Common.Polling;
using Blackbird.Applications.Sdk.Utils.Extensions.String;
+using Blackbird.Applications.Sdk.Utils.Extensions.System;
using RestSharp;
namespace Apps.Wordpress.Events.Polling;
@@ -21,51 +23,58 @@ public PollingList(InvocationContext invocationContext) : base(invocationContext
{
}
- [PollingEvent("On post created", "On a new post created")]
+ [PollingEvent("On posts created", "On new posts are created")]
public Task> OnPostCreated(
- PollingEventRequest request)
+ PollingEventRequest request,
+ [PollingEventParameter] LanguageOptionalRequest languageRequest)
=> PollContentCreation(request, new()
{
- ["after"] = request.Memory?.LastCreationDate.ToString(Formats.ISO8601) ?? string.Empty
+ ["after"] = request.Memory?.LastCreationDate.ToString(Formats.ISO8601) ?? string.Empty,
+ ["lang"] = languageRequest.Language ?? string.Empty
}, "posts", () => new()
{
LastCreationDate = DateTime.UtcNow
});
- [PollingEvent("On post updated", "On a specific post updated")]
+ [PollingEvent("On posts updated", "On specific posts are updated")]
public Task> OnPostUpdated(
PollingEventRequest request,
[PollingEventParameter] [Display("Post ID")] [DataSource(typeof(PostDataHandler))]
- string? postId)
+ string? postId, [PollingEventParameter] LanguageOptionalRequest languageRequest)
=> PollContentChanges(request, postId, new()
{
- ["modified_after"] = request.Memory?.LastModificationTime.ToString(Formats.ISO8601) ?? string.Empty
+ ["modified_after"] = request.Memory?.LastModificationTime.ToString(Formats.ISO8601) ?? string.Empty,
+ ["lang"] = languageRequest.Language ?? string.Empty
}, "posts", () => new()
{
LastModificationTime = DateTime.UtcNow
});
- [PollingEvent("On page created", "On a new page created")]
+ [PollingEvent("On pages created", "On new pages are created")]
public Task> OnPageCreated(
- PollingEventRequest request)
+ PollingEventRequest request,
+ [PollingEventParameter] LanguageOptionalRequest languageRequest)
=> PollContentCreation(request, new()
{
- ["after"] = request.Memory?.LastCreationDate.ToString(Formats.ISO8601) ?? string.Empty
+ ["after"] = request.Memory?.LastCreationDate.ToString(Formats.ISO8601) ?? string.Empty,
+ ["lang"] = languageRequest.Language ?? string.Empty
}, "pages", () => new()
{
LastCreationDate = DateTime.UtcNow
});
- [PollingEvent("On page updated", "On a specific page updated")]
+ [PollingEvent("On pages updated", "On specific pages are updated")]
public Task> OnPageUpdated(
PollingEventRequest request,
[PollingEventParameter] [Display("Page ID")] [DataSource(typeof(PageDataHandler))]
- string? pageId)
+ string? pageId,
+ [PollingEventParameter] LanguageOptionalRequest languageRequest)
=> PollContentChanges(request, pageId, new()
{
- ["modified_after"] = request.Memory?.LastModificationTime.ToString(Formats.ISO8601) ?? string.Empty
+ ["modified_after"] = request.Memory?.LastModificationTime.ToString(Formats.ISO8601) ?? string.Empty,
+ ["lang"] = languageRequest.Language ?? string.Empty
}, "pages", () => new()
{
LastModificationTime = DateTime.UtcNow
@@ -83,7 +92,7 @@ private async Task> PollContentCre
};
}
- var items = await ListContentItems(endpoint.WithQuery(query));
+ var items = await ListContentItems(endpoint.WithQuery(query.AllIsNotNull()));
if (!items.Any())
{
@@ -119,7 +128,7 @@ private async Task> PollContentCha
}
var items = string.IsNullOrWhiteSpace(resourceId)
- ? await ListContentItems(endpoint.WithQuery(query))
+ ? await ListContentItems(endpoint.WithQuery(query.AllIsNotNull()))
: await GetContentItem($"{endpoint}/{resourceId}", request.Memory);
if (!items.Any())
diff --git a/Apps.Wordpress/Models/Requests/LanguageRequest.cs b/Apps.Wordpress/Models/Requests/LanguageRequest.cs
new file mode 100644
index 0000000..ba4f073
--- /dev/null
+++ b/Apps.Wordpress/Models/Requests/LanguageRequest.cs
@@ -0,0 +1,12 @@
+using Apps.Wordpress.DataSourceHandlers;
+using Blackbird.Applications.Sdk.Common;
+using Blackbird.Applications.Sdk.Common.Dynamic;
+
+namespace Apps.Wordpress.Models.Requests;
+
+public class LanguageOptionalRequest
+{
+ [Display("Language (P)")]
+ [DataSource(typeof(LanguageDataHandler))]
+ public string? Language { get; set; }
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 4b070ab..3c078ae 100644
--- a/README.md
+++ b/README.md
@@ -87,10 +87,10 @@ Let us know if you're interested!
## Events
-- **On post created** triggers when a new post is created.
-- **On post updated** triggers when any post is updated.
-- **On page created** triggers when a new page is created.
-- **On page updated** triggers when any page is updated.
+- **On posts created** triggers when new posts are created.
+- **On posts updated** triggers when any posts are updated.
+- **On pages created** triggers when new pages are created.
+- **On pages updated** triggers when any pages are updated.
## Feedback