Constructor
new Starling(optionsopt)
Create an instance of the starling client
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<optional> |
configuration parameters |
- Source:
Methods
getAccessToken(authorizationCode) → {Promise}
Exchanges the authorization code for an access token
Parameters:
Name | Type | Description |
---|---|---|
authorizationCode |
string | the authorization code, acquired from the user agent after the user authenticates with starling |
- Source:
Returns:
- the http request promise
- Type
- Promise
getAccount(accessTokenopt) → {Promise}
Gets the customer's account details
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string |
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
- Source:
Returns:
- the http request promise
- Type
- Promise
getAddresses(accessTokenopt) → {Promise}
Gets the customer's addresses (current and previous)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string |
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
- Source:
Returns:
- the http request promise
- Type
- Promise
getBalance(accessTokenopt) → {Promise}
Gets the customer's balance
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string |
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
- Source:
Returns:
- the http request promise
- Type
- Promise
getCard(accessTokenopt) → {Promise}
Gets the customer's card
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string |
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
- Source:
Returns:
- the http request promise
- Type
- Promise
getContacts(accessTokenopt) → {Promise}
Gets the customer's balance
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string |
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
- Source:
Returns:
- the http request promise
- Type
- Promise
getCustomer(accessTokenopt) → {Promise}
Gets the customer's details
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
accessToken |
string |
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
- Source:
Returns:
- the http request promise
- Type
- Promise
getTransaction(transactionID, accessTokenopt) → {Promise}
Gets the full details of a single transaction
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
transactionID |
string | the unique transaction ID |
|
accessToken |
string |
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
- Source:
Returns:
- the http request promise
- Type
- Promise
getTransactions(fromDate, toDate, accessTokenopt) → {Promise}
Gets the customer's transaction history
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fromDate |
string | filter transactions after this date. Format: YYYY-MM-DD (optional, defaults to one month in past if not provided) |
|
toDate |
string | filter transactions before this date. Format: YYYY-MM-DD (optional, defaults to current date if not provided) |
|
accessToken |
string |
<optional> |
the oauth bearer token. If not specified, the accessToken on the options object is used. |
- Source:
Returns:
- the http request promise
- Type
- Promise
refreshAccessToken(refreshToken) → {Promise}
Exchanges the authorization code for an access token
Parameters:
Name | Type | Description |
---|---|---|
refreshToken |
string | the oauth refresh token, used to claim a new access token when the access token expires. A new refresh token is also returned. |
- Source:
Returns:
- the http request promise
- Type
- Promise