コード例 #1
0
        private async Task <string> SendRequest <T>(string url, T entity)
        {
            var apiLogger = new MyLogger <ApiGetingData <T> >(
                _receiver,
                _loggerFactory.CreateLogger <ApiGetingData <T> >()
                );
            var sendRequest = new ApiGetingData <T>(apiLogger);

            return(await sendRequest.SendDataAsync(
                       entity,
                       url,
                       _telegramConfig.WithProxy?
                       _telegramConfig.Proxies.FirstOrDefault() :
                           null
                       ));
        }
コード例 #2
0
        private async Task <T> GetRequest <T>(string url)
        {
            var apiLogger = new MyLogger <ApiGetingData <T> >(
                _receiver,
                _loggerFactory.CreateLogger <ApiGetingData <T> >()
                );
            var getRequest = new ApiGetingData <T>(apiLogger);

            var response = await getRequest.GetDataAsync(
                url,
                _telegramConfig.WithProxy?
                _telegramConfig.Proxies.FirstOrDefault() :
                    null
                );

            return(response);
        }