Пример #1
0
        public NotifoService(IOptions <NotifoOptions> options,
                             IUrlGenerator urlGenerator,
                             IUserResolver userResolver,
                             ILogger <NotifoService> log,
                             IClock clock)
        {
            this.options = options.Value;

            this.urlGenerator = urlGenerator;
            this.userResolver = userResolver;
            this.clock        = clock;

            this.log = log;

            if (options.Value.IsConfigured())
            {
                var builder =
                    NotifoClientBuilder.Create()
                    .SetApiKey(options.Value.ApiKey);

                if (!string.IsNullOrWhiteSpace(options.Value.ApiUrl))
                {
                    builder = builder.SetApiUrl(options.Value.ApiUrl);
                }

                if (options.Value.Debug)
                {
                    builder = builder.ReadResponseAsString(true);
                }

                client = builder.Build();
            }
        }
Пример #2
0
        public NotifoService(IOptions <NotifoOptions> options, IUrlGenerator urlGenerator, IUserResolver userResolver, IClock clock)
        {
            Guard.NotNull(options, nameof(options));
            Guard.NotNull(urlGenerator, nameof(urlGenerator));
            Guard.NotNull(userResolver, nameof(userResolver));
            Guard.NotNull(clock, nameof(clock));

            this.options = options.Value;

            this.urlGenerator = urlGenerator;
            this.userResolver = userResolver;

            this.clock = clock;

            if (options.Value.IsConfigured())
            {
                var builder =
                    NotifoClientBuilder.Create()
                    .SetApiKey(options.Value.ApiKey);

                if (!string.IsNullOrWhiteSpace(options.Value.ApiUrl))
                {
                    builder = builder.SetApiUrl(options.Value.ApiUrl);
                }

                client = builder.Build();
            }
        }
Пример #3
0
        public NotifoService(IOptions <NotifoOptions> options, IUrlGenerator urlGenerator, IUserResolver userResolver, IClock clock)
        {
            Guard.NotNull(options, nameof(options));
            Guard.NotNull(urlGenerator, nameof(urlGenerator));
            Guard.NotNull(userResolver, nameof(userResolver));
            Guard.NotNull(clock, nameof(clock));

            this.options = options.Value;

            this.urlGenerator = urlGenerator;
            this.userResolver = userResolver;

            this.clock = clock;
        }