public static async Task <string> Post(this string url, byte[] data, IDictionary <string, string> headers = null) { var config = HttpConfigHelper.GetJsonConfig(url, null, data, "POST", headers, "application/octet-stream"); var result = await HttpHelper.Transfer(config); return(result.Result); }
public static async Task <string> GetRaw(this string url, IDictionary <string, string> headers = null) { var config = HttpConfigHelper.GetJsonConfig(url, null, null, "GET", headers); var result = await HttpHelper.Transfer(config); return(result.Result); }
public static async Task <TEntityType> GetAndParse <TEntityType>(this string url, IDictionary <string, string> headers = null) where TEntityType : class { var config = HttpConfigHelper.GetJsonConfig(url, null, null, "GET", headers); var result = await HttpHelper.Transfer(config); if (!result.IsSuccessCode || result.Result == null) { return(null); } var des = _deserialise <TEntityType>(result.Result); return(des); }
public static async Task <TEntityResult> PostAndParse <TEntityResult, TEntitySend>(this string url, TEntitySend postObject, string method = "POST", IDictionary <string, string> headers = null) where TEntityResult : class where TEntitySend : class { var objSer = postObject.Serialise(); var config = HttpConfigHelper.GetJsonConfig(url, objSer); var result = await HttpHelper.Transfer(config); if (!result.IsSuccessCode) { return(null); } var des = _deserialise <TEntityResult>(result.Result); return(des); }