예제 #1
0
        protected async Task <TResult> SendAsync <TRequest, TResult>(TRequest requestObj, HttpMethod httpMethod, string uri, CancellationToken cancellationToken)
            where TRequest : BotRequest
            where TResult : BotResponse, new()
        {
            string requestContent = ModelConverter.Serialize(requestObj);

            using (var request = new HttpRequestMessage(httpMethod, uri))
            {
                request.Content = new StringContent(requestContent, Encoding.UTF8, MediaType);

                return(await this.HandleResponse <TResult>(request, cancellationToken).ConfigureAwait(false));
            }
        }