Initializes the ESPRMUser instance and stores tokens in local storage.
Object containing the access token, id token, and refresh token.
Event callbacks for user-specific events.
Static
userUser ID of the current user.
Adds a new daylight-based automation trigger for particular nodes.
The details of the daylight-based automation trigger and action to add.
A promise that resolves to an ESPAutomation instance containing details of the newly created automation.
Adds tags to the current user.
This method sends a request to associate the provided tags with the currently logged-in user.
An array of strings representing the tags to be added.
A promise that resolves to an ESPAPIResponse
containing the result of the operation.
Adds a weather-based automation trigger for specific nodes.
The details of the automation to be added.
A promise that resolves to an ESPAutomation instance containing details of the newly created automation.
Changes the user's password by providing their old password and a new password.
The user's current password.
The new password to set for the user.
A promise that resolves to an ESPAPIResponse
indicating the success of the password change.
Cleans up resources associated with the user.
This method retrieves the device token map from storage, deletes the endpoint associated with the user's device token, and clears all tokens from storage.
A promise that resolves when the resources are cleaned up.
Enables or disables multi-factor authentication (MFA) for the current user.
A boolean indicating whether MFA should be enabled (true
) or not (false
).
A promise that resolves to an ESPAPIResponse
object containing the result of the operation.
Confirms the account deletion request by providing a verification code.
The verification code sent to the user for account deletion confirmation.
A promise that resolves to an ESPAPIResponse
indicating the success of the account deletion confirmation.
Confirms the phone number associated with the user by providing a verification code.
The verification code sent to the user for confirming the phone number.
A promise that resolves to an ESPAPIResponse
indicating the success of the phone number confirmation.
Confirms the assignment of tags to the user by providing a verification code.
The verification code for confirming the tag assignment.
A promise that resolves to an ESPAPIResponse
indicating the success of the tag assignment confirmation.
Creates an ESP device with the given parameters.
The name of the device.
The transport type to use.
Optional
security: ESPSecurityThe security type to use (optional).
Optional
proofOfPossession: stringThe proof of possession string (optional).
Optional
softAPPassword: stringThe SoftAP password (optional).
Optional
username: stringThe username (optional).
A promise that resolves to an ESPDevice instance.
Creates a new group with the specified parameters.
The details of the group to be created, including name, node IDs, description, and other optional fields.
A promise that resolves to an instance of the newly created ESPRMGroup
.
Creates a platform endpoint for push notifications.
The parameters required to create the platform endpoint.
A promise resolving to the platform endpoint.
Deletes the custom data value associated with the specified key for the current user. This method sends a request to delete the custom data value for the given key associated with the currently logged-in user.
The key for which the custom data value is to be deleted.
A promise that resolves to a success response upon deleting the custom data.
Deletes the custom data entry associated with the specified key for the current user. This method sends a request to delete the custom data entry for the specified key associated with the currently logged-in user.
The key of the custom data entry to be deleted.
A promise that resolves to an ESPAPIResponse indicating the success or failure of the operation.
Deletes the custom data pemissions associated with the specified key for the current user. This method sends a request to delete the custom data permissions for the given key associated with the currently logged-in user.
The key for which the custom data permissions is to be deleted.
A promise that resolves to a success response upon deleting the custom data permissions.
Deletes a platform endpoint associated with the specified device token or endpoint.
Optional
deviceToken: stringThe mobile device token used for identifying the platform endpoint.
Optional
endpoint: stringThe unique endpoint identifier to delete.
A promise resolving to the API response, indicating success or failure.
Retrieves an automation based on the provided automation ID.
The ID of the automation to be fetched.
A promise that resolves to an ESPAutomation instance containing the automation details.
Retrieves a list of all automations with optional pagination.
A promise that resolves to a paginated response containing automation data.
Fetches custom data associated with the current user. This method sends a request to fetch custom data associated with the currently logged-in user.
A promise that resolves with the custom data associated with the user.
Retrieves the user's geographical coordinates from the custom data.
A promise that resolves to an ESPGeoCoordinates object containing the latitude and longitude.
Retrieves a group by its ID.
Parameters to filter the group data by ID.
A promise that resolves to an instance of ESPRMGroup
.
Retrieves a group by its name.
Parameters to filter the group data by name.
A promise that resolves to an instance of ESPRMGroup
.
Retrieves a list of groups with optional filters and pagination.
Parameters to filter and paginate the group data.
A promise that resolves to a paginated response containing group data.
Optional
count: numberFetches node sharing requests for the user with optional pagination.
Optional
pageCount: numberThe number of results to fetch per request. If not provided, the default value is used.
A promise that resolves to a paginated response containing node sharing requests.
Fetches a list of registered platform endpoints associated with the user.
A promise that resolves to an array of ESPPlatformEndpoint
instances.
Optional
count: numberFetches node sharing invitations for the user with optional pagination.
Optional
resultCount: numberThe number of results to fetch per request. If not provided, the default value is used.
A promise that resolves to a paginated response containing node sharing invitations.
Retrieves user information, optionally including custom data.
Optional
withCustomData: booleanOptional flag indicating whether to include custom data in the response. Defaults to false
.
A promise that resolves to an ESPRMUserInfo
object containing the user information.
Fetches user nodes with optional pagination.
Optional
resultCount: numberAn optional parameter to specify the number of results to retrieve. If not provided, all available results will be fetched.
A promise that resolves to a paginated response containing the user nodes.
Retrieves user nodes based on the provided request parameters.
The parameters for the request to get user nodes.
A promise that resolves to a paginated response containing the user nodes.
Logs out the current user, with an option to log out from all sessions.
Optional
shouldLogoutFromAllSessions: booleanOptional flag indicating whether to log out from all sessions. Defaults to false
.
A promise that resolves to an ESPAPIResponse
object containing the result of the logout operation.
Removes all callbacks for a specified event or all events.
Optional
event: ESPRMEventType(Optional) The event for which to remove callbacks. If omitted, all callbacks for all events are removed.
Removes tags to the current user.
This method sends a request to remove the provided tags with the currently logged-in user.
An array of strings representing the tags to be removed.
A promise that resolves to an ESPAPIResponse
containing the result of the operation.
Sends a request to initiate the account deletion process.
A promise that resolves to an ESPAPIResponse
indicating the success of the account deletion request.
Searches for ESP devices with the given prefix.
The prefix of the device name to search for.
A promise that resolves to an array of ESPDevice instances.
Sets custom data associated with the current user. This method sends a request to set custom data for the currently logged-in user.
The custom data to be set for the user.
A promise that resolves to an ESPAPIResponse indicating the success of the operation.
Stores the user's geographical coordinates in the custom data.
An object containing the latitude and longitude to be stored.
A promise that resolves to an ESPAPIResponse indicating the success of the operation.
Sets multiple parameters for the nodes.
The payload containing the parameters to be set for multiple nodes.
A promise that resolves to the API response.
Updates the phone number associated with the current user.
The new phone number to be set for the user.
A promise that resolves to an ESPAPIResponse
object containing the result of the operation.
Set the timeZone for the user in the user's custom data.
The timeZone string to set.
A promise that resolves to an ESPAPIResponse indicating the success of the operation.
Shares the specified groups with a user.
The parameters needed for sharing groups.
A promise that resolves to the request ID from the API.
Subscribes a callback function or an array of callback functions to a specified event.
The event to subscribe to, represented by ESPRMEventType.
The callback function or an array of callback functions to execute when the event is triggered.
Transfers the specified groups to another user.
The parameters needed for transferring groups.
A promise that resolves to the request ID from the API.
Triggers an event and executes all associated callback functions with the provided argument.
The event to trigger, represented by ESPRMEventType.
The argument to pass to the callback functions.
Unsubscribes a specific callback function from a specified event.
The event to unsubscribe from, represented by ESPRMEventType.
The callback function to remove.
Updates the name associated with the current user.
The new name to be set for the user.
A promise that resolves to an ESPAPIResponse
object containing the result of the operation.
Static
clearStatic
extendStatic
get
The
ESPRMUser
class serves as the central interface for managing user-related operations within the ESP RainMaker SDK. It provides a comprehensive set of methods for:By utilizing the
ESPRMUser
class, developers can seamlessly manage user sessions, interact with backend APIs, and handle complex user-related workflows.