From 5915e595ed82f477d59a72c264a954ec29324d5a Mon Sep 17 00:00:00 2001 From: Cihan T Date: Thu, 8 Feb 2018 13:17:34 +0300 Subject: [PATCH 1/2] CustomFields property added to Post class --- WordPressPCL/Models/Post.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/WordPressPCL/Models/Post.cs b/WordPressPCL/Models/Post.cs index 7e21e11..7d4f68d 100644 --- a/WordPressPCL/Models/Post.cs +++ b/WordPressPCL/Models/Post.cs @@ -219,6 +219,13 @@ public class Post : Base [JsonProperty("_embedded", DefaultValueHandling = DefaultValueHandling.Ignore)] public Embedded Embedded { get; set; } + /// + /// Custom Fields. You have to add action to functions.php + /// + /// + [JsonProperty("custom_fields", DefaultValueHandling = DefaultValueHandling.Ignore)] + public IDictionary CustomFields { get; set; } + /// /// Parameterless constructor /// From 2d23bd2862d905819c61b7f65d36fc3c7126732b Mon Sep 17 00:00:00 2001 From: Cihan T Date: Sun, 25 Feb 2018 19:49:02 +0300 Subject: [PATCH 2/2] changes --- WordPressPCL/Client/Media.cs | 12 ++++++++++++ WordPressPCL/Models/Post.cs | 3 +-- WordPressPCL/WordPressPCL.xml | 16 +++++++++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/WordPressPCL/Client/Media.cs b/WordPressPCL/Client/Media.cs index 8242008..e8d711a 100644 --- a/WordPressPCL/Client/Media.cs +++ b/WordPressPCL/Client/Media.cs @@ -116,6 +116,18 @@ public async Task> GetAll(bool embed = false, bool useAut return entities; } + /// + /// Get All by Post ID + /// + /// ID + /// Include embed info + /// Send request with authenication header + /// List of all result + public async Task> GetAllByPostID(int ID, bool embed = false, bool useAuth = false) + { + return (await _httpHelper.GetRequest>($"{_defaultPath}{_methodPath}?parent={ID}", embed, useAuth).ConfigureAwait(false))?.ToList(); + } + /// /// Get Entity by Id /// diff --git a/WordPressPCL/Models/Post.cs b/WordPressPCL/Models/Post.cs index 7d4f68d..2835441 100644 --- a/WordPressPCL/Models/Post.cs +++ b/WordPressPCL/Models/Post.cs @@ -221,10 +221,9 @@ public class Post : Base /// /// Custom Fields. You have to add action to functions.php - /// /// [JsonProperty("custom_fields", DefaultValueHandling = DefaultValueHandling.Ignore)] - public IDictionary CustomFields { get; set; } + public IDictionary CustomFields { get; set; } /// /// Parameterless constructor diff --git a/WordPressPCL/WordPressPCL.xml b/WordPressPCL/WordPressPCL.xml index 3105cf8..032f652 100644 --- a/WordPressPCL/WordPressPCL.xml +++ b/WordPressPCL/WordPressPCL.xml @@ -243,6 +243,15 @@ Send request with authenication header List of all result + + + Get All by Post ID + + ID + Include embed info + Send request with authenication header + List of all result + Get Entity by Id @@ -1029,7 +1038,7 @@ Status of Comments - + Comment Approved @@ -2131,6 +2140,11 @@ Embedded information like featured images + + + Custom Fields. You have to add action to functions.php + + Parameterless constructor