Пример #1
0
        public GitHubRequest <GistModel> CreateGist(GistCreateModel gist)
        {
            //Great... The RestSharp serializer can't handle this object...
            //Dictionary<string, obj> confuses it and converts it into {"key": "ok", "value": "dokie"}
            //instead of {"ok": "dokie"}
            var obj = new Dictionary <string, object>();

            obj.Add("description", gist.Description);
            obj.Add("public", gist.Public);

            var files = new Dictionary <string, object>();

            obj.Add("files", files);

            if (gist.Files != null)
            {
                foreach (var f in gist.Files.Keys)
                {
                    var content = new Dictionary <string, object>();
                    files.Add(f, content);
                    content.Add("content", gist.Files[f].Content);
                }
            }

            return(GitHubRequest.Post <GistModel>(Client.ApiUri + "/gists", obj));
        }
Пример #2
0
 public GitHubRequest <CommentModel> Create(string body, string path = null, int?position = null)
 {
     return(GitHubRequest.Post <CommentModel>(Uri, new { body = body, path = path, position = position }));
 }
Пример #3
0
 public GitHubRequest <CommentModel> ReplyTo(string body, long replyToId)
 {
     return(GitHubRequest.Post <CommentModel>(Uri, new { body = body, in_reply_to = replyToId }));
 }
Пример #4
0
 public GitHubRequest <CommentModel> Create(string body, string commitId, string path, int position)
 {
     return(GitHubRequest.Post <CommentModel>(Uri, new { body = body, commit_id = commitId, path = path, position = position }));
 }
Пример #5
0
 public GitHubRequest <MilestoneModel> Create(string title, bool open, string description, DateTimeOffset dueDate)
 {
     return(GitHubRequest.Post <MilestoneModel>(Uri,
                                                new { Title = title, State = open ? "open" : "closed", Description = description, DueOn = dueDate }));
 }
Пример #6
0
 public GitHubRequest <IssueModel> Create(string title, string body, string assignee, int?milestone, string[] labels)
 {
     return(GitHubRequest.Post <IssueModel>(Uri, new { title = title, body = body, assignee = assignee, milestone = milestone, labels = labels }));
 }
Пример #7
0
 public GitHubRequest <IssueCommentModel> CreateComment(string body)
 {
     return(GitHubRequest.Post <IssueCommentModel>(Uri + "/comments", new { body = body }));
 }
Пример #8
0
 public GitHubRequest <GistModel> ForkGist()
 {
     return(GitHubRequest.Post <GistModel>(Uri + "/forks"));
 }
Пример #9
0
 public GitHubRequest <LabelModel> Create(string name, string color)
 {
     return(GitHubRequest.Post <LabelModel>(Uri, new { name, color }));
 }