Ejemplo n.º 1
0
        public TrioClient(ILogger log, TrioCrawlJobData trioCrawlJobData, IRestClient client) // TODO: pass on any extra dependencies
        {
            if (trioCrawlJobData == null)
            {
                throw new ArgumentNullException(nameof(trioCrawlJobData));
            }

            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 trioCrawlJobData to instantiate the connection
            client.BaseUrl = new Uri(BaseUri);
            client.AddDefaultParameter("api_key", trioCrawlJobData.ApiKey, ParameterType.QueryString);
        }
Ejemplo n.º 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 trioCrawlJobData = new TrioCrawlJobData();

            if (configuration.ContainsKey(TrioConstants.KeyName.ApiKey))
            {
                trioCrawlJobData.ApiKey = configuration[TrioConstants.KeyName.ApiKey].ToString();
            }

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