Exemplo n.º 1
0
 public static void SetCookie(this HttpService http, string url, string name, string value) =>
 http.SetCookie(new Uri(url), name, value);
Exemplo n.º 2
0
 public static void RemoveCookie(this HttpService http, string url, string name) =>
 http.RemoveCookie(new Uri(url), name);
Exemplo n.º 3
0
 public static IHttpResponse PostObject <T>(
     this HttpService http, Uri uri, T obj,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 Task.Run(() => http.PostObjectAsync(uri, obj, Kit.CancellationToken,
                                     cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds)).Result;
Exemplo n.º 4
0
 public static Task <IHttpResponse> PostObjectAsync <T>(
     this HttpService http, string url, T obj, CancellationToken cancellationToken,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 http.PostObjectAsync(new Uri(url), obj, cancellationToken,
                      cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds);
Exemplo n.º 5
0
 public static IHttpResponse PostBytes(
     this HttpService http, string url, byte[] bytes,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 Task.Run(() => http.PostBytesAsync(new Uri(url), bytes, Kit.CancellationToken,
                                    cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds)).Result;
Exemplo n.º 6
0
 public static Task <IHttpResponse> PostBytesAsync(
     this HttpService http, Uri uri, byte[] bytes,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 http.PostBytesAsync(uri, bytes, Kit.CancellationToken,
                     cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds);
Exemplo n.º 7
0
 public static IHttpResponse PostMultipart(
     this HttpService http, Uri uri, Dictionary <string, string> multipart,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 Task.Run(() => http.PostMultipartAsync(uri, multipart, Kit.CancellationToken,
                                        cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds)).Result;
Exemplo n.º 8
0
 public static T GetObject <T>(
     this HttpService http, Uri uri,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null)
     where T : class, new() =>
 Task.Run(() => http.GetObjectAsync <T>(uri, Kit.CancellationToken,
                                        cache : cache, cacheKey : cacheKey, repeat : repeat, timeoutSeconds : timeoutSeconds)).Result;
Exemplo n.º 9
0
 public static Task <IHttpResponse> PostFormAsync(
     this HttpService http, string url, IEnumerable <KeyValuePair <string, string> > form, CancellationToken cancellationToken,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 http.PostFormAsync(new Uri(url), form, cancellationToken,
                    cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds);
Exemplo n.º 10
0
 public static Task <string> GetTextAsync(
     this HttpService http, Uri uri,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 http.GetTextAsync(uri, Kit.CancellationToken,
                   cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds);
Exemplo n.º 11
0
 public static IHttpResponse PostForm(
     this HttpService http, Uri uri, IEnumerable <KeyValuePair <string, string> > form,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 Task.Run(() => http.PostFormAsync(uri, form, Kit.CancellationToken,
                                   cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds)).Result;
Exemplo n.º 12
0
 public static Stream GetStream(
     this HttpService http, string url,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 Task.Run(() => http.GetStreamAsync(new Uri(url), Kit.CancellationToken,
                                    cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds)).Result;
Exemplo n.º 13
0
 public static Task <T> GetObjectAsync <T>(
     this HttpService http, string url, CancellationToken cancellationToken,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null)
     where T : class, new() =>
 http.GetObjectAsync <T>(new Uri(url), cancellationToken,
                         cache : cache, cacheKey : cacheKey, repeat : repeat, timeoutSeconds : timeoutSeconds);
Exemplo n.º 14
0
 public static byte[] GetBytes(
     this HttpService http, Uri uri,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 Task.Run(() => http.GetBytesAsync(uri, Kit.CancellationToken,
                                   cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds)).Result;
Exemplo n.º 15
0
 public static Task <IHttpResponse> PostMultipartAsync(
     this HttpService http, string url, Dictionary <string, string> multipart, CancellationToken cancellationToken,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 http.PostMultipartAsync(new Uri(url), multipart, cancellationToken,
                         cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds);
Exemplo n.º 16
0
 public static Task <byte[]> GetBytesAsync(
     this HttpService http, string url, CancellationToken cancellationToken,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 http.GetBytesAsync(new Uri(url), cancellationToken,
                    cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds);
Exemplo n.º 17
0
 public static Task <dynamic> GetObjectAsync(
     this HttpService http, Uri uri, CancellationToken cancellationToken,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 http.GetObjectAsync <object>(uri, cancellationToken,
                              cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds);