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.cr

Instance Method Summary

Instance Method Detail

def 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)

[View source]
def delete_gist(id : String) : Nil #

Allows you to delete a gist by it's ID


[View source]
def fork_gist(id : String) : Gist #

Allows you to fork a gist by it's ID


[View source]
def get_all_gists(owner : String) : Array(Gist) #

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


[View source]
def get_gist(id : String) : Gist #

Get a gist by it's ID


[View source]
def get_gist_revision(id : String, sha : String) : Gist #

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


[View source]
def get_my_gists : Array(Gist) #

Gets the authenticated user's gists


[View source]
def 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"))
)

[View source]
def get_starred_gists(since : Time) : Array(Gist) #

List the auth user's starred gists

TODO check if since can be null


[View source]
def gist_starred?(id : String) : Bool #

Allows you to check whether a gist is starred


[View source]
def list_gist_commits(id : String) : Array(GistCommit) #

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


[View source]
def star_gist(id : String) : Nil #

Allows you star a gist by it's ID


[View source]
def unstar_gist(id : String) : Nil #

Allows you to unstar a gist by it's ID


[View source]
def 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


[View source]