From c406fc958805cf2a64a186bae0cb717f873fc19d Mon Sep 17 00:00:00 2001 From: Camille Marvin Date: Fri, 10 Oct 2014 17:43:35 -0700 Subject: [PATCH 1/2] Change name of AddObject's second parameter from "whitelist" to includedProperties. --- RestSharp/IRestRequest.cs | 6 +++--- RestSharp/RestRequest.cs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/RestSharp/IRestRequest.cs b/RestSharp/IRestRequest.cs index 942c64cdc..392813674 100644 --- a/RestSharp/IRestRequest.cs +++ b/RestSharp/IRestRequest.cs @@ -175,15 +175,15 @@ public interface IRestRequest IRestRequest AddBody (object obj); /// - /// Calls AddParameter() for all public, readable properties specified in the white list + /// Calls AddParameter() for all public, readable properties specified in the includedProperties list /// /// /// request.AddObject(product, "ProductId", "Price", ...); /// /// The object with properties to add as parameters - /// The names of the properties to include + /// The names of the properties to include /// This request - IRestRequest AddObject (object obj, params string[] whitelist); + IRestRequest AddObject (object obj, string[] includedProperties); /// /// Calls AddParameter() for all public, readable properties of obj diff --git a/RestSharp/RestRequest.cs b/RestSharp/RestRequest.cs index 2cbf2ee8b..ab43746af 100644 --- a/RestSharp/RestRequest.cs +++ b/RestSharp/RestRequest.cs @@ -252,15 +252,15 @@ public IRestRequest AddBody (object obj) } /// - /// Calls AddParameter() for all public, readable properties specified in the white list + /// Calls AddParameter() for all public, readable properties specified in the includedProperties list /// /// /// request.AddObject(product, "ProductId", "Price", ...); /// /// The object with properties to add as parameters - /// The names of the properties to include + /// The names of the properties to include /// This request - public IRestRequest AddObject (object obj, params string[] whitelist) + public IRestRequest AddObject (object obj, string[] includedProperties) { // automatically create parameters from object props var type = obj.GetType(); @@ -268,7 +268,7 @@ public IRestRequest AddObject (object obj, params string[] whitelist) foreach (var prop in props) { - bool isAllowed = whitelist.Length == 0 || (whitelist.Length > 0 && whitelist.Contains(prop.Name)); + bool isAllowed = includedProperties.Length == 0 || (includedProperties.Length > 0 && includedProperties.Contains(prop.Name)); if (isAllowed) { From 12e588fbd35508dd9c29a2cdc94976d88f46d0d6 Mon Sep 17 00:00:00 2001 From: Camille Marvin Date: Fri, 10 Oct 2014 18:17:50 -0700 Subject: [PATCH 2/2] reintroduce params (accidentally removed after misreading a ReSharper suggestion) --- RestSharp/IRestRequest.cs | 2 +- RestSharp/RestRequest.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/RestSharp/IRestRequest.cs b/RestSharp/IRestRequest.cs index 392813674..00e3cffa2 100644 --- a/RestSharp/IRestRequest.cs +++ b/RestSharp/IRestRequest.cs @@ -183,7 +183,7 @@ public interface IRestRequest /// The object with properties to add as parameters /// The names of the properties to include /// This request - IRestRequest AddObject (object obj, string[] includedProperties); + IRestRequest AddObject (object obj, params string[] includedProperties); /// /// Calls AddParameter() for all public, readable properties of obj diff --git a/RestSharp/RestRequest.cs b/RestSharp/RestRequest.cs index ab43746af..c6b5188aa 100644 --- a/RestSharp/RestRequest.cs +++ b/RestSharp/RestRequest.cs @@ -260,7 +260,7 @@ public IRestRequest AddBody (object obj) /// The object with properties to add as parameters /// The names of the properties to include /// This request - public IRestRequest AddObject (object obj, string[] includedProperties) + public IRestRequest AddObject (object obj, params string[] includedProperties) { // automatically create parameters from object props var type = obj.GetType();