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:
- 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 |
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
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:
- 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 |
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 |
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