static void Main(string[] args) { string jsonFile = "F:\\Temp\\Swift\\Github.json"; string jsonContent = File.ReadAllText(jsonFile); GithubIssueEvent issueEvent = JsonConvert.DeserializeObject <GithubIssueEvent>(jsonContent, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Populate }); ModelBuilder builder = new ModelBuilder(issueEvent); SwiftModel model = new SwiftModel(); model.Sender = "Github"; model.SenderImage = "https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png"; model.Summary = builder.BuildSubject(); model.ThemeColor = "FFFFFF"; model.Sections = builder.BuildSections(); model.PotentialActions = builder.BuildActions(); string payload = JsonConvert.SerializeObject(model); Console.WriteLine("Posting..."); var body = PostRequest(payload).Result; }
public static string ConvertGithubJsonToConnectorCard(string gitJsonContent) { GithubIssueEvent issueEvent = JsonConvert.DeserializeObject <GithubIssueEvent>(gitJsonContent, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Populate }); ModelBuilder builder = new ModelBuilder(issueEvent); SwiftModel model = new SwiftModel(); model.Title = issueEvent.Issue.Title; model.Text = issueEvent.Issue.Body; model.Summary = builder.BuildSubject(); model.ThemeColor = "FFFFFF"; model.Sections = builder.BuildSections(); model.PotentialActions = builder.BuildActions(); return(JsonConvert.SerializeObject(model)); }
public static string ConvertGithubJsonToConnectorCard(string gitJsonContent) { GithubIssueEvent issueEvent = JsonConvert.DeserializeObject <GithubIssueEvent>(gitJsonContent, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Populate }); ModelBuilder builder = new ModelBuilder(issueEvent); SwiftModel model = new SwiftModel(); model.Sender = "Github"; model.SenderImage = "https://assets-cdn.github.com/images/modules/logos_page/GitHub-Mark.png"; model.Summary = builder.BuildSubject(); model.ThemeColor = "FFFFFF"; model.Sections = builder.BuildSections(); model.PotentialActions = builder.BuildActions(); return(JsonConvert.SerializeObject(model)); }
public ModelBuilder(GithubIssueEvent gitEvent) { this.GithubIssueEvent = gitEvent; }