Requestable wraps the logic for making http requests to the API
Initialize the http internals.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
auth | Requestable.auth | <optional> | the credentials to authenticate to Github. If auth is not provided request will be made unauthenticated | |
apiBase | string | <optional> | https://api.github.com | the base Github API URL |
AcceptHeader | string | <optional> | v3 | the accept header for the requests |
if aDate is passed to this function it will be converted to an ISO string
| Name | Type | Description |
|---|---|---|
date | * | the object to attempt to cooerce into an ISO date string |
date or whatever was passed in if it was not a dateSets the default options for API requests
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
requestOptions | Object | <optional> | {} | the current options for the request |
Make a request.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
method | string | the method for the request (GET, PUT, POST, DELETE) | ||
path | string | the path for the request | ||
data | * | <optional> | the data to send to the server. For HTTP methods that don't have a body the data will be sent as query parameters | |
cb | Requestable.callback | <optional> | the callback for the request | |
raw | boolean | <optional> | false | if the request should be sent as raw. If this is a falsy value then the request will be made as JSON |
Make a request to an endpoint the returns 204 when true and 404 when false
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
path | string | the path to request | ||
data | Object | any query parameters for the request | ||
cb | Requestable.callback | the callback that will receive | ||
method | method | <optional> | GET | HTTP Method to use |
Make a request and fetch all the available data. Github will paginate responses so for queriesthat might span multiple pages this method is preferred toRequestable#request
| Name | Type | Attributes | Description |
|---|---|---|---|
path | string | the path to request | |
options | Object | the query parameters to include | |
cb | Requestable.callback | <optional> | the function to receive the data. The returned data will always be an array. |
results | Array.<Object> | the partial results. This argument is intended for interal use only. |
Requestable#_request in the 2.0 release.Either a username and password or an oauth token for Github
| Name | Type | Attributes | Description |
|---|---|---|---|
username | string | <optional> | the Github username |
password | string | <optional> | the user's password |
token | token | <optional> | an OAuth token |
A function that receives the result of the API request.
| Name | Type | Description |
|---|---|---|
error | Requestable.Error | the error returned by the API or |
result | Object|true | the data returned by the API or |
request | Object | the rawResponse |