コード例 #1
0
 /// <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;
 }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
        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);
        }