module GitHub::REST::Gists
Overview
This module is specifically for interacting with the Gists endpoints GitHub offers us to use. see GitHub Gists endpoints
Direct including types
Defined in:
githubcr/rest.crInstance Method Summary
-
#create_gist(payload : GistPayload) : Gist
Creates a gist on the auth user's account.
-
#delete_gist(id : String) : Nil
Allows you to delete a gist by it's ID
-
#fork_gist(id : String) : Gist
Allows you to fork a gist by it's ID
-
#get_all_gists(owner : String) : Array(Gist)
NOTE This will return the public repositories only if it wasn't obvious already...
-
#get_gist(id : String) : Gist
Get a gist by it's ID
-
#get_gist_revision(id : String, sha : String) : Gist
Get a revision of a gist by it's ID and sha
-
#get_my_gists : Array(Gist)
Gets the authenticated user's gists
-
#get_public_gists(since : Time) : Array(Gist)
List public gists sorted by most recently updated to least recently updated.
-
#get_starred_gists(since : Time) : Array(Gist)
List the auth user's starred gists TODO check if since can be null
-
#gist_starred?(id : String) : Bool
Allows you to check whether a gist is starred
-
#list_gist_commits(id : String) : Array(GistCommit)
Allows you to list the commits of a gist by it's ID
-
#star_gist(id : String) : Nil
Allows you star a gist by it's ID
-
#unstar_gist(id : String) : Nil
Allows you to unstar a gist by it's ID
-
#update_gist(id : String, payload : GistPayload) : Gist
Allows you to update or delete a gist file and rename gist files Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged.
Instance Method Detail
Creates a gist on the auth user's account.
payload = GistCreationPayload.new(
description: "This is a description",
public: true,
files: {
"test.cr" => GistCreationFilePayload.new(content: "This is some content"),
}
)
client.create_gist(payload)
NOTE This will return the public repositories only if it wasn't obvious already...
Get a revision of a gist by it's ID and sha
List public gists sorted by most recently updated to least recently updated.
NOTE With pagination, you can fetch up to 3000 gists. For example you can fetch 100 pages with 30 gists per page or 30 pages with 100 gists per page.
gists = client.get_public_gists(
Time.local(2018, 3, 8, 22, 5, 13, location: Time::Location.load("Europe/Berlin"))
)
List the auth user's starred gists
TODO check if since can be null
Allows you to list the commits of a gist by it's ID
Allows you to update or delete a gist file and rename gist files Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged.
TODO Look into the different new fields that might appear