Exemple #1
0
        public static HttpContent ToJsonContent <T>(this T @object)
        {
            var jsonString = ClientSerializer.Serialize(@object);

            return(new StringContent(jsonString, System.Text.Encoding.UTF8, "application/json"));
        }
Exemple #2
0
        public static List <T> GetCollection <T>(this HttpResponseMessage responseMessage)
        {
            var response = responseMessage.Content.ReadAsStringAsync().Result;

            return(ClientSerializer.Deserialize <List <T> >(response));
        }
Exemple #3
0
        public static async Task <IReadOnlyCollection <T> > GetCollectionAsync <T>(this HttpResponseMessage responseMessage)
        {
            var response = await responseMessage.Content.ReadAsStringAsync();

            return(ClientSerializer.Deserialize <IReadOnlyCollection <T> >(response));
        }
Exemple #4
0
        public static T GetObject <T>(this HttpResponseMessage responseMessage)
        {
            var response = responseMessage.Content.ReadAsStringAsync().Result;

            return(ClientSerializer.Deserialize <T>(response));
        }
Exemple #5
0
        public static async Task <T> GetObjectAsync <T>(this HttpResponseMessage responseMessage)
        {
            var response = await responseMessage.Content.ReadAsStringAsync();

            return(ClientSerializer.Deserialize <T>(response));
        }