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 |
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 |
Returns:
- Type:
-
Promise
- the Promise for the http request
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 |
Returns:
- Type:
-
Promise
- the Promise for the http request
delete(cbopt) → {Promise}
Delete a gist.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cb |
Requestable.callback
|
<optional> |
will receive true if the request succeeds |
Returns:
- Type:
-
Promise
- the Promise for the http request
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 |
Returns:
- Type:
-
Promise
- the Promise for the http request
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 |
Returns:
- Type:
-
Promise
- the promise for the http request
fork(cbopt) → {Promise}
Fork a gist.
- Source:
- See:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cb |
Requestable.callback
|
<optional> |
the function that will receive the gist |
Returns:
- Type:
-
Promise
- the Promise for the http request
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 |
Returns:
- Type:
-
Promise
- the Promise for the http request
getRevision(revision, cbopt) → {Promise}
Fetch one of the gist's revision.
- Source:
- See:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
revision |
string
|
the id of the revision |
|
cb |
Requestable.callback
|
<optional> |
will receive the revision |
Returns:
- Type:
-
Promise
- the Promise for the http request
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 |
Returns:
- Type:
-
Promise
- the Promise for the http request
listComments(cbopt) → {Promise}
List the gist's comments
- Source:
- See:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cb |
Requestable.callback
|
<optional> |
will receive the array of comments |
Returns:
- Type:
-
Promise
- the promise for the http request
listCommits(cbopt) → {Promise}
List the gist's commits
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cb |
Requestable.callback
|
<optional> |
will receive the array of commits |
Returns:
- Type:
-
Promise
- the Promise for the http request
read(cbopt) → {Promise}
Fetch a gist.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cb |
Requestable.callback
|
<optional> |
will receive the gist |
Returns:
- Type:
-
Promise
- the Promise for the http request
star(cbopt) → {Promise}
Star a gist.
- Source:
- See:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cb |
Requestable.callback
|
<optional> |
will receive true if the request is successful |
Returns:
- Type:
-
Promise
- the Promise for the http request
unstar(cbopt) → {Promise}
Unstar a gist.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cb |
Requestable.callback
|
<optional> |
will receive true if the request is successful |
Returns:
- Type:
-
Promise
- the Promise for the http request
update(gist, cbopt) → {Promise}
Update a gist.
- Source:
- See:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
gist |
Object
|
the new data for the gist |
|
cb |
Requestable.callback
|
<optional> |
the function that receives the API result |
Returns:
- Type:
-
Promise
- the Promise for the http request