Exemple #1
0
        /// <summary>
        /// Initialize a new insights client with configuration and custom httpRequester
        /// </summary>
        /// <param name="config"></param>
        /// <param name="httpRequester"></param>
        public InsightsClient(InsightsConfig config, IHttpRequester httpRequester)
        {
            if (httpRequester == null)
            {
                throw new ArgumentNullException(nameof(httpRequester), "An httpRequester is required");
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config), "A config is required");
            }

            if (string.IsNullOrWhiteSpace(config.AppId))
            {
                throw new ArgumentNullException(nameof(config.AppId), "Application ID is required");
            }

            if (string.IsNullOrWhiteSpace(config.ApiKey))
            {
                throw new ArgumentNullException(nameof(config.ApiKey), "An API key is required");
            }

            _transport = new HttpTransport(config, httpRequester);
        }
Exemple #2
0
 /// <summary>
 /// Initialize a new insights client with configuration
 /// </summary>
 /// <param name="config"></param>
 public InsightsClient(InsightsConfig config) : this(config, new AlgoliaHttpRequester())
 {
 }