Gist() public static method

Returns the Uri that returns the list of public gists.
public static Gist ( ) : Uri
return System.Uri
Beispiel #1
0
        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));
        }
Beispiel #2
0
        /// <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));
        }
Beispiel #3
0
        /// <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));
        }
Beispiel #4
0
        /// <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)));
        }
Beispiel #5
0
 /// <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)));
 }
Beispiel #6
0
        /// <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()));
        }
Beispiel #7
0
 /// <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()));
 }
Beispiel #8
0
        public Task Delete(string id)
        {
            Ensure.ArgumentNotNullOrEmptyString(id, nameof(id));

            return(ApiConnection.Delete(ApiUrls.Gist(id)));
        }
Beispiel #9
0
        public Task <IReadOnlyList <Gist> > GetAll(ApiOptions options)
        {
            Ensure.ArgumentNotNull(options, nameof(options));

            return(ApiConnection.GetAll <Gist>(ApiUrls.Gist(), options));
        }