コード例 #1
0
ファイル: StaticClient.cs プロジェクト: masums/ITCC.Library
 /// <summary>
 ///     Basic HEAD method: returns status and body
 /// </summary>
 /// <param name="partialUri">Uri part after server address/fqdn and port</param>
 /// <param name="parameters">Request parameters after `?`</param>
 /// <param name="headers">Request headers</param>
 /// <param name="authentificationProvider">Authentification provider</param>
 /// <param name="cancellationToken">Task cancellation token</param>
 /// <returns></returns>
 public static Task <RequestResult <string> > HeadRawAsync(
     string partialUri,
     IDictionary <string, string> parameters = null,
     IDictionary <string, string> headers    = null,
     Delegates.AuthentificationDataAdder authentificationProvider = null,
     CancellationToken cancellationToken = default(CancellationToken))
 => RegularClient.HeadRawAsync(partialUri,
                               parameters,
                               headers,
                               authentificationProvider,
                               cancellationToken);
コード例 #2
0
ファイル: StaticClient.cs プロジェクト: masums/ITCC.Library
 /// <summary>
 ///     Method tries to deserialize response as TResult or TError
 /// </summary>
 /// <typeparam name="TResult"></typeparam>
 /// <param name="partialUri">Uri part after server address/fqdn and port</param>
 /// <param name="parameters">Request parameters after `?`</param>
 /// <param name="headers">Request headers</param>
 /// <param name="authentificationProvider">Authentification provider</param>
 /// <param name="cancellationToken">Task cancellation token</param>
 /// <returns></returns>
 public static Task <RequestResult <TResult> > GetAsync <TResult>(
     string partialUri,
     IDictionary <string, string> parameters = null,
     IDictionary <string, string> headers    = null,
     Delegates.AuthentificationDataAdder authentificationProvider = null,
     CancellationToken cancellationToken = default(CancellationToken)) where TResult : class
 => RegularClient.GetAsync <TResult>(partialUri,
                                     parameters,
                                     headers,
                                     authentificationProvider,
                                     cancellationToken);
コード例 #3
0
ファイル: StaticClient.cs プロジェクト: masums/ITCC.Library
 /// <summary>
 ///     Method tries to deserialize response as TSuccess and then as ApiErrorView
 /// </summary>
 /// <typeparam name="TSuccess">Success response type</typeparam>
 /// <param name="partialUri">Uri part after server address/fqdn and port</param>
 /// <param name="parameters">Request parameters after `?`</param>
 /// <param name="headers">Request headers</param>
 /// <param name="authentificationProvider">Authentification provider</param>
 /// <param name="cancellationToken">Task cancellation token</param>
 /// <returns></returns>
 public static Task <VariadicRequestResult <TSuccess, ApiErrorView> > GetWithApiErrorAsync <TSuccess>(
     string partialUri,
     IDictionary <string, string> parameters = null,
     IDictionary <string, string> headers    = null,
     Delegates.AuthentificationDataAdder authentificationProvider = null,
     CancellationToken cancellationToken = default(CancellationToken))
     where TSuccess : class
 => RegularClient.GetWithApiErrorAsync <TSuccess>(
     partialUri,
     parameters,
     headers,
     authentificationProvider,
     cancellationToken
     );
コード例 #4
0
ファイル: StaticClient.cs プロジェクト: masums/ITCC.Library
 /// <summary>
 ///     Deletes object and returns deserialized TSuccess or ApiErrorView
 /// </summary>
 /// <param name="partialUri">Uri part after server address/fqdn and port</param>
 /// <param name="parameters">Request parameters after `?`</param>
 /// <param name="headers">Request headers</param>
 /// <param name="data">Raw request body</param>
 /// <param name="authentificationProvider">Authentification provider</param>
 /// <param name="cancellationToken">Task cancellation token</param>
 /// <returns>Response result and deserialized body</returns>
 public static Task <VariadicRequestResult <string, ApiErrorView> > DeleteWithApiErrorAsync(
     string partialUri,
     IDictionary <string, string> parameters = null,
     IDictionary <string, string> headers    = null,
     object data = null,
     Delegates.AuthentificationDataAdder authentificationProvider = null,
     CancellationToken cancellationToken = default(CancellationToken))
 => RegularClient.DeleteWithApiErrorAsync(
     partialUri,
     parameters,
     headers,
     data,
     authentificationProvider,
     cancellationToken
     );
