예제 #1
0
        /// <summary>
        /// Create a gist
        /// </summary>
        /// <param name="newGist">The new Gist.NewGistPost to create</param>
        /// <returns>The new Gist</returns>
        async public Task<Gist> New(Gist.NewGistPost newGist)
        {
            var request = CreateRequest("/gists");

            var response = await PostAsJson<Gist.NewGistPost, Gist>(request, newGist);

            return response.Result;
        }
예제 #2
0
        /// <summary>
        /// Delete a gist
        /// </summary>
        /// <param name="gist">The Gist to delete</param>
        /// <returns>Void</returns>
        async public Task Delete(Gist gist)
        {
            var request = CreateRequest("/gists/" + gist.Id);

            var response = await Delete(request);
            if (response.HttpResponse.StatusCode != HttpStatusCode.NoContent)
                throw new GitHubException(string.Format("Unexpected response code : {0} {1}",
                                                        response.HttpResponse.StatusCode,
                                                        response.HttpResponse.StatusDescription));
        }
예제 #3
0
파일: Gist.cs 프로젝트: noark9/IronGitHub
            public EditGistPost(Gist gist)
            {
                this.Id = gist.Id;

                this.Description = gist.Description;

                Files = new Dictionary<string, PatchedGistFile>();
                foreach (var file in gist.Files)
                    Files.Add(file.Key, new PatchedGistFile(file.Value));
            }
예제 #4
0
 /// <summary>
 /// Edit a gist
 /// </summary>
 /// <param name="patch">The EditGistPost comprising the edits to be made</param>
 /// <returns>The edited Gist</returns>
 async public Task<Gist> Edit(Gist.EditGistPost patch)
 {
     var request = CreateRequest("/gists/" + patch.Id);
     var response = await Patch<Gist.EditGistPost, Gist>(request, patch);
     return response.Result;
 }