コード例 #1
0
ファイル: Flow.cs プロジェクト: Marcraffy/Abp.AppFactory.Flow
        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));
            }
        }
コード例 #2
0
        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);
        }