コード例 #1
0
        public DMSClient(ILogger log, DMSCrawlJobData dmsCrawlJobData, IRestClient client) // TODO: pass on any extra dependencies
        {
            if (dmsCrawlJobData == null)
            {
                throw new ArgumentNullException(nameof(dmsCrawlJobData));
            }

            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 dmsCrawlJobData to instantiate the connection
            client.BaseUrl = new Uri(BaseUri);
            client.AddDefaultParameter("api_key", dmsCrawlJobData.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 dmsCrawlJobData = new DMSCrawlJobData();

            if (configuration.ContainsKey(DMSConstants.KeyName.ApiKey))
            {
                dmsCrawlJobData.ApiKey = configuration[DMSConstants.KeyName.ApiKey].ToString();
            }

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