1: using Newtonsoft.Json.Linq;
2: using System;
3: using System.Collections.Generic;
4: using System.Runtime.Serialization;
5: using System.Threading.Tasks;
6: using System.Web.Http;
7:
8: namespace Ia.Cl.Model.Api.Controller
9: {
10: ////////////////////////////////////////////////////////////////////////////
11:
12: /// <summary publish="true">
13: /// Webhook API Controller class.
14: /// </summary>
15: ///
16: /// <remarks>
17: /// Copyright © 2019-2020 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
18: ///
19: /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
20: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
21: ///
22: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
23: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
24: ///
25: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
26: ///
27: /// Copyright notice: This notice may not be removed or altered from any source distribution.
28: /// </remarks>
29: public class WebhookController : ApiController
30: {
31: ////////////////////////////////////////////////////////////////////////////
32:
33: /// <summary>
34: ///
35: /// </summary>
36: public WebhookController() { }
37:
38: ////////////////////////////////////////////////////////////////////////////
39:
40: /// <summary>
41: ///
42: /// </summary>
43: [DataContract(IsReference = true, Namespace = "kw.com.ia.api.webhook", Name = "WebhookResponse")]
44: public class WebhookResponse
45: {
46: /// <summary/>
47: [DataMember(Name = "result")]
48: public string Result { get; set; }
49:
50: /// <summary/>
51: [DataMember(Name = "requestId")]
52: public string RequestId { get; set; }
53:
54: /// <summary/>
55: [DataMember(Name = "dateTime")]
56: public DateTime DateTime { get; set; }
57: }
58:
59: ////////////////////////////////////////////////////////////////////////////
60:
61: /// <summary>
62: ///
63: /// </summary>
64: [HttpPost]
65: [Route("api/webhooks/incoming/github")]
66: public WebhookResponse InsertGithubWebhook()
67: {
68: string requestId;
69:
70: requestId = Guid.NewGuid().ToString();
71:
72: return new WebhookResponse() { Result = "Added", RequestId = requestId };
73: }
74:
75: ////////////////////////////////////////////////////////////////////////////
76: ////////////////////////////////////////////////////////////////////////////
77: }
78:
79: ////////////////////////////////////////////////////////////////////////////
80: ////////////////////////////////////////////////////////////////////////////
81: }