public static void GetDataObject(Action <System.Net.WebClient> action, Uri uri, IWebClientCaller caller, IDictionary <string, string> queryParameters = null, IDictionary <string, string> headers = null) { NameValueCollection queryParams; if (queryParameters != null) { queryParams = new NameValueCollection(queryParameters.Count); queryParameters.ForEach(kvp => queryParams.Add(kvp.Key, kvp.Value)); } else { queryParams = new NameValueCollection(); } var headerParams = new WebHeaderCollection(); if (headers != null) { headers.ForEach(kvp => headerParams.Add(kvp.Key, kvp.Value)); } using (var client = new WebClientTimeouted(caller)) { client.Headers = headerParams; client.QueryString = queryParams; action(client); } }
public static JSONDynamicObject GetJsonAsDynamic(string uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary <string, string> queryParameters = null, IDictionary <string, string> bodyParameters = null, IDictionary <string, string> headers = null) { return(GetJsonAsDynamic(new Uri(uri), caller, method, queryParameters, bodyParameters, headers)); }
public static void GetFile(string file, Uri uri, IWebClientCaller caller, IDictionary <string, string> queryParameters = null, IDictionary <string, string> headers = null) { GetDataObject((c) => { c.DownloadFile(uri, file); }, uri, caller, queryParameters, headers); }
public static JSONDataMap GetValueMap(string uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary <string, string> queryParameters = null, IDictionary <string, string> bodyParameters = null, IDictionary <string, string> headers = null) { return(GetValueMap(new Uri(uri), caller, method, queryParameters, bodyParameters, headers)); }
public static XDocument GetXML(string uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary <string, string> queryParameters = null, IDictionary <string, string> bodyParameters = null, IDictionary <string, string> headers = null) { return(GetXML(new Uri(uri), caller, method, queryParameters, bodyParameters, headers)); }
public BaseClient(IWebClientCaller caller, string host, string subscriptionId, AzureOAuth2Token token) { Caller = caller; Host = new Uri(host); Token = token; SubscriptionId = subscriptionId; LogLevel = DEFAULT_LOG_LEVEL; }
public static XDocument GetXML(Uri uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary <string, string> queryParameters = null, IDictionary <string, string> bodyParameters = null, IDictionary <string, string> headers = null) { string responseStr = GetString(uri, caller, method, queryParameters: queryParameters, bodyParameters: bodyParameters, headers: headers); return(string.IsNullOrWhiteSpace(responseStr) ? null : XDocument.Parse(responseStr)); }
public static JSONDataMap GetJson(Uri uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary <string, string> queryParameters = null, IDictionary <string, string> bodyParameters = null, IDictionary <string, string> headers = null) { string responseStr = GetString(uri, caller, method, queryParameters: queryParameters, bodyParameters: bodyParameters, headers: headers); return(string.IsNullOrWhiteSpace(responseStr) ? null : responseStr.JSONToDataObject() as JSONDataMap); }
public static JSONDataMap GetValueMap(Uri uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary <string, string> queryParameters = null, IDictionary <string, string> bodyParameters = null, IDictionary <string, string> headers = null) { string responseStr = GetString(uri, caller, method, queryParameters: queryParameters, bodyParameters: bodyParameters, headers: headers); var dict = JSONDataMap.FromURLEncodedString(responseStr); return(dict); }
public RequestParams(IWebClientCaller caller) { Caller = caller; Method = HTTPRequestMethod.GET; ContentType = Web.ContentType.FORM_URL_ENCODED; QueryParameters = null; BodyParameters = null; Body = null; Headers = null; AcceptType = null; UserName = null; Password = null; }
public static byte[] GetData(Uri uri, IWebClientCaller caller, out string contentType, IDictionary <string, string> queryParameters = null, IDictionary <string, string> headers = null) { byte[] data = null; string localContentType = string.Empty; GetDataObject((c) => { data = c.DownloadData(uri); localContentType = c.ResponseHeaders[HttpResponseHeader.ContentType]; }, uri, caller, queryParameters, headers); contentType = localContentType; return(data); }
public static string GetString(Uri uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary <string, string> queryParameters = null, IDictionary <string, string> bodyParameters = null, string body = null, IDictionary <string, string> headers = null) { RequestParams request = new RequestParams() { Uri = uri, Caller = caller, Method = method, QueryParameters = queryParameters, BodyParameters = bodyParameters, Body = body, Headers = headers }; return(GetString(request)); }
public static JSONDynamicObject GetJsonAsDynamic(string uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary<string, string> queryParameters = null, IDictionary<string, string> bodyParameters = null, IDictionary<string, string> headers = null) { return GetJsonAsDynamic(new Uri(uri), caller, method, queryParameters, bodyParameters, headers); }
public static JSONDataMap GetJson(string uri, IWebClientCaller caller, string body, IDictionary <string, string> headers = null) { return(GetJson(new Uri(uri), caller, body, headers)); }
public WebClientTimeouted(IWebClientCaller caller) { WebSettings.RequireInitializedSettings(); m_Caller = caller; }
public static XDocument GetXML(Uri uri, IWebClientCaller caller, IDictionary<string, string> queryParameters, string body) { string responseStr = GetString(uri, caller, HTTPRequestMethod.POST, body: body, queryParameters: queryParameters); return string.IsNullOrWhiteSpace(responseStr) ? null : XDocument.Parse(responseStr); }
public static XDocument GetXML(Uri uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary<string, string> queryParameters = null, IDictionary<string, string> bodyParameters = null, IDictionary<string, string> headers = null) { string responseStr = GetString(uri, caller, method, queryParameters: queryParameters, bodyParameters: bodyParameters, headers: headers); return string.IsNullOrWhiteSpace(responseStr) ? null : XDocument.Parse(responseStr); }
public static JSONDataMap GetValueMap(Uri uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary<string, string> queryParameters = null, IDictionary<string, string> bodyParameters = null, IDictionary<string, string> headers = null) { string responseStr = GetString(uri, caller, method, queryParameters: queryParameters, bodyParameters: bodyParameters, headers: headers); var dict = Utils.ParseQueryString(responseStr); return dict; }
public static JSONDataMap GetJson(Uri uri, IWebClientCaller caller, string body, IDictionary<string, string> headers = null) { string responseStr = GetString(uri, caller, HTTPRequestMethod.POST, body: body, headers: headers); return string.IsNullOrWhiteSpace(responseStr) ? null : responseStr.JSONToDataObject() as JSONDataMap; }
public static XDocument GetXML(string uri, IWebClientCaller caller, IDictionary <string, string> queryParameters, string body) { return(GetXML(new Uri(uri), caller, queryParameters, body)); }
public static XDocument GetXML(Uri uri, IWebClientCaller caller, IDictionary <string, string> queryParameters, string body) { string responseStr = GetString(uri, caller, HTTPRequestMethod.POST, body: body, queryParameters: queryParameters); return(string.IsNullOrWhiteSpace(responseStr) ? null : XDocument.Parse(responseStr)); }
public NetworkClient(IWebClientCaller caller, string host, string subscriptionId, AzureOAuth2Token token) : base(caller, host, subscriptionId, token) { }
public static JSONDynamicObject GetJsonAsDynamic(string uri, IWebClientCaller caller, string body, IDictionary <string, string> headers = null) { return(GetJsonAsDynamic(new Uri(uri), caller, body, headers)); }
public static JSONDynamicObject GetJsonAsDynamic(string uri, IWebClientCaller caller, string body, IDictionary<string, string> headers = null) { return GetJsonAsDynamic(new Uri(uri), caller, body, headers); }
public static JSONDataMap GetJson(Uri uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary<string, string> queryParameters = null, IDictionary<string, string> bodyParameters = null, IDictionary<string, string> headers = null) { string responseStr = GetString(uri, caller, method, queryParameters: queryParameters, bodyParameters: bodyParameters, headers: headers); return string.IsNullOrWhiteSpace(responseStr) ? null : responseStr.JSONToDataObject() as JSONDataMap; }
public WebClientTimeouted(IWebClientCaller caller) { m_Caller = caller; }
public static JSONDataMap GetJson(string uri, IWebClientCaller caller, string body, IDictionary<string, string> headers = null) { return GetJson(new Uri(uri), caller, body, headers); }
public static string GetString(Uri uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary<string, string> queryParameters = null, IDictionary<string, string> bodyParameters = null, string body = null, IDictionary<string, string> headers = null) { RequestParams request = new RequestParams() { Uri = uri, Caller = caller, Method = method, QueryParameters = queryParameters, BodyParameters = bodyParameters, Body = body, Headers = headers }; return GetString(request); }
public static JSONDataMap GetValueMap(string uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary<string, string> queryParameters = null, IDictionary<string, string> bodyParameters = null, IDictionary<string, string> headers = null) { return GetValueMap(new Uri(uri), caller, method, queryParameters, bodyParameters, headers); }
public static byte[] GetData(Uri uri, IWebClientCaller caller, out string contentType, IDictionary<string, string> queryParameters = null, IDictionary<string, string> headers = null) { byte[] data = null; string localContentType = string.Empty; GetDataObject((c) => { data = c.DownloadData(uri); localContentType = c.ResponseHeaders[HttpResponseHeader.ContentType]; }, uri, caller, queryParameters, headers); contentType = localContentType; return data; }
public static XDocument GetXML(string uri, IWebClientCaller caller, HTTPRequestMethod method = HTTPRequestMethod.GET, IDictionary<string, string> queryParameters = null, IDictionary<string, string> bodyParameters = null, IDictionary<string, string> headers = null) { return GetXML(new Uri(uri), caller, method, queryParameters, bodyParameters, headers); }
public static void GetFile(string file, Uri uri, IWebClientCaller caller, IDictionary<string, string> queryParameters = null, IDictionary<string, string> headers = null) { GetDataObject((c) => { c.DownloadFile(uri, file); }, uri, caller, queryParameters, headers); }
public static XDocument GetXML(string uri, IWebClientCaller caller, IDictionary<string, string> queryParameters, string body) { return GetXML(new Uri(uri), caller, queryParameters, body); }
public static void GetDataObject(Action<System.Net.WebClient> action, Uri uri, IWebClientCaller caller, IDictionary<string, string> queryParameters = null, IDictionary<string, string> headers = null) { NameValueCollection queryParams; if (queryParameters != null) { queryParams = new NameValueCollection(queryParameters.Count); queryParameters.ForEach(kvp => queryParams.Add(kvp.Key, kvp.Value)); } else { queryParams = new NameValueCollection(); } var headerParams = new WebHeaderCollection(); if (headers != null) headers.ForEach(kvp => headerParams.Add(kvp.Key, kvp.Value)); using (var client = new WebClientTimeouted(caller)) { client.Headers = headerParams; client.QueryString = queryParams; action(client); } }
public ComputeClient(IWebClientCaller caller, string subscriptionId, AzureOAuth2Token token) { }
public static JSONDataMap GetJson(Uri uri, IWebClientCaller caller, string body, IDictionary <string, string> headers = null) { string responseStr = GetString(uri, caller, HTTPRequestMethod.POST, body: body, headers: headers); return(string.IsNullOrWhiteSpace(responseStr) ? null : responseStr.JSONToDataObject() as JSONDataMap); }