예제 #1
0
        internal static HttpClient Setup(this HttpClient extendee, ILarsSearchSettings settings)
        {
            extendee.DefaultRequestHeaders.Add("api-key", settings.ApiKey);
            extendee.DefaultRequestHeaders.Add("api-version", settings.ApiVersion);
            extendee.DefaultRequestHeaders.Add("indexes", settings.Indexes);

            return(extendee);
        }
예제 #2
0
        public LarsSearchController(
            ILogger <LarsSearchController> logger,
            IOptions <LarsSearchSettings> larsSearchSettings,
            ILarsSearchService larsSearchService,
            ILarsSearchHelper larsSearchHelper,
            IPaginationHelper paginationHelper)
        {
            Throw.IfNull(logger, nameof(logger));
            Throw.IfNull(larsSearchSettings, nameof(larsSearchSettings));
            Throw.IfNull(larsSearchService, nameof(larsSearchService));
            Throw.IfNull(larsSearchHelper, nameof(larsSearchHelper));
            Throw.IfNull(paginationHelper, nameof(paginationHelper));

            _logger             = logger;
            _larsSearchSettings = larsSearchSettings.Value;
            _larsSearchService  = larsSearchService;
            _larsSearchHelper   = larsSearchHelper;
            _paginationHelper   = paginationHelper;
        }
예제 #3
0
 internal static Uri ToUri(this ILarsSearchSettings extendee)
 {
     return(new Uri($"{extendee.ApiUrl}?api-version={extendee.ApiVersion}"));
 }