|
1 | 1 | using AzureDevopsTracker.Entities; |
2 | 2 | using System; |
3 | | -using System.Collections.Generic; |
| 3 | +using System.Net.Http; |
4 | 4 | using System.Text; |
| 5 | +using System.Text.Json; |
5 | 6 |
|
6 | 7 | namespace AzureDevopsTracker.Integrations |
7 | 8 | { |
8 | | - internal abstract class MessageIntegration |
| 9 | + public abstract class MessageIntegration |
9 | 10 | { |
10 | | - internal abstract void Send(ChangeLog changeLog); |
| 11 | + public abstract void Send(ChangeLog changeLog); |
| 12 | + private static readonly string MIMETYPE = "application/json"; |
11 | 13 |
|
12 | | - internal string GetTitle(ChangeLog changeLog) |
| 14 | + protected string GetTitle(ChangeLog changeLog) |
13 | 15 | { |
14 | | - System.Resources.ResourceManager mgr = new |
15 | | - System.Resources.ResourceManager("AzureDvevopsTracker.Resource", |
16 | | - System.Reflection.Assembly.GetExecutingAssembly()); |
| 16 | + return $"Nova atualização da plataforma"; |
| 17 | + } |
| 18 | + |
| 19 | + protected string GetVersion(ChangeLog changeLog) |
| 20 | + { |
| 21 | + return $"Versao: { changeLog.Number}"; |
| 22 | + } |
17 | 23 |
|
18 | | - return ""; |
| 24 | + protected string GetNugetVersion() |
| 25 | + { |
| 26 | + System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); |
| 27 | + System.Diagnostics.FileVersionInfo fileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location); |
| 28 | + return $"Powered by Typing Hard • { fileVersionInfo.FileVersion }"; |
| 29 | + } |
| 30 | + |
| 31 | + protected HttpResponseMessage Notify(object body) |
| 32 | + { |
| 33 | + var json = JsonSerializer.Serialize(body); |
| 34 | + var content = new StringContent(json, |
| 35 | + Encoding.UTF8, |
| 36 | + MIMETYPE); |
| 37 | + HttpClient client = new HttpClient(); |
| 38 | + return client.PostAsync(new Uri(MessageConfig.URL), |
| 39 | + content).Result; |
19 | 40 | } |
20 | 41 | } |
21 | 42 | } |
0 commit comments