From 5cc23434a6c9bf42625d65be9ca0b74664e4f1b4 Mon Sep 17 00:00:00 2001 From: Howie Douglas Date: Fri, 23 May 2014 12:15:45 +0100 Subject: [PATCH] Expose RestClient "Proxy" property Expose the "Proxy" property from RestSharp's "RestClient" class. Allow this to be passed via the "Client" constructor. This will enable proxy configuration for the UserVoice client. --- UserVoice/Client.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/UserVoice/Client.cs b/UserVoice/Client.cs index 2656e22..f6a0398 100644 --- a/UserVoice/Client.cs +++ b/UserVoice/Client.cs @@ -32,7 +32,7 @@ public class Client public string Secret; private Client requestToken = null; - public Client(string subdomainName, string apiKey, string apiSecret=null, string callback=null, string token=null, string secret=null, string uservoiceDomain=null, string protocol=null) { + public Client(string subdomainName, string apiKey, string apiSecret=null, string callback=null, string token=null, string secret=null, string uservoiceDomain=null, string protocol=null, IWebProxy proxy = null) { this.protocol = protocol ?? "https"; this.uservoiceDomain = uservoiceDomain ?? "uservoice.com"; this.apiKey = apiKey; @@ -44,10 +44,12 @@ public Client(string subdomainName, string apiKey, string apiSecret=null, string consumer = new RestClient(this.protocol + "://" + this.subdomainName + "." + this.uservoiceDomain); if (apiSecret != null) { consumer.Authenticator = OAuth1Authenticator.ForRequestToken(apiKey, apiSecret, callback); + consumer.Proxy = proxy; } if (token != null && secret != null) { accessToken = new RestClient(this.protocol + "://" + this.subdomainName + "." + this.uservoiceDomain); accessToken.Authenticator = OAuth1Authenticator.ForAccessToken(apiKey, apiSecret, token, secret); + accessToken.Proxy = proxy; } } private RestClient getToken() {