Gist

Gist

A Gist can retrieve and modify gists.

Constructor

new Gist(id, authopt, apiBaseopt)

Create a Gist.

Parameters:
Name Type Attributes Default Description
id string

the id of the gist (not required when creating a gist)

auth Requestable.auth <optional>

information required to authenticate to Github

apiBase string <optional>
https://api.github.com

the base Github API URL

Source:

Methods

create(gist, cbopt) → {Promise}

Create a new gist.

Parameters:
Name Type Attributes Description
gist Object

the data for the new gist

cb Requestable.callback <optional>

will receive the new gist upon creation

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise

createComment(comment, cbopt) → {Promise}

Comment on a gist

Parameters:
Name Type Attributes Description
comment string

the comment to add

cb Requestable.callback <optional>

the function that receives the API result

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise

delete(cbopt) → {Promise}

Delete a gist.

Parameters:
Name Type Attributes Description
cb Requestable.callback <optional>

will receive true if the request succeeds

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise

deleteComment(comment, cbopt) → {Promise}

Delete a comment on the gist.

Parameters:
Name Type Attributes Description
comment number

the id of the comment

cb Requestable.callback <optional>

will receive true if the request succeeds

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise

editComment(comment, body, cbopt) → {Promise}

Edit a comment on the gist

Parameters:
Name Type Attributes Description
comment number

the id of the comment

body string

the new comment

cb Requestable.callback <optional>

will receive the modified comment

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

fork(cbopt) → {Promise}

Fork a gist.

Parameters:
Name Type Attributes Description
cb Requestable.callback <optional>

the function that will receive the gist

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise

getComment(comment, cbopt) → {Promise}

Fetch one of the gist's comments

Parameters:
Name Type Attributes Description
comment number

the id of the comment

cb Requestable.callback <optional>

will receive the comment

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise

getRevision(revision, cbopt) → {Promise}

Fetch one of the gist's revision.

Parameters:
Name Type Attributes Description
revision string

the id of the revision

cb Requestable.callback <optional>

will receive the revision

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise

isStarred(cbopt) → {Promise}

Check if a gist is starred by the user.

Parameters:
Name Type Attributes Description
cb Requestable.callback <optional>

will receive true if the gist is starred and false if the gist is not starred

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise

listComments(cbopt) → {Promise}

List the gist's comments

Parameters:
Name Type Attributes Description
cb Requestable.callback <optional>

will receive the array of comments

Source:
See:
Returns:
  • the promise for the http request
Type
Promise

listCommits(cbopt) → {Promise}

List the gist's commits

Parameters:
Name Type Attributes Description
cb Requestable.callback <optional>

will receive the array of commits

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise

read(cbopt) → {Promise}

Fetch a gist.

Parameters:
Name Type Attributes Description
cb Requestable.callback <optional>

will receive the gist

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise

star(cbopt) → {Promise}

Star a gist.

Parameters:
Name Type Attributes Description
cb Requestable.callback <optional>

will receive true if the request is successful

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise

unstar(cbopt) → {Promise}

Unstar a gist.

Parameters:
Name Type Attributes Description
cb Requestable.callback <optional>

will receive true if the request is successful

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise

update(gist, cbopt) → {Promise}

Update a gist.

Parameters:
Name Type Attributes Description
gist Object

the new data for the gist

cb Requestable.callback <optional>

the function that receives the API result

Source:
See:
Returns:
  • the Promise for the http request
Type
Promise