public async Task Should_Response_Correct_Content_From_Google()
        {
            var request = new GoogleRequest();

            var result = await _httpClient.SendAndGetResponseAsync(request);

            Assert.NotNull(result);
            Assert.True(result.Length > 0);
        }
Ejemplo n.º 2
0
        public async Task <string> GetEphemeralKeyAsync(string apiVersion)
        {
            var request = new GetEphemeralKeyRequest(_stripeConfig.Endpoint, apiVersion);

            try
            {
                var result = await _restHttpClient.SendAndGetResponseAsync(request);

                return(result);
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
            }

            return(default(string));
        }
Ejemplo n.º 3
0
        public async Task <string> UploadImageAsync(Stream image, string extension)
        {
            var getTokenRequest = new GetAzureTokenRequest(_chatConfig.ApiUrl);
            var token           = default(string);

            try
            {
                token = await _httpClient.SendAndGetResponseAsync(getTokenRequest).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
            }

            if (token == null)
            {
                return(null);
            }

            var uploadRequest = new UploadImageRequest(_chatConfig.BlobUrl, token.Replace("\"", string.Empty), image, extension);
            var uploadResult  = await _httpClient.TrySendAsync(uploadRequest, _logger).ConfigureAwait(false);

            return(uploadResult ? uploadRequest.FilePath : null);
        }