Пример #1
0
 public BaseApiTest()
 {
     _factory = new HttpFactory();
     _logger  = new Mock <ILogger>().Object;
     _client  = new Mock <DefaultApiClient>(_logger, _factory);
     _client.Setup(api => api.DoExecute(Request)).Returns(new Task <string>(() => GetResponse()));
 }
        public RestClient(IHttpFactory httpFactory, IRestClientConfiguration restClientConfiguration)
        {
            Guard.ArgumentIsNotNull(httpFactory, "httpFactory");
            Guard.ArgumentIsNotNull(restClientConfiguration, "restClientConfiguration");

            _httpFactory            = httpFactory;
            RestClientConfiguration = restClientConfiguration;
        }
Пример #3
0
        /// <summary>
        /// Default constructor that registers default content handlers
        /// </summary>
        /// <param name="restSharpHttpFactory">This parameter typically provided by Dependency Injection.</param>
        public RestClient(IHttpFactory restSharpHttpFactory)
        {
            if (restSharpHttpFactory == null)
            {
                throw new ArgumentNullException(nameof(restSharpHttpFactory));
            }

            this.HttpFactory = restSharpHttpFactory;

            this.Encoding = new UTF8Encoding(false); // Encoding.UTF8 emits byte order mark, which we don't want.

            this.ContentHandlers   = new Dictionary <string, IDeserializer>();
            this.AcceptTypes       = new List <string>();
            this.DefaultParameters = new List <Parameter>();

            // There are no default handlers.

            this.FollowRedirects = true;
        }
Пример #4
0
 public EcouponsService(IHttpFactory httpFactory, IConfiguration configuration, IMapper mapper)
 {
     _httpFactory   = httpFactory;
     _configuration = configuration;
     _mapper        = mapper;
 }
Пример #5
0
 public CommentsService(IHttpFactory httpFactory, IThingMapper thingMapper)
 {
     m_thingMapper = thingMapper;
     m_httpClient  = httpFactory.Create();
 }
Пример #6
0
 public UserService(IHttpFactory httpFactory)
 {
     _httpFactory = httpFactory;
 }
Пример #7
0
 public CouponsService(IConfiguration configuration, IHttpFactory httpFactory)
 {
     _configuration = configuration;
     _httpFactory   = httpFactory;
 }
Пример #8
0
 public TaskService(IHttpFactory httpFactory)
 {
     _httpFactory = httpFactory;
 }
Пример #9
0
 public SupplierService(IHttpFactory httpFactory)
 {
     _httpFactory = httpFactory;
 }
Пример #10
0
 public SubredditService(IHttpFactory httpFactory, IThingMapper thingMapper)
 {
     m_httpClient  = httpFactory.Create();
     m_thingMapper = thingMapper;
 }
Пример #11
0
 public HttpManager(IHttpFactory httpFactory)
 {
     _httpFactory = httpFactory;
 }
 public CreditCardInfra(IHttpFactory httpFactory)
 {
     _httpFactory = httpFactory;
 }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpFactory"/> class.
 /// </summary>
 public HttpFactory()
 {
     HTTPContextManager.Start();
     _current = this;
     AddDefaultCreators();
 }
 public PaymentSlipInfra(IHttpFactory httpFactory)
 {
     _httpFactory = httpFactory;
 }
Пример #15
0
 public DefaultApiClient(ILoggerFactory loggerFactory, IHttpFactory factory)
 {
     Logger   = loggerFactory?.CreateLogger <DefaultApiClient>();
     _factory = factory;
 }
Пример #16
0
 public LocationService(IHttpFactory httpFactory)
 {
     _httpFactory = httpFactory;
 }
 /// <summary>
 /// Constructor of GoogleAuthenticator.
 /// </summary>
 /// <param name="serviceName">
 /// Name of service for which authentication is requested
 /// </param>
 /// <param name="timeout">
 /// Timeout in miliseconds. Use Timeout.Infinite for no timeout.
 /// </param>
 internal GoogleAuthenticator(IHttpFactory httpFactory,
                              AccountType accountType,
                              string applicationName) {
   this.HttpFactory = httpFactory;
   switch (accountType) {
     case AccountType.Google:
       this.AccountTypeName = "GOOGLE";
       break;
     case AccountType.Hosted:
       this.AccountTypeName = "HOSTED";
       break;
     case AccountType.GoogleOrHosted:
       this.AccountTypeName = "HOSTED_OR_GOOGLE";
       break;
   }
   this.ApplicationName = applicationName;
 }
