public Task <IReadOnlyList <Gist> > GetAll(DateTimeOffset since, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); var request = new GistRequest(since); return(ApiConnection.GetAll <Gist>(ApiUrls.Gist(), request.ToParametersDictionary(), options)); }
/// <summary> /// Edits a gist /// </summary> /// <remarks> /// http://developer.github.com/v3/gists/#delete-a-gist /// </remarks> /// <param name="id">The id of the gist</param> /// <param name="gistUpdate">The update to the gist</param> public Task <Gist> Edit(string id, GistUpdate gistUpdate) { Ensure.ArgumentNotNull(id, "id"); Ensure.ArgumentNotNull(gistUpdate, "gistUpdate"); var filesAsJsonObject = new JsonObject(); foreach (var kvp in gistUpdate.Files) { filesAsJsonObject.Add(kvp.Key, new { Content = kvp.Value.Content, Filename = kvp.Value.NewFileName }); } var gist = new { Description = gistUpdate.Description, Files = filesAsJsonObject }; return(ApiConnection.Patch <Gist>(ApiUrls.Gist(id), gist)); }
/// <summary> /// Creates a new gist /// </summary> /// <remarks> /// http://developer.github.com/v3/gists/#create-a-gist /// </remarks> /// <param name="newGist">The new gist to create</param> public Task <Gist> Create(NewGist newGist) { Ensure.ArgumentNotNull(newGist, "newGist"); //Required to create anonymous object to match signature of files hash. // Allowing the serializer to handle Dictionary<string,NewGistFile> // will fail to match. var filesAsJsonObject = new JsonObject(); foreach (var kvp in newGist.Files) { filesAsJsonObject.Add(kvp.Key, new { Content = kvp.Value }); } var gist = new { Description = newGist.Description, Public = newGist.Public, Files = filesAsJsonObject }; return(ApiConnection.Post <Gist>(ApiUrls.Gist(), gist)); }
/// <summary> /// Deletes a gist /// </summary> /// <remarks> /// http://developer.github.com/v3/gists/#delete-a-gist /// </remarks> /// <param name="id">The id of the gist</param> public Task Delete(string id) { Ensure.ArgumentNotNull(id, "id"); return(ApiConnection.Delete(ApiUrls.Gist(id))); }
/// <summary> /// Gets a gist /// </summary> /// <remarks> /// http://developer.github.com/v3/gists/#get-a-single-gist /// </remarks> /// <param name="id">The id of the gist</param> public Task <Gist> Get(string id) { return(ApiConnection.Get <Gist>(ApiUrls.Gist(id))); }
/// <summary> /// List the authenticated user’s gists or if called anonymously, /// this will return all public gists /// </summary> /// <remarks> /// http://developer.github.com/v3/gists/#list-gists /// </remarks> /// <param name="since">Only gists updated at or after this time are returned</param> public Task <IReadOnlyList <Gist> > GetAll(DateTimeOffset since) { var request = new GistRequest(since); return(ApiConnection.GetAll <Gist>(ApiUrls.Gist(), request.ToParametersDictionary())); }
/// <summary> /// List the authenticated user’s gists or if called anonymously, /// this will return all public gists /// </summary> /// <remarks> /// http://developer.github.com/v3/gists/#list-gists /// </remarks> public Task <IReadOnlyList <Gist> > GetAll() { return(ApiConnection.GetAll <Gist>(ApiUrls.Gist())); }
public Task Delete(string id) { Ensure.ArgumentNotNullOrEmptyString(id, nameof(id)); return(ApiConnection.Delete(ApiUrls.Gist(id))); }
public Task <IReadOnlyList <Gist> > GetAll(ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); return(ApiConnection.GetAll <Gist>(ApiUrls.Gist(), options)); }