Esempio n. 1
0
        public async Task <R> RequestAsync(ZohoHttpClient client)
        {
            HttpResponseMessage response;

            if (Method == HttpMethod.Post)
            {
                response = await client.Post(Url, this);
            }
            else if (Method == HttpMethod.Delete)
            {
                response = await client.Delete(Url, this);
            }
            else if (Method == HttpMethod.Put)
            {
                response = await client.Put(Url, this);
            }
            else
            {
                response = await client.Get(Url, this);
            }

            var content = await response.Content.ReadAsStringAsync();

            return(JsonConvert.DeserializeObject <R>(content));
        }
        private async Task <string> InternalRequestAsync(ZohoHttpClient client)
        {
            HttpResponseMessage response;

            if (Method == HttpMethod.Post)
            {
                response = await client.Post(Url, this);
            }
            else if (Method == HttpMethod.Delete)
            {
                response = await client.Delete(Url);
            }
            else if (Method == HttpMethod.Put)
            {
                response = await client.Put(Url, this);
            }
            else
            {
                response = await client.Get(Url);
            }

            return(await response.Content.ReadAsStringAsync());
        }