ThunderClient

ThunderClient

The ThunderClient class provides methods to communicate to Thunder.

Constructor

new ThunderClient(endpoint, application, secret)

Source:
Constructs a new ThunderClient.
Parameters:
Name Type Description
endpoint string The base endpoint to connect to Thunder with.
application string The name of the application key used for basic auth.
secret string The value of the application secret used for basic auth.

Methods

createUser(user, callback)

Source:
POST /users Creates a new Thunder user.
Parameters:
Name Type Description
user object The data of the user object to create.
callback function The function to call when the method completes.

deleteUser(email, password, callback)

Source:
DELETE /users Deletes a Thunder user.
Parameters:
Name Type Description
email string The email address of the user to delete.
password string The password of the user to delete.
callback function The function to call when the method completes.

getUser(email, password, callback)

Source:
GET /users Gets a Thunder user.
Parameters:
Name Type Description
email string The email address of the user to get.
password string The password of the user to get.
callback function The function to call when the method completes.

resetVerificationStatus(email, password, callback)

Source:
POST /verify/reset Resets a user's email verification status.
Parameters:
Name Type Description
email string The user's email address.
password string The user's password.
callback function The function to call when the method completes.

sendEmail(email, password, callback)

Source:
POST /verify Creates and sends a new verification email.
Parameters:
Name Type Description
email string The email address of the user to send the email to.
password string The password of the user to send the email to.
callback function The function to call when the method completes.

updateUser(email, password, user, callback)

Source:
PUT /users Updates a Thunder user.
Parameters:
Name Type Description
email string The existing email address of the user to update.
password string The password of the user to update.
user object The user object to PUT as an update.
callback function The function to call when the method completes.

verifyUser(email, token, callback, responseType)

Source:
GET /verify Verifies a user. Simulates the user clicking the URL in the email.
Parameters:
Name Type Default Description
email string The email address of the user to verify.
token string The verification token that should match the generated token.
callback function The function to call when the method completes.
responseType string json The type of response to recieve. Must be either 'html' or 'json'. Defaults to 'json'.
Returns:
Upon error or after successfully sending the GET request.