Git Repository Public Repository

CPE_learningsite

URLs

Copy to Clipboard

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using Microsoft.AspNet.WebHooks;
using Newtonsoft.Json.Linq;
using System.Linq;
using System.Threading.Tasks;
using CPE.App.Api.Helpers;
using CPE.App.Web.Models;
using CPE.App.Web.Elucidat;
using Newtonsoft.Json;
using System.Net.Http.Formatting;
using Newtonsoft.Json.Serialization;

namespace CPE.App.Api.WebHooks

{
    public class ElucidatWebHookHandler : WebHookHandler
    {

        public ElucidatWebHookHandler()
        {
            this.Receiver = "elucidat";
        }

        public override Task ExecuteAsync(string receiver, WebHookHandlerContext context)
        {
            

            // Get JSON from WebHook
            JObject data = context.GetDataOrDefault<JObject>();
            //TODO data is either project name & project code -> update tin can settings OR release details ->parse description, add to lookup table
            
            ReleaseModel release =data.ToObject<ReleaseModel>();//deserialize data into ReleaseModel object;
            var releaseCode = release.ReleaseCode;
            var done = ReleaseDetailHelper.GetReleaseDescriptionDetails(release);
            if (!done)
            {
                //send email to cpe that a bad releae was made
            }

            // Get the action for this WebHook coming from the action query parameter in the URI
            string action = context.Actions.FirstOrDefault();

            return Task.FromResult(done);
        }
    }
}

Commits for CPE_learningsite/CPE/CPE.App/CPE.App.Api/WebHooks/ElucidatWebHookHandler.cs

Diff revisions: vs.
Revision Author Commited Message
4cd176 ... v.shishlov Fri 27 Aug, 2021 14:33:17 +0000

initial commit