Пример #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpFactory"/> class.
 /// </summary>
 public HttpFactory()
 {
     _current = this;
     AddDefaultCreators();
 }
Пример #19
0
 public ServiceDetailService(IHttpFactory httpFactory)
 {
     _httpFactory = httpFactory;
 }
Пример #20
0
 static WebHttp()
 {
     logger      = LoggerFactory.Create("WebHttpRequests");
     httpFactory = DependencyResolver.Resolve <IHttpFactory>();
 }
Пример #21
0
 /// <summary>
 /// RestClient
 /// </summary>
 /// <param name="restRequest"></param>
 /// <exception cref="ArgumentNullException"></exception>
 public RestClient(IRestRequest restRequest)
 {
     _restRequest = restRequest ?? throw new ArgumentNullException(nameof(restRequest));
     _httpFactory = new HttpFactory(_restRequest);
 }
Пример #22
0
 public ElasticsearchRepository(IHttpFactory httpFactory)
 {
     _httpFactory = httpFactory;
 }
Пример #23
0
 public SaleForceService(IHttpFactory httpFactory, IConfiguration configuration)
 {
     _httpFactory   = httpFactory;
     _configuration = configuration;
 }
 internal MailUploader(IHttpFactory httpFactory,
                       string emailId,
                       string password,
                       string applicationName,
                       GoogleEmailUploaderModel googleEmailUploaderModel) {
   this.HttpFactory = httpFactory;
   this.EmailId = emailId;
   this.Password = password;
   GoogleAuthenticator authenticator =
       new GoogleAuthenticator(httpFactory,
                               AccountType.GoogleOrHosted,
                               applicationName);
   AuthenticationResponse resp =
       authenticator.AuthenticateForService(this.EmailId,
                                            this.Password,
                                            "apps");
   this.MailAuthenticationToken = resp.AuthToken;
   resp = authenticator.AuthenticateForService(this.EmailId,
                                               this.Password,
                                               "cp");
   this.ContactAuthenticationToken = resp.AuthToken;
   this.GoogleEmailUploaderModel = googleEmailUploaderModel;
   string[] splits = emailId.Split('@');
   this.UserName = splits[0];
   this.DomainName = splits[1];
   this.MailBatch = new MailBatch(googleEmailUploaderModel);
   this.ContactEntry = new ContactEntry(googleEmailUploaderModel);
   this.PauseEvent = new ManualResetEvent(true);
   this.batchMailUploadUrl =
       string.Format(
           GoogleEmailUploaderConfig.EmailMigrationUrl,
           this.DomainName,
           this.UserName);
   this.batchContactUploadUrl =
       string.Format(
           MailUploader.ContactMigrationURLTemplate,
           this.EmailId);
   this.ApplicationName = applicationName;
 }
Пример #25
0
 public DefaultApiClient(ILoggerFactory loggerFactory, IHttpFactory factory, IOptions <WXOptions> options)
 {
     Logger   = loggerFactory?.CreateLogger <DefaultApiClient>();
     _factory = factory;
     _options = options.Value;
 }
Пример #26
0
 public GoogleCDNImageResizehelper(IHttpFactory httpFactory)
 {
     this.httpFactory = httpFactory;
 }
 public GoogleCDNImageResizehelper(IHttpFactory httpFactory)
 {
     this.httpFactory = httpFactory;
 }
Пример #28
0
 public VisaFormsController(DataContext context, IHttpFactory httpFactory)
 {
     _context     = context;
     _httpFactory = httpFactory;
 }
Пример #29
0
 public LinkService(IHttpFactory httpFactory, IThingMapper thingMapper)
 {
     m_thingMapper = thingMapper;
     m_client      = httpFactory.Create();
 }
 public GoogleEmailUploaderModel(IHttpFactory httpFactory) {
   try {
     GoogleEmailUploaderTrace.EnteringMethod(
         "GoogleEmailUploaderModel..ctor");
     this.HttpFactory = httpFactory;
     AssemblyName assemblyName = this.GetType().Assembly.GetName();
     this.ApplicationName =
         string.Format(GoogleEmailUploaderModel.UserAgentTemplate,
                       assemblyName.Version,
                       Resources.LocaleText);
     this.TransitionToInitializedState();
     GoogleEmailUploaderTrace.WriteLine(
         "GoogleEmailUploaderModel created: {0}",
         this.ApplicationName);
   } finally {
     GoogleEmailUploaderTrace.ExitingMethod(
         "GoogleEmailUploaderModel..ctor");
   }
 }