コード例 #5
0
ファイル: StaticClient.cs プロジェクト: masums/ITCC.Library
 /// <summary>
 ///     Puts object and returns success string or TError
 /// </summary>
 /// <typeparam name="TError">Error response type</typeparam>
 /// <param name="partialUri">Uri part after server address/fqdn and port</param>
 /// <param name="parameters">Request parameters after `?`</param>
 /// <param name="headers">Request headers</param>
 /// <param name="data">Raw request body</param>
 /// <param name="authentificationProvider">Authentification provider</param>
 /// <param name="cancellationToken">Task cancellation token</param>
 /// <returns>Response result and deserialized body</returns>
 public static Task <VariadicRequestResult <string, TError> > PutVariadicAsync <TError>(
     string partialUri,
     IDictionary <string, string> parameters = null,
     IDictionary <string, string> headers    = null,
     object data = null,
     Delegates.AuthentificationDataAdder authentificationProvider = null,
     CancellationToken cancellationToken = default(CancellationToken))
     where TError : class
 => RegularClient.PutVariadicAsync <TError>(
     partialUri,
     parameters,
     headers,
     data,
     authentificationProvider,
     cancellationToken);
コード例 #6
0
ファイル: StaticClient.cs プロジェクト: masums/ITCC.Library
 /// <summary>
 ///     Downloads file by uri into specified location
 /// </summary>
 /// <param name="partialUri">Uri part after server address/fqdn and port</param>
 /// <param name="parameters">Request parameters after `?`</param>
 /// <param name="headers">Request headers</param>
 /// <param name="fileName">Target file location. If null, then uri part after last slash will be used</param>
 /// <param name="allowRewrite">If false, ClientError will be returned if file exists</param>
 /// <param name="authentificationProvider">Authentification provider</param>
 /// <param name="cancellationToken">Task cancellation token</param>
 /// <returns></returns>
 public static Task <RequestResult <string> > GetFileAsync(
     string partialUri,
     IDictionary <string, string> parameters = null,
     IDictionary <string, string> headers    = null,
     string fileName   = null,
     bool allowRewrite = true,
     Delegates.AuthentificationDataAdder authentificationProvider = null,
     CancellationToken cancellationToken = default(CancellationToken))
 => RegularClient.GetFileAsync(partialUri,
                               parameters,
                               headers,
                               fileName,
                               allowRewrite,
                               authentificationProvider,
                               cancellationToken);
コード例 #7
0
ファイル: StaticClient.cs プロジェクト: masums/ITCC.Library
 internal static Task <RequestResult <TResult> > PerformRequestAsync <TBody, TResult>(
     HttpMethod method,
     string partialUri,
     IDictionary <string, string> parameters = null,
     IDictionary <string, string> headers    = null,
     TBody bodyArg = default(TBody),
     Delegates.AuthentificationDataAdder authentificationProvider = null,
     Stream outputStream = null,
     CancellationToken cancellationToken = default(CancellationToken))
     where TResult : class
     where TBody : class
 => RegularClient.PerformRequestAsync <TBody, TResult>(method,
                                                       partialUri,
                                                       parameters,
                                                       headers,
                                                       bodyArg,
                                                       authentificationProvider,
                                                       outputStream,
                                                       RegularClient.AllowedRedirectCount,
                                                       cancellationToken);
コード例 #8
0
ファイル: StaticClient.cs プロジェクト: masums/ITCC.Library
 // ReSharper disable once FunctionComplexityOverflow
 internal static Task <VariadicRequestResult <TResponseSuccess, TResponseError> > PerformVariadicRequestAsync
 <TRequestBody, TResponseSuccess, TResponseError>(
     HttpMethod method,
     string partialUri,
     IDictionary <string, string> parameters = null,
     IDictionary <string, string> headers    = null,
     TRequestBody bodyArg = default(TRequestBody),
     Delegates.AuthentificationDataAdder authentificationProvider = null,
     Stream outputStream = null,
     int redirectsLeft   = 0,
     CancellationToken cancellationToken = default(CancellationToken))
     where TRequestBody : class
     where TResponseSuccess : class
     where TResponseError : class
 => RegularClient.PerformVariadicRequestAsync <TRequestBody, TResponseSuccess, TResponseError>(
     method,
     partialUri,
     parameters,
     headers,
     bodyArg,
     authentificationProvider,
     outputStream,
     redirectsLeft,
     cancellationToken);