예제 #1
0
        public GetOrganizedClient(ILogger log, GetOrganizedCrawlJobData getorganizedCrawlJobData, IRestClient client) // TODO: pass on any extra dependencies
        {
            if (getorganizedCrawlJobData == null)
            {
                throw new ArgumentNullException(nameof(getorganizedCrawlJobData));
            }

            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            this.log    = log ?? throw new ArgumentNullException(nameof(log));
            this.client = client ?? throw new ArgumentNullException(nameof(client));

            // TODO use info from getorganizedCrawlJobData to instantiate the connection
            client.BaseUrl = new Uri(BaseUri);
            client.AddDefaultParameter("api_key", getorganizedCrawlJobData.ApiKey, ParameterType.QueryString);
        }
예제 #2
0
        public override async Task <CrawlJobData> GetCrawlJobData(
            ProviderUpdateContext context,
            IDictionary <string, object> configuration,
            Guid organizationId,
            Guid userId,
            Guid providerDefinitionId)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            var getorganizedCrawlJobData = new GetOrganizedCrawlJobData();

            if (configuration.ContainsKey(GetOrganizedConstants.KeyName.ApiKey))
            {
                getorganizedCrawlJobData.ApiKey = configuration[GetOrganizedConstants.KeyName.ApiKey].ToString();
            }

            return(await Task.FromResult(getorganizedCrawlJobData));
        }