Esempio n. 1
0
        public async Task <IEmailResponse> SendAsync(IEmail email)
        {
            var json = JsonConvert.SerializeObject(email, settings);

            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Add("Secret", config.FlowKey);
                var content  = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
                var response = await client.PostAsync(config.FlowEndpoint, content);

                return(await FlowResponse.GetFlowResponse(response));
            }
        }
        public static async Task <FlowResponse> GetFlowResponse(HttpResponseMessage message)
        {
            await message.Content.ReadAsStringAsync();

            var response = new FlowResponse
            {
                StatusCode = message.StatusCode,
                Body       = message.Content,
                Headers    = message.Headers
            };

            return(response);
        }