Ejemplo n.º 1
0
        protected override async Task <(string Description, WebhookJob Data)> CreateJobAsync(Envelope <AppEvent> @event, string eventName, WebhookAction action)
        {
            var body = formatter.ToRouteData(@event, eventName).ToString(Formatting.Indented);

            var ruleDescription = $"Send event to webhook '{action.Url}'";
            var ruleJob         = new WebhookJob
            {
                RequestUrl       = await formatter.FormatStringAsync(action.Url.ToString(), @event),
                RequestSignature = $"{body}{action.SharedSecret}".Sha256Base64(),
                RequestBodyV2    = body
            };

            return(ruleDescription, ruleJob);
        }
Ejemplo n.º 2
0
        public async Task Should_replace_app_information_from_event()
        {
            var @event = new ContentCreated {
                AppId = appId
            };

            var result = await sut.FormatStringAsync("Name $APP_NAME has id $APP_ID", AsEnvelope(@event));

            Assert.Equal($"Name my-app has id {appId.Id}", result);
        }
Ejemplo n.º 3
0
 private async Task <JObject> CreatePayloadAsync(Envelope <AppEvent> @event, string text)
 {
     return(new JObject(new JProperty("text", await formatter.FormatStringAsync(text, @event))));
 }