Beispiel #1
0
        /// <summary>
        /// Creates an HTTP PUT request with authentication
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="baseAddress"></param>
        /// <param name="url"></param>
        /// <param name="data"></param>
        /// <param name="credentials"></param>
        /// <returns><see cref="Task{HttpResponseMessage}"/></returns>
        public Task <HttpResponse> PutData <T>(string baseAddress, string url, T data, string token)
        {
            var httpClient = HttpConnectionHelper.GetClient(baseAddress);

            HttpConnectionHelper.AddAuthorization(httpClient, token);

            return(SendHttpRequestAsync(RequestType.PUT, url, data, httpClient));
        }
Beispiel #2
0
        /// <summary>
        /// Creates an HTTP POST request without authentication
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="baseAddress"></param>
        /// <param name="url"></param>
        /// <param name="data"></param>
        /// <returns><see cref="Task{HttpResponseMessage}"/></returns>
        public Task <HttpResponse> PostData <T>(string baseAddress, string url, T data)
        {
            var httpClient = HttpConnectionHelper.GetClient(baseAddress);

            return(SendHttpRequestAsync(RequestType.POST, url, data, httpClient));
        }
Beispiel #3
0
        /// <summary>
        /// Creates an HTTP GET request without authentication
        /// </summary>
        /// <param name="baseAddress"></param>
        /// <param name="url"></param>
        /// <returns><see cref="Task{HttpResponseMessage}"/></returns>
        public Task <HttpResponse> GetData(string baseAddress, string url)
        {
            var httpClient = HttpConnectionHelper.GetClient(baseAddress);

            return(SendHttpRequestAsync(RequestType.GET, url, new { }, httpClient));
        }