/// <summary> /// Initializes a new instance of the <see cref="IsGdUrlShorteningService"/> class. /// </summary> /// <param name="logger"> /// The logger. /// </param> /// <param name="shortUrlCacheService"> /// The short url cache repository. /// </param> /// <param name="config"></param> public IsGdUrlShorteningService(ILogger logger, IShortUrlCacheService shortUrlCacheService, BotConfiguration config) : base(logger, shortUrlCacheService) { this.userAgent = config.UserAgent; }
/// <summary> /// Initializes a new instance of the <see cref="UrlShorteningServiceBase"/> class. /// </summary> /// <param name="logger"> /// The logger. /// </param> /// <param name="shortUrlCacheService"> /// The short url cache repository. /// </param> protected UrlShorteningServiceBase( ILogger logger, IShortUrlCacheService shortUrlCacheService) { this.logger = logger; this.shortUrlCacheService = shortUrlCacheService; }
public WikimediaUrlShorteningService( ILogger logger, IShortUrlCacheService shortUrlCacheService, IMediaWikiApiTypedFactory apiTypedFactory, BotConfiguration configuration, IUrlShorteningService secondaryShortener, WikimediaUrlShortnerConfiguration shortenerConfiguration) : base(logger, shortUrlCacheService) { this.logger = logger; this.apiTypedFactory = apiTypedFactory; this.secondaryShortener = (UrlShorteningServiceBase)secondaryShortener; this.allowedDomains = shortenerConfiguration.AllowedDomains.Select(x => new Regex(x)).ToList(); this.mediaWikiConfig = new MediaWikiConfiguration( shortenerConfiguration.MediaWikiApiEndpoint, configuration.UserAgent, shortenerConfiguration.MediaWikiApiUsername, shortenerConfiguration.MediaWikiApiPassword); }