/// <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; }
/// <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)); }
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)); }
/// <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; }