예제 #1
0
        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;
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }
예제 #4
0
 public ModelBuilder(GithubIssueEvent gitEvent)
 {
     this.GithubIssueEvent = gitEvent;
 }