public static void DeleteAsync(string endpoint = null, HttpParameterCollection parameters = null, HttpAuthorization authorization = null, NameValueCollection headers = null, string contentType = null, AccessToken accessToken = null, ExecuteRequestAsyncCallback callback = null, bool allowWriteStreamBuffering = false, bool allowSendChunked = true, long contentLength = -1, HttpWriteRequestStream streamWriteCallback = null, int writeBufferSize = 4096, int readBufferSize = 4096, bool donotEncodeKeys = false) { NewOAuthUtility.ExecuteRequestAsync("DELETE", endpoint, parameters, authorization, headers, contentType, accessToken, callback, allowWriteStreamBuffering, allowSendChunked, contentLength, streamWriteCallback, writeBufferSize, readBufferSize, donotEncodeKeys); }
/// <summary> /// Performs an async request. /// </summary> /// <param name="method">HTTP Method: <b>POST</b> (default), <b>PUT</b>, <b>GET</b> or <b>DELETE</b>.</param> /// <param name="endpoint">URL to which will be sent to request.</param> /// <param name="parameters">Parameters to be passed to request.</param> /// <param name="authorization">Authorization header value.</param> /// <param name="headers">HTTP headers for request.</param> /// <param name="contentType">The value of the <b>Content-Type</b> HTTP header.</param> /// <param name="callback">A delegate that, if provided, is called when an async web request is completed.</param> /// <param name="accessToken">Access token to be used in the request.</param> /// <remarks> /// <para>Can not be used simultaneously <paramref name="accessToken"/> and <paramref name="authorization"/>. Use only one of these parameters.</para> /// </remarks> /// <returns>Returns an instance of the <see cref="RequestResult"/> class, which contains the result of the request.</returns> /// <exception cref="System.ArgumentNullException"></exception> /// <exception cref="RequestException"></exception> /// <exception cref="ArgumentException"> /// <para>The exception occurs when the query parameters are specified at the same time <paramref name="authorization"/> and <paramref name="accessToken"/>.</para> /// </exception> public static void ExecuteRequestAsync(string method = "POST", string endpoint = null, HttpParameterCollection parameters = null, HttpAuthorization authorization = null, NameValueCollection headers = null, string contentType = null, AccessToken accessToken = null, ExecuteRequestAsyncCallback callback = null) { var t = new Thread (() => { RequestResult result = null; try { result = OAuthUtility.ExecuteRequest(method, endpoint, parameters, authorization, headers, contentType, accessToken); } catch (RequestException ex) { result = ex.RequestResult; } if (callback != null) { callback(result); } } ); t.IsBackground = true; t.Start(); }
/// <summary> /// Performs an async request using a <b>DELETE</b> method. /// </summary> /// <param name="endpoint">URL to which will be sent to request.</param> /// <param name="parameters">Parameters to be passed to request.</param> /// <param name="authorization">Authorization header value.</param> /// <param name="headers">HTTP headers for request.</param> /// <param name="callback">A delegate that, if provided, is called when an async request is completed.</param> /// <param name="accessToken">Access token to be used in the request.</param> /// <remarks> /// <para>Can not be used simultaneously <paramref name="accessToken"/> and <paramref name="authorization"/>. Use only one of these parameters.</para> /// </remarks> /// <returns>Returns an instance of the <see cref="RequestResult"/> class, which contains the result of the request.</returns> /// <exception cref="System.ArgumentNullException"></exception> /// <exception cref="RequestException"></exception> /// <exception cref="ArgumentException"> /// <para>The exception occurs when the query parameters are specified at the same time <paramref name="authorization"/> and <paramref name="accessToken"/>.</para> /// </exception> public static void DeleteAsync(string endpoint = null, HttpParameterCollection parameters = null, HttpAuthorization authorization = null, NameValueCollection headers = null, AccessToken accessToken = null, ExecuteRequestAsyncCallback callback = null) { OAuthUtility.ExecuteRequestAsync("DELETE", endpoint, parameters, authorization, headers, null, accessToken, callback); }
/// <summary> /// Performs an async request using a <b>PUT</b> method. /// </summary> /// <param name="endpoint">URL to which will be sent to request.</param> /// <param name="parameters">Parameters to be passed to request.</param> /// <param name="authorization">Authorization header value.</param> /// <param name="headers">HTTP headers for request.</param> /// <param name="contentType">The value of the <b>Content-Type</b> HTTP header.</param> /// <param name="callback">A delegate that, if provided, is called when an async request is completed.</param> /// <param name="accessToken">Access token to be used in the request.</param> /// <remarks> /// <para>Can not be used simultaneously <paramref name="accessToken"/> and <paramref name="authorization"/>. Use only one of these parameters.</para> /// </remarks> /// <returns>Returns an instance of the <see cref="RequestResult"/> class, which contains the result of the request.</returns> /// <exception cref="System.ArgumentNullException"></exception> /// <exception cref="RequestException"></exception> /// <exception cref="ArgumentException"> /// <para>The exception occurs when the query parameters are specified at the same time <paramref name="authorization"/> and <paramref name="accessToken"/>.</para> /// </exception> public static void PutAsync(string endpoint = null, HttpParameterCollection parameters = null, HttpAuthorization authorization = null, NameValueCollection headers = null, string contentType = null, AccessToken accessToken = null, ExecuteRequestAsyncCallback callback = null) { OAuthUtility.ExecuteRequestAsync("PUT", endpoint, parameters, authorization, headers, contentType, accessToken, callback); }
/// <summary> /// Performs an async request. /// </summary> /// <param name="method">HTTP Method: <b>POST</b> (default), <b>PUT</b>, <b>GET</b> or <b>DELETE</b>.</param> /// <param name="endpoint">URL to which will be sent to request.</param> /// <param name="parameters">Parameters to be passed to request.</param> /// <param name="authorization">Authorization header value.</param> /// <param name="headers">HTTP headers for request.</param> /// <param name="contentType">The value of the <b>Content-Type</b> HTTP header.</param> /// <param name="callback">A delegate that, if provided, is called when an async web request is completed.</param> /// <param name="accessToken">Access token to be used in the request.</param> /// <remarks> /// <para>Can not be used simultaneously <paramref name="accessToken"/> and <paramref name="authorization"/>. Use only one of these parameters.</para> /// </remarks> /// <returns>Returns an instance of the <see cref="RequestResult"/> class, which contains the result of the request.</returns> /// <exception cref="System.ArgumentNullException"></exception> /// <exception cref="RequestException"></exception> /// <exception cref="ArgumentException"> /// <para>The exception occurs when the query parameters are specified at the same time <paramref name="authorization"/> and <paramref name="accessToken"/>.</para> /// </exception> public static void ExecuteRequestAsync(string method = "POST", string endpoint = null, HttpParameterCollection parameters = null, HttpAuthorization authorization = null, NameValueCollection headers = null, string contentType = null, AccessToken accessToken = null, ExecuteRequestAsyncCallback callback = null) { var t = new Thread (() => { RequestResult result = null; try { result = OAuthUtility.ExecuteRequest(method, endpoint, parameters, authorization, headers, contentType, accessToken); } catch (RequestException ex) { result = ex.RequestResult; } if (callback != null) { callback(result); } } ); t.IsBackground = true; t.Start(); }
/// <summary> /// Performs an async request using a <b>DELETE</b> method. /// </summary> /// <param name="endpoint">URL to which will be sent to request.</param> /// <param name="parameters">Parameters to be passed to request.</param> /// <param name="authorization">Authorization header value.</param> /// <param name="headers">HTTP headers for request.</param> /// <param name="callback">A delegate that, if provided, is called when an async request is completed.</param> /// <param name="accessToken">Access token to be used in the request.</param> /// <remarks> /// <para>Can not be used simultaneously <paramref name="accessToken"/> and <paramref name="authorization"/>. Use only one of these parameters.</para> /// </remarks> /// <returns>Returns an instance of the <see cref="RequestResult"/> class, which contains the result of the request.</returns> /// <exception cref="System.ArgumentNullException"></exception> /// <exception cref="RequestException"></exception> /// <exception cref="ArgumentException"> /// <para>The exception occurs when the query parameters are specified at the same time <paramref name="authorization"/> and <paramref name="accessToken"/>.</para> /// </exception> public static void DeleteAsync(string endpoint = null, HttpParameterCollection parameters = null, HttpAuthorization authorization = null, NameValueCollection headers = null, AccessToken accessToken = null, ExecuteRequestAsyncCallback callback = null) { OAuthUtility.ExecuteRequestAsync("DELETE", endpoint, parameters, authorization, headers, null, accessToken, callback); }
/// <summary> /// Performs an async request using a <b>PUT</b> method. /// </summary> /// <param name="endpoint">URL to which will be sent to request.</param> /// <param name="parameters">Parameters to be passed to request.</param> /// <param name="authorization">Authorization header value.</param> /// <param name="headers">HTTP headers for request.</param> /// <param name="contentType">The value of the <b>Content-Type</b> HTTP header.</param> /// <param name="callback">A delegate that, if provided, is called when an async request is completed.</param> /// <param name="accessToken">Access token to be used in the request.</param> /// <remarks> /// <para>Can not be used simultaneously <paramref name="accessToken"/> and <paramref name="authorization"/>. Use only one of these parameters.</para> /// </remarks> /// <returns>Returns an instance of the <see cref="RequestResult"/> class, which contains the result of the request.</returns> /// <exception cref="System.ArgumentNullException"></exception> /// <exception cref="RequestException"></exception> /// <exception cref="ArgumentException"> /// <para>The exception occurs when the query parameters are specified at the same time <paramref name="authorization"/> and <paramref name="accessToken"/>.</para> /// </exception> public static void PutAsync(string endpoint = null, HttpParameterCollection parameters = null, HttpAuthorization authorization = null, NameValueCollection headers = null, string contentType = null, AccessToken accessToken = null, ExecuteRequestAsyncCallback callback = null) { OAuthUtility.ExecuteRequestAsync("PUT", endpoint, parameters, authorization, headers, contentType, accessToken, callback); }
public static void ExecuteRequestAsync(string method = "POST", string endpoint = null, HttpParameterCollection parameters = null, HttpAuthorization authorization = null, NameValueCollection headers = null, string contentType = null, AccessToken accessToken = null, ExecuteRequestAsyncCallback callback = null, bool allowWriteStreamBuffering = false, bool allowSendChunked = true, long contentLength = -1, HttpWriteRequestStream streamWriteCallback = null, int writeBufferSize = 4096, int readBufferSize = 4096, bool donotEncodeKeys = false) { new Thread((ThreadStart)(() => { RequestResult result; try { result = OAuthUtility.ExecuteRequest(method, endpoint, parameters, authorization, headers, contentType, accessToken, allowWriteStreamBuffering, allowSendChunked, contentLength, streamWriteCallback, writeBufferSize, readBufferSize, donotEncodeKeys); } catch (RequestException ex) { result = ex.RequestResult; } if (callback == null) { return; } callback(result); })) { IsBackground = true }.Start(); }