Ejemplo n.º 1
0
        public WebhookActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory)
            : base(formatter)
        {
            Guard.NotNull(httpClientFactory);

            this.httpClientFactory = httpClientFactory;
        }
        public MediumActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory, IJsonSerializer serializer)
            : base(formatter)
        {
            this.httpClientFactory = httpClientFactory;

            this.serializer = serializer;
        }
Ejemplo n.º 3
0
 public CreateContentActionHandler(RuleEventFormatter formatter, IAppProvider appProvider, ICommandBus commandBus, IJsonSerializer jsonSerializer)
     : base(formatter)
 {
     this.appProvider    = appProvider;
     this.commandBus     = commandBus;
     this.jsonSerializer = jsonSerializer;
 }
Ejemplo n.º 4
0
        public FastlyActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory)
            : base(formatter)
        {
            Guard.NotNull(httpClientFactory, nameof(httpClientFactory));

            this.httpClientFactory = httpClientFactory;
        }
Ejemplo n.º 5
0
        public NotificationActionHandler(RuleEventFormatter formatter, ICommandBus commandBus, IUserResolver userResolver)
            : base(formatter)
        {
            this.commandBus = commandBus;

            this.userResolver = userResolver;
        }
Ejemplo n.º 6
0
        public CommentActionHandler(RuleEventFormatter formatter, ICommandBus commandBus)
            : base(formatter)
        {
            Guard.NotNull(commandBus, nameof(commandBus));

            this.commandBus = commandBus;
        }
Ejemplo n.º 7
0
        public TweetActionHandler(RuleEventFormatter formatter, IOptions <TwitterOptions> twitterOptions)
            : base(formatter)
        {
            Guard.NotNull(twitterOptions);

            this.twitterOptions = twitterOptions.Value;
        }
Ejemplo n.º 8
0
        public RuleEventFormatterTests()
        {
            A.CallTo(() => urlGenerator.ContentUI(appId, schemaId, contentId))
            .Returns("content-url");

            A.CallTo(() => urlGenerator.AssetContent(assetId))
            .Returns("asset-content-url");

            A.CallTo(() => user.Id)
            .Returns("user123");

            A.CallTo(() => user.Email)
            .Returns("*****@*****.**");

            A.CallTo(() => user.Claims)
            .Returns(new List <Claim> {
                new Claim(SquidexClaimTypes.DisplayName, "me")
            });

            var extensions = new IScriptExtension[]
            {
                new DateTimeScriptExtension(),
                new EventScriptExtension(urlGenerator),
                new StringScriptExtension()
            };

            var cache = new MemoryCache(Options.Create(new MemoryCacheOptions()));

            sut = new RuleEventFormatter(TestUtils.DefaultSerializer, urlGenerator, new JintScriptEngine(cache, extensions));
        }
        public NotificationActionHandler(RuleEventFormatter formatter, ICommandBus commandBus, IUserResolver userResolver)
            : base(formatter)
        {
            Guard.NotNull(commandBus, nameof(commandBus));
            Guard.NotNull(userResolver, nameof(userResolver));

            this.commandBus = commandBus;

            this.userResolver = userResolver;
        }
Ejemplo n.º 10
0
        public CreateContentActionHandler(RuleEventFormatter formatter, IAppProvider appProvider, ICommandBus commandBus, IJsonSerializer jsonSerializer)
            : base(formatter)
        {
            Guard.NotNull(appProvider, nameof(appProvider));
            Guard.NotNull(commandBus, nameof(commandBus));
            Guard.NotNull(jsonSerializer, nameof(jsonSerializer));

            this.appProvider    = appProvider;
            this.commandBus     = commandBus;
            this.jsonSerializer = jsonSerializer;
        }
Ejemplo n.º 11
0
        public RuleEventFormatterTests()
        {
            A.CallTo(() => user.Email)
            .Returns("*****@*****.**");

            A.CallTo(() => user.Claims)
            .Returns(new List <Claim> {
                new Claim(SquidexClaimTypes.DisplayName, "me")
            });

            sut = new RuleEventFormatter(TestUtils.DefaultSerializer, urlGenerator);
        }
Ejemplo n.º 12
0
        public RuleEventFormatterTests()
        {
            A.CallTo(() => user.Email)
            .Returns("*****@*****.**");

            A.CallTo(() => user.Claims)
            .Returns(new List <Claim> {
                new Claim(SquidexClaimTypes.SquidexDisplayName, "me")
            });

            sut = new RuleEventFormatter(serializer, urlGenerator, memoryCache, userResolver);
        }
Ejemplo n.º 13
0
        public SlackActionHandler(RuleEventFormatter formatter)
        {
            Guard.NotNull(formatter, nameof(formatter));

            this.formatter = formatter;

            clients = new ClientPool <string, HttpClient>(key =>
            {
                return(new HttpClient
                {
                    Timeout = TimeSpan.FromSeconds(2)
                });
            });
        }
Ejemplo n.º 14
0
        public WebhookActionHandler(RuleEventFormatter formatter)
        {
            Guard.NotNull(formatter, nameof(formatter));

            this.formatter = formatter;

            clients = new ClientPool <string, HttpClient>(key =>
            {
                var client = new HttpClient
                {
                    Timeout = TimeSpan.FromSeconds(4)
                };

                client.DefaultRequestHeaders.Add("User-Agent", "Squidex Webhook");

                return(client);
            });
        }
Ejemplo n.º 15
0
        public RuleEventFormatterTests()
        {
            A.CallTo(() => user.Id)
            .Returns("123");

            A.CallTo(() => user.Email)
            .Returns("*****@*****.**");

            A.CallTo(() => user.Claims)
            .Returns(new List <Claim> {
                new Claim(SquidexClaimTypes.DisplayName, "me")
            });

            A.CallTo(() => urlGenerator.GenerateContentUIUrl(appId, schemaId, contentId))
            .Returns("content-url");

            sut = new RuleEventFormatter(TestUtils.DefaultSerializer, urlGenerator, new JintScriptEngine());
        }
Ejemplo n.º 16
0
        public MediumActionHandler(RuleEventFormatter formatter)
        {
            Guard.NotNull(formatter, nameof(formatter));

            this.formatter = formatter;

            clients = new ClientPool <string, HttpClient>(key =>
            {
                var client = new HttpClient
                {
                    Timeout = TimeSpan.FromSeconds(4)
                };

                client.DefaultRequestHeaders.Add("Accept", "application/json");
                client.DefaultRequestHeaders.Add("Accept-Charset", "utf-8");
                client.DefaultRequestHeaders.Add("User-Agent", "Squidex Headless CMS");

                return(client);
            });
        }
Ejemplo n.º 17
0
 public SendGridActionHandler(RuleEventFormatter formatter)
     : base(formatter)
 {
 }
Ejemplo n.º 18
0
 public CommentActionHandler(RuleEventFormatter formatter, ICommandBus commandBus)
     : base(formatter)
 {
     this.commandBus = commandBus;
 }
Ejemplo n.º 19
0
 public ScriptActionHandler(RuleEventFormatter formatter, IScriptEngine scriptEngine)
     : base(formatter)
 {
     this.scriptEngine = scriptEngine;
 }
Ejemplo n.º 20
0
        public WebhookActionHandler(RuleEventFormatter formatter)
        {
            Guard.NotNull(formatter, nameof(formatter));

            this.formatter = formatter;
        }
Ejemplo n.º 21
0
 public RuleEventFormatterTests()
 {
     sut = new RuleEventFormatter(serializer);
 }
Ejemplo n.º 22
0
 public EmailActionHandler(RuleEventFormatter formatter)
     : base(formatter)
 {
 }
Ejemplo n.º 23
0
 public DiscourseActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory)
     : base(formatter)
 {
     this.httpClientFactory = httpClientFactory;
 }
Ejemplo n.º 24
0
 public KafkaActionHandler(RuleEventFormatter formatter, KafkaProducer kafkaProducer)
     : base(formatter)
 {
     this.kafkaProducer = kafkaProducer;
 }
Ejemplo n.º 25
0
 public PrerenderActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory)
     : base(formatter)
 {
     this.httpClientFactory = httpClientFactory;
 }
Ejemplo n.º 26
0
 protected MyRuleActionHandler(RuleEventFormatter formatter)
     : base(formatter)
 {
 }