< Summary

Information
Class: MyNet.Http.WebApiService
Assembly: MyNet.Http
File(s): https://raw.githubusercontent.com/sandre58/MyNet/5aaaab311aa14541478b9e402357d98b657a23e4/src/MyNet.Http/WebApiService.cs
Tag: 342_31701152804
Line coverage
44%
Covered lines: 71
Uncovered lines: 88
Coverable lines: 159
Total lines: 462
Line coverage: 44.6%
Branch coverage
44%
Covered branches: 23
Total branches: 52
Branch coverage: 44.2%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
.ctor(...)100%210%
.ctor(...)100%22100%
GetStreamAsync(...)100%210%
GetDataAsync(...)100%11100%
GetDataAsync(...)100%11100%
PostDataAsync(...)100%210%
PostDataAsync(...)100%210%
PostDataAsync(...)100%11100%
PostDataAsync(...)100%11100%
PostDataAsync(...)100%210%
PostDataAsync(...)100%210%
PutDataAsync(...)100%210%
PutDataAsync(...)100%210%
PatchDataAsync(...)100%210%
PatchDataAsync(...)100%210%
DeleteDataAsync(...)100%210%
DeleteDataAsync(...)100%210%
DeleteDataAsync(...)100%210%
DeleteDataAsync(...)100%210%
DeleteDataAsync(...)100%210%
DeleteDataAsync(...)100%210%
Dispose()50%2266.66%
SendRequestAsync()50%4475%
SendRequestAsync()100%44100%
CreateHttpClient(...)100%210%
GetStreamAsync()0%2040%
ApplyHeaders(...)0%7280%
CreateRequest(...)100%11100%
CreateLinkedTimeoutTokenSource(...)75%44100%
CreateContent(...)100%11100%
ToWebUri(...)50%44100%
ReadResponseAsync()50%7666.66%
GetExceptionAsync(...)100%11100%
GetExceptionAsync()50%141277.77%
.ctor(...)100%210%
get_CanRead()100%210%
get_CanSeek()100%210%
get_CanWrite()100%210%
get_Length()100%210%
get_Position()100%210%
set_Position(...)100%210%
Flush()100%210%
Read(...)100%210%
ReadAsync(...)100%210%
ReadAsync(...)100%210%
Seek(...)100%210%
SetLength(...)100%210%
Write(...)100%210%
WriteAsync(...)100%210%
WriteAsync(...)100%210%
Dispose(...)0%620%
DisposeAsync()100%210%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/5aaaab311aa14541478b9e402357d98b657a23e4/src/MyNet.Http/WebApiService.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="WebApiService.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using System.Collections.Generic;
 9using System.Diagnostics.CodeAnalysis;
 10using System.Globalization;
 11using System.IO;
 12using System.Linq;
 13using System.Net;
 14using System.Net.Http;
 15using System.Net.Http.Headers;
 16using System.Text;
 17using System.Text.Json;
 18using System.Text.Json.Nodes;
 19using System.Threading;
 20using System.Threading.Tasks;
 21using MyNet.Http.Exceptions;
 22using MyNet.Text;
 23
 24namespace MyNet.Http;
 25
 26/// <summary>
 27/// Provides methods to interact with web APIs using HTTP requests. The <see cref="WebApiService"/> class allows sending
 28/// </summary>
 29public sealed class WebApiService : IWebApiService
 30{
 331    private static readonly JsonSerializerOptions JsonOptions = new() { PropertyNameCaseInsensitive = true };
 32
 33    private readonly HttpClient _client;
 34    private readonly bool _disposeClient;
 35    private readonly TimeSpan _timeout;
 36    private readonly Func<object?, Exception>? _toException;
 37
 38    /// <summary>
 39    /// Initializes a new instance of the <see cref="WebApiService"/> class.
 40    /// </summary>
 41    /// <param name="serverUrl">Target server URL.</param>
 42    /// <param name="timeout">Maximum request timeout duration.</param>
 43    /// <param name="headers">Custom HTTP headers.</param>
 44    /// <param name="toException">Function to convert a response to an exception.</param>
 45    public WebApiService(Uri? serverUrl = null, TimeSpan timeout = default, Dictionary<string, string>? headers = null, 
 046        : this(CreateHttpClient(serverUrl, headers), timeout, toException, disposeClient: true)
 47    {
 048    }
 49
 50    /// <summary>
 51    /// Initializes a new instance of the <see cref="WebApiService"/> class with a custom <see cref="HttpClient"/>.
 52    /// </summary>
 53    /// <param name="client">Configured HTTP client.</param>
 54    /// <param name="timeout">Maximum request timeout duration.</param>
 55    /// <param name="toException">Function to convert a response to an exception.</param>
 56    /// <param name="disposeClient">Indicates whether this service should dispose the HTTP client.</param>
 57    public WebApiService(HttpClient client, TimeSpan timeout = default, Func<object?, Exception>? toException = null, bo
 58    {
 1559        ArgumentNullException.ThrowIfNull(client);
 60
 1561        _client = client;
 1562        _disposeClient = disposeClient;
 1563        _toException = toException;
 1564        _timeout = timeout != TimeSpan.Zero ? timeout : TimeSpan.FromMilliseconds(Timeout.Infinite);
 65
 66        // We enforce timeouts per request via CancellationTokenSource.CancelAfter.
 1567        _client.Timeout = Timeout.InfiniteTimeSpan;
 1568    }
 69
 70    /// <inheritdoc/>
 071    public Task<Stream> GetStreamAsync(string str) => GetStreamAsync(new Uri(str, UriKind.RelativeOrAbsolute), Cancellat
 72
 73    /// <inheritdoc/>
 1274    public Task<T> GetDataAsync<T>(string str, CancellationToken cancellationToken, params ApiParameter[] parameters) =>
 75
 76    /// <inheritdoc/>
 1277    public Task<T> GetDataAsync<T>(Uri uri, CancellationToken cancellationToken = default) => SendRequestAsync<T>(HttpMe
 78
 79    /// <inheritdoc/>
 080    public Task<TReturn> PostDataAsync<TParam, TReturn>(string str, TParam value, CancellationToken cancellationToken, p
 81
 82    /// <inheritdoc/>
 083    public Task<T> PostDataAsync<TParam, T>(Uri uri, TParam value, CancellationToken cancellationToken = default) => Sen
 84
 85    /// <inheritdoc/>
 386    public Task PostDataAsync<TParam>(string str, TParam value, CancellationToken cancellationToken, params ApiParameter
 87
 88    /// <inheritdoc/>
 389    public Task PostDataAsync<TParam>(Uri uri, TParam value, CancellationToken cancellationToken = default) => SendReque
 90
 91    /// <inheritdoc/>
 092    public Task PostDataAsync(string str, CancellationToken cancellationToken, params ApiParameter[] parameters) => Post
 93
 94    /// <inheritdoc/>
 095    public Task PostDataAsync(Uri uri, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.Pos
 96
 97    /// <inheritdoc/>
 098    public Task<TReturn> PutDataAsync<TParam, TReturn>(string str, TParam value, CancellationToken cancellationToken, pa
 99
 100    /// <inheritdoc/>
 0101    public Task<T> PutDataAsync<TParam, T>(Uri uri, TParam value, CancellationToken cancellationToken = default) => Send
 102
 103    /// <inheritdoc/>
 0104    public Task<TReturn> PatchDataAsync<TParam, TReturn>(string str, TParam value, CancellationToken cancellationToken, 
 105
 106    /// <inheritdoc/>
 0107    public Task<T> PatchDataAsync<TParam, T>(Uri uri, TParam value, CancellationToken cancellationToken = default) => Se
 108
 109    /// <inheritdoc/>
 0110    public Task DeleteDataAsync(string str, CancellationToken cancellationToken, params ApiParameter[] parameters) => De
 111
 112    /// <inheritdoc/>
 0113    public Task DeleteDataAsync(Uri uri, CancellationToken cancellationToken = default) => SendRequestAsync(HttpMethod.D
 114
 115    /// <inheritdoc/>
 0116    public Task<TReturn> DeleteDataAsync<TParam, TReturn>(string str, TParam value, CancellationToken cancellationToken,
 117
 118    /// <inheritdoc/>
 0119    public Task<T> DeleteDataAsync<TParam, T>(Uri uri, TParam value, CancellationToken cancellationToken = default) => S
 120
 121    /// <inheritdoc/>
 0122    public Task DeleteDataAsync<TParam>(string str, TParam value, CancellationToken cancellationToken, params ApiParamet
 123
 124    /// <inheritdoc/>
 0125    public Task DeleteDataAsync<TParam>(Uri uri, TParam value, CancellationToken cancellationToken = default) => SendReq
 126
 127    /// <inheritdoc/>
 128    public void Dispose()
 129    {
 15130        if (_disposeClient)
 131        {
 0132            _client.Dispose();
 133        }
 15134    }
 135
 136    /// <inheritdoc/>
 137    public async Task SendRequestAsync(HttpMethod method, Uri uri, HttpContent? content = null, CancellationToken cancel
 138    {
 3139        using var request = CreateRequest(method, uri, content);
 3140        using var linkedCancellationToken = CreateLinkedTimeoutTokenSource(request, cancellationToken, out var tokenSour
 141
 3142        HttpResponseMessage? response = null;
 143        try
 144        {
 3145            response = await _client.SendAsync(request, HttpCompletionOption.ResponseContentRead, linkedCancellationToke
 146
 3147            if (response.IsSuccessStatusCode)
 148            {
 3149                return;
 150            }
 151
 0152            throw await GetExceptionAsync(response, linkedCancellationToken.Token).ConfigureAwait(false);
 153        }
 0154        catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested)
 155        {
 0156            throw new TimeoutException();
 157        }
 158        finally
 159        {
 3160            response?.Dispose();
 3161            tokenSource.Dispose();
 162        }
 3163    }
 164
 165    /// <inheritdoc/>
 166    public async Task<T> SendRequestAsync<T>(HttpMethod method, Uri uri, HttpContent? content = null, CancellationToken 
 167    {
 12168        using var request = CreateRequest(method, uri, content);
 12169        using var linkedCancellationToken = CreateLinkedTimeoutTokenSource(request, cancellationToken, out var tokenSour
 170
 12171        HttpResponseMessage? response = null;
 172        try
 173        {
 12174            response = await _client.SendAsync(request, HttpCompletionOption.ResponseContentRead, linkedCancellationToke
 9175            return !response.IsSuccessStatusCode
 9176                ? throw await GetExceptionAsync(response, linkedCancellationToken.Token).ConfigureAwait(false)
 9177                : await ReadResponseAsync<T>(response, linkedCancellationToken.Token).ConfigureAwait(false);
 178        }
 3179        catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested)
 180        {
 3181            throw new TimeoutException();
 182        }
 183        finally
 184        {
 12185            response?.Dispose();
 12186            tokenSource.Dispose();
 187        }
 3188    }
 189
 190    private static HttpClient CreateHttpClient(Uri? serverUrl, Dictionary<string, string>? headers)
 191    {
 0192        var handler = new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip, CheckCertificateRevoca
 193
 0194        var client = new HttpClient(handler) { BaseAddress = serverUrl };
 195
 0196        client.DefaultRequestHeaders.Accept.Clear();
 0197        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
 0198        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/problem+json"));
 0199        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/plain"));
 0200        client.DefaultRequestHeaders.AcceptEncoding.Add(StringWithQualityHeaderValue.Parse("gzip"));
 0201        ApplyHeaders(client.DefaultRequestHeaders, headers);
 202
 0203        return client;
 204    }
 205
 206    private async Task<Stream> GetStreamAsync(Uri uri, CancellationToken cancellationToken)
 207    {
 0208        using var request = CreateRequest(HttpMethod.Get, uri);
 0209        using var linkedCancellationToken = CreateLinkedTimeoutTokenSource(request, cancellationToken, out var tokenSour
 210
 0211        HttpResponseMessage? response = null;
 212        try
 213        {
 0214            response = await _client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, linkedCancellationToke
 215
 0216            if (!response.IsSuccessStatusCode)
 0217                throw await GetExceptionAsync(response, linkedCancellationToken.Token).ConfigureAwait(false);
 0218            var stream = await response.Content.ReadAsStreamAsync(linkedCancellationToken.Token).ConfigureAwait(false);
 0219            var responseToReturn = response;
 0220            response = null;
 221
 0222            return new ResponseStream(stream, responseToReturn);
 223        }
 0224        catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested)
 225        {
 0226            throw new TimeoutException();
 227        }
 228        finally
 229        {
 0230            response?.Dispose();
 0231            tokenSource.Dispose();
 232        }
 0233    }
 234
 235    [SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:Static members should appear before non-static members", J
 236    private static void ApplyHeaders(HttpRequestHeaders headers, Dictionary<string, string>? customHeaders)
 237    {
 0238        if (customHeaders is null)
 239        {
 0240            return;
 241        }
 242
 0243        foreach (var (key, value) in customHeaders)
 244        {
 0245            if (string.Equals(key, "Authorization", StringComparison.OrdinalIgnoreCase))
 246            {
 0247                headers.Authorization = AuthenticationHeaderValue.Parse(value);
 0248                continue;
 249            }
 250
 0251            if (!headers.TryAddWithoutValidation(key, value))
 252            {
 0253                throw new InvalidOperationException($"Unable to add HTTP header '{key}'.");
 254            }
 255        }
 0256    }
 257
 258    private static HttpRequestMessage CreateRequest(HttpMethod method, Uri uri, HttpContent? content = null)
 259    {
 15260        var request = new HttpRequestMessage(method, uri) { Content = content };
 261
 15262        request.Headers.AcceptLanguage.Add(new StringWithQualityHeaderValue(CultureInfo.CurrentCulture.Name));
 15263        return request;
 264    }
 265
 266    private CancellationTokenSource CreateLinkedTimeoutTokenSource(HttpRequestMessage request, CancellationToken cancell
 267    {
 15268        tokenSource = new CancellationTokenSource();
 15269        var linked = CancellationTokenSource.CreateLinkedTokenSource(tokenSource.Token, cancellationToken);
 15270        var effectiveTimeout = request.GetTimeout() ?? _timeout;
 271
 15272        if (effectiveTimeout != Timeout.InfiniteTimeSpan)
 273        {
 3274            tokenSource.CancelAfter(effectiveTimeout);
 275        }
 276
 15277        return linked;
 278    }
 279
 280    [SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1204:Static members should appear before non-static members", J
 3281    private static StringContent CreateContent<TParam>(TParam value) => new(JsonSerializer.Serialize(value, JsonOptions)
 282
 283    private static Uri ToWebUri(string str, ApiParameter[] parameters)
 15284        => parameters.Length == 0 && Uri.TryCreate(str, UriKind.RelativeOrAbsolute, out var uri)
 15285            ? uri
 15286            : str.ToWebUri([.. parameters.Select(x => (x.Key, x.Value))]);
 287
 288    [SuppressMessage("Reliability", "CA2007:Appeler ConfigureAwait sur la tâche attendue", Justification = "Library code
 289    private static async Task<T> ReadResponseAsync<T>(HttpResponseMessage response, CancellationToken cancellationToken)
 290    {
 3291        if (typeof(T) == typeof(string))
 292        {
 0293            return (T)(object)await response.Content
 0294                .ReadAsStringAsync(cancellationToken)
 0295                .ConfigureAwait(false);
 296        }
 297
 3298        await using var stream = await response.Content
 3299            .ReadAsStreamAsync(cancellationToken)
 3300            .ConfigureAwait(false);
 301
 3302        if (stream.Length == 0)
 303        {
 0304            throw new JsonException($"Response body is empty and cannot be deserialized to '{typeof(T)}'.");
 305        }
 306
 3307        var result = await JsonSerializer.DeserializeAsync<T>(stream, JsonOptions, cancellationToken).ConfigureAwait(fal
 3308        return result ?? throw new JsonException($"Unable to deserialize response body to '{typeof(T)}'.");
 3309    }
 310
 6311    private Task<Exception> GetExceptionAsync(HttpResponseMessage response, CancellationToken cancellationToken) => GetE
 312
 313    private async Task<Exception> GetExceptionAsync(HttpStatusCode statusCode, string? reasonPhrase, HttpContent content
 314    {
 6315        string? text = null;
 316        try
 317        {
 6318            text = await content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
 6319        }
 0320        catch
 321        {
 322            // ignore read failures: we still want to throw a meaningful exception.
 0323        }
 324
 6325        var problemException = ProblemDetailsParser.TryParseException(text);
 6326        if (problemException is not null)
 327        {
 3328            return problemException;
 329        }
 330
 3331        object? payload = null;
 3332        if (string.IsNullOrWhiteSpace(text))
 0333            return _toException?.Invoke(payload) ?? new WebApiException(statusCode, reasonPhrase, text, payload);
 334        try
 335        {
 3336            payload = JsonNode.Parse(text);
 0337        }
 3338        catch (JsonException)
 339        {
 3340            payload = text;
 3341        }
 342
 3343        return _toException?.Invoke(payload) ?? new WebApiException(statusCode, reasonPhrase, text, payload);
 6344    }
 345
 346    /// <summary>
 347    /// A stream wrapper that ensures the underlying HTTP response is disposed when the stream is disposed. This is nece
 348    /// </summary>
 349    /// <param name="inner">The inner stream to wrap.</param>
 350    /// <param name="response">The HTTP response message associated with the stream.</param>
 0351    private sealed class ResponseStream(Stream inner, HttpResponseMessage response) : Stream
 352    {
 353        /// <inheritdoc/>
 0354        public override bool CanRead => inner.CanRead;
 355
 356        /// <inheritdoc/>
 0357        public override bool CanSeek => inner.CanSeek;
 358
 359        /// <inheritdoc/>
 0360        public override bool CanWrite => inner.CanWrite;
 361
 362        /// <inheritdoc/>
 0363        public override long Length => inner.Length;
 364
 365        /// <inheritdoc/>
 366        public override long Position
 367        {
 0368            get => inner.Position;
 0369            set => inner.Position = value;
 370        }
 371
 372        /// <inheritdoc/>
 0373        public override void Flush() => inner.Flush();
 374
 375        /// <inheritdoc/>
 0376        public override int Read(byte[] buffer, int offset, int count) => inner.Read(buffer, offset, count);
 377
 378        /// <inheritdoc/>
 0379        public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) =
 380
 381        /// <inheritdoc/>
 0382        public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default) => 
 383
 384        /// <inheritdoc/>
 0385        public override long Seek(long offset, SeekOrigin origin) => inner.Seek(offset, origin);
 386
 387        /// <inheritdoc/>
 0388        public override void SetLength(long value) => inner.SetLength(value);
 389
 390        /// <inheritdoc/>
 0391        public override void Write(byte[] buffer, int offset, int count) => inner.Write(buffer, offset, count);
 392
 393        /// <inheritdoc/>
 0394        public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) => in
 395
 396        /// <inheritdoc/>
 0397        public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default)
 398
 399        /// <inheritdoc/>
 400        protected override void Dispose(bool disposing)
 401        {
 0402            if (disposing)
 403            {
 0404                inner.Dispose();
 0405                response.Dispose();
 406            }
 407
 0408            base.Dispose(disposing);
 0409        }
 410
 411        /// <inheritdoc/>
 412        public override async ValueTask DisposeAsync()
 413        {
 414            try
 415            {
 0416                await inner.DisposeAsync().ConfigureAwait(false);
 0417            }
 418            finally
 419            {
 0420                response.Dispose();
 421            }
 422
 0423            await base.DisposeAsync().ConfigureAwait(false);
 0424        }
 425    }
 426}
 427
 428/// <summary>
 429/// Represents a key-value pair for API parameters, such as query parameters or form data. This struct provides implicit
 430/// </summary>
 431/// <param name="Key">The key of the API parameter.</param>
 432/// <param name="Value">The value of the API parameter.</param>
 433public record struct ApiParameter(string Key, string Value)
 434{
 435    /// <summary>
 436    /// Defines an implicit conversion from an <see cref="ApiParameter"/> to a tuple of (string Key, string Value). This
 437    /// </summary>
 438    /// <param name="value">The <see cref="ApiParameter"/> instance to convert.</param>
 439    public static implicit operator (string Key, string Value)(ApiParameter value) => ToValueTuple(value);
 440
 441    /// <summary>
 442    /// Defines an implicit conversion from a tuple of (string Key, string Value) to an <see cref="ApiParameter"/>. This
 443    /// </summary>
 444    /// <param name="value">The tuple representing the API parameter.</param>
 445    /// <returns>A new <see cref="ApiParameter"/> instance with the specified Key and Value.</returns>
 446    public static implicit operator ApiParameter((string Key, string Value) value) => ToApiParameter(value);
 447
 448    /// <summary>
 449    /// Converts a tuple of (string Key, string Value) to an <see cref="ApiParameter"/>. This method is used by the impl
 450    /// </summary>
 451    /// <param name="value">The tuple representing the API parameter.</param>
 452    /// <returns>A new <see cref="ApiParameter"/> instance with the specified Key and Value.</returns>
 453    public static ApiParameter ToApiParameter((string Key, string Value) value) => new(value.Key, value.Value);
 454
 455    /// <summary>
 456    /// Converts an <see cref="ApiParameter"/> to a tuple of (string Key, string Value). This method is used by the impl
 457    /// </summary>
 458    /// <param name="value">The <see cref="ApiParameter"/> instance to convert.</param>
 459    /// <returns>A tuple containing the Key and Value of the <see cref="ApiParameter"/> instance.</returns>
 460    public static (string Key, string Value) ToValueTuple(ApiParameter value) => (value.Key, value.Value);
 461}
 462

Methods/Properties

.cctor()
.ctor(System.Uri,System.TimeSpan,System.Collections.Generic.Dictionary`2<System.String,System.String>,System.Func`2<System.Object,System.Exception>)
.ctor(System.Net.Http.HttpClient,System.TimeSpan,System.Func`2<System.Object,System.Exception>,System.Boolean)
GetStreamAsync(System.String)
GetDataAsync(System.String,System.Threading.CancellationToken,MyNet.Http.ApiParameter[])
GetDataAsync(System.Uri,System.Threading.CancellationToken)
PostDataAsync(System.String,TParam,System.Threading.CancellationToken,MyNet.Http.ApiParameter[])
PostDataAsync(System.Uri,TParam,System.Threading.CancellationToken)
PostDataAsync(System.String,TParam,System.Threading.CancellationToken,MyNet.Http.ApiParameter[])
PostDataAsync(System.Uri,TParam,System.Threading.CancellationToken)
PostDataAsync(System.String,System.Threading.CancellationToken,MyNet.Http.ApiParameter[])
PostDataAsync(System.Uri,System.Threading.CancellationToken)
PutDataAsync(System.String,TParam,System.Threading.CancellationToken,MyNet.Http.ApiParameter[])
PutDataAsync(System.Uri,TParam,System.Threading.CancellationToken)
PatchDataAsync(System.String,TParam,System.Threading.CancellationToken,MyNet.Http.ApiParameter[])
PatchDataAsync(System.Uri,TParam,System.Threading.CancellationToken)
DeleteDataAsync(System.String,System.Threading.CancellationToken,MyNet.Http.ApiParameter[])
DeleteDataAsync(System.Uri,System.Threading.CancellationToken)
DeleteDataAsync(System.String,TParam,System.Threading.CancellationToken,MyNet.Http.ApiParameter[])
DeleteDataAsync(System.Uri,TParam,System.Threading.CancellationToken)
DeleteDataAsync(System.String,TParam,System.Threading.CancellationToken,MyNet.Http.ApiParameter[])
DeleteDataAsync(System.Uri,TParam,System.Threading.CancellationToken)
Dispose()
SendRequestAsync()
SendRequestAsync()
CreateHttpClient(System.Uri,System.Collections.Generic.Dictionary`2<System.String,System.String>)
GetStreamAsync()
ApplyHeaders(System.Net.Http.Headers.HttpRequestHeaders,System.Collections.Generic.Dictionary`2<System.String,System.String>)
CreateRequest(System.Net.Http.HttpMethod,System.Uri,System.Net.Http.HttpContent)
CreateLinkedTimeoutTokenSource(System.Net.Http.HttpRequestMessage,System.Threading.CancellationToken,System.Threading.CancellationTokenSource&)
CreateContent(TParam)
ToWebUri(System.String,MyNet.Http.ApiParameter[])
ReadResponseAsync()
GetExceptionAsync(System.Net.Http.HttpResponseMessage,System.Threading.CancellationToken)
GetExceptionAsync()
.ctor(System.IO.Stream,System.Net.Http.HttpResponseMessage)
get_CanRead()
get_CanSeek()
get_CanWrite()
get_Length()
get_Position()
set_Position(System.Int64)
Flush()
Read(System.Byte[],System.Int32,System.Int32)
ReadAsync(System.Byte[],System.Int32,System.Int32,System.Threading.CancellationToken)
ReadAsync(System.Memory`1<System.Byte>,System.Threading.CancellationToken)
Seek(System.Int64,System.IO.SeekOrigin)
SetLength(System.Int64)
Write(System.Byte[],System.Int32,System.Int32)
WriteAsync(System.Byte[],System.Int32,System.Int32,System.Threading.CancellationToken)
WriteAsync(System.ReadOnlyMemory`1<System.Byte>,System.Threading.CancellationToken)
Dispose(System.Boolean)
DisposeAsync()