Пример #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="webClient">Required. Used to send data to the API.</param>
        /// <param name="adapiWsUrl">Required. A url to an Agility Directory Services endpoint. Example: <example>http://192.168.0.100:9080/Agility/Directory</example>.</param>
        /// <param name="userName">Required. Username for Agility auth.</param>
        /// <param name="password">Required. Password for Agility auth.</param>
        /// <param name="validationDocument">Optional. Relative or full path to an Agility ADMSL API definition file. Used for query validation. Defaults to <example>adsml.xsd</example>.</param>
        public ApiClient(IApiWebClient webClient, string adapiWsUrl, string userName, string password, string validationDocument = "adsml.xsd")
        {
            if (webClient == null)
            {
                throw new ArgumentNullException("webClient");
            }

            _webClient  = webClient;
            _adapiWsUrl = adapiWsUrl;
            _userName   = userName;
            _password   = password;

            if (string.IsNullOrEmpty(adapiWsUrl))
            {
                throw new ArgumentNullException("adapiWsUrl");
            }

            if (string.IsNullOrEmpty(userName))
            {
                throw new ArgumentNullException("userName");
            }

            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException("password");
            }

            if (!File.Exists(validationDocument))
            {
                throw new FileNotFoundException("API definition file not found.", "adsml.xsd");
            }

            _validationDocument = validationDocument;
        }
Пример #2
0
 public ApiQuerier(string apiKey)
 {
     _webClient = new ApiWebClient();
     _options = new ApiQuerierSettings()
     {
         ApiKey = apiKey
     };
 }
 public MovieRepository(IConfiguration settings, IApiWebClient apiWebClient)
 {
     dbSettings        = settings;
     connectionString  = dbSettings.GetValue <string>("ConnectionString");
     baseUrl           = settings.GetValue <string>("OMDbApi:BaseUrl");
     accessKey         = settings.GetValue <string>("OMDbApi:AccessKey");
     this.apiWebClient = apiWebClient;
 }
Пример #4
0
        public OmdbApiClient(IApiWebClient apiWebClient, string apiKey)
        {
            _apiWebClient = apiWebClient;
            _apiKey       = apiKey;

            if (apiWebClient == null)
            {
                _apiWebClient = new ApiWebClient();
            }
        }
Пример #5
0
 public VkGoodsApi()
 {
     this.applicationId = VkParameters.APPLICATION_ID;
     this.apiVersion    = VkParameters.API_VERSION;
     this.scope         = "groups,market,photos";
     this.responseType  = "token";
     this.redirectUri   = "https://oauth.vk.com/blank.html";
     this.groupId       = VkParameters.GROUP_ID;
     this.client        = new VkApiWebClient();
 }
Пример #6
0
        internal ApiClient(ApiConfig config, IApiWebClient webClient)
        {
            _sessionUrl = $"http://127.0.0.1:{config.Port}/session";

            _webClient = webClient;

            //TODO: consider switching one or both of these threads to timer base to control timing.  need to eval load

            sessionThread = new Thread(ReadSession);
            sessionThread.IsBackground = true;

            parseThread = new Thread(ParseSession);
            parseThread.IsBackground = true;
        }
Пример #7
0
 public ApiQuerier(IApiWebClient webClient, IOptions<ApiQuerierSettings> options)
 {
     _webClient = webClient;
     _options = options.Value;
 }
Пример #8
0
 public ApiQuerier(IOptions<ApiQuerierSettings> options)
 {
     _webClient = new ApiWebClient();
     _options = options.Value;
 }
Пример #9
0
 public OmdbApiClient(IApiWebClient apiWebClient) : this(apiWebClient, null)
 {
 }