module

GitHub::REST::Gists

This module is specifically for interacting with the Gists endpoints GitHub offers us to use. see GitHub Gists endpoints

Instance methods

create_gist(payload : GistPayload) : Gist

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)
Source
delete_gist(id : String) : Nil

Allows you to delete a gist by it's ID

Source
fork_gist(id : String) : Gist

Allows you to fork a gist by it's ID

Source
get_all_gists(owner : String) : Array(Gist)

NOTE: This will return the public repositories only if it wasn't obvious already...

Source
get_gist(id : String) : Gist

Get a gist by it's ID

Source
get_gist_revision(id : String, sha : String) : Gist

Get a revision of a gist by it's ID and sha

Source
get_my_gists

Gets the authenticated user's gists

Source
get_public_gists(since : Time) : Array(Gist)

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"))
)
Source
get_starred_gists(since : Time) : Array(Gist)

List the auth user's starred gists TODO check if since can be null

Source
gist_starred?(id : String) : Bool

Allows you to check whether a gist is starred

Source
list_gist_commits(id : String) : Array(GistCommit)

Allows you to list the commits of a gist by it's ID

Source
star_gist(id : String) : Nil

Allows you star a gist by it's ID

Source
unstar_gist(id : String) : Nil

Allows you to unstar a gist by it's ID

Source
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. TODO: Look into the different new fields that might appear

Source