- Auth
- Credentials
- Space Policies
- Space Role Users
- Space Roles
- Spaces
- Oauth2
- Dashboards
- Buildings
- Floors
- Facilities
- Device States
- Widgets
- Device Spaces
- Users
- Trip
- Telemetry
- Custom Domains
- Plans
The Auth class provides authentication-related methods for user login, registration, OAuth login with Google, token refresh, switching spaces, and OAuth login with SpaceDF Console. Below are the details for each method, including parameters, return types, and example usage.
login
Authenticate a user with email and password.
Signature:
login(body: AuthLoginParams, options?: Core.RequestOptions): Core.APIPromise<TokenPair>Parameters:
body(AuthLoginParams): Object containing user credentials.email(string): User's email address.password(string): User's password.
options(Core.RequestOptions): Additional request options.
Returns: Promise<TokenPair>
Example:
const loginResponse = await client.auth.login({
email: 'user@example.com',
password: 'example_password',
});oauth2Google
Log in a user via Google OAuth2.
Signature:
oauth2Google(body: AuthOauth2GoogleParams, options?: Core.RequestOptions): Core.APIPromise<OAuthLogin>Parameters:
body(AuthOauth2GoogleParams): Object containing OAuth2 parameters.authorization_code(string): The authorization code obtained from Google.code_verifier(string): The code verifier for PKCE.
Returns: Promise<OAuthLogin>
Example:
const googleAuthResponse = await client.auth.oauth2Google({
authorization_code: 'auth_code_from_google',
code_verifier: 'verifier',
});googleLogin
Log in a user via Google using an authorization code.
Signature:
googleLogin(body: GoogleLogin, options?: Core.RequestOptions): Core.APIPromise<AuthTokenPair>Parameters:
body(GoogleLogin): Object containing the Google authorization code.authorization_code(string): The authorization code received from Google OAuth2.
Returns: Promise<AuthTokenPair>
Example:
const tokenPair = await client.auth.googleLogin({
authorization_code: '4/0Ab_5qllO5QRK6Uct5jTNNfW2fcf2v76Ub9NCH348fOvL0UBts4c7kRjSoUqjCf_wT05VqA',
});oauthSendOtp
Send a one-time password (OTP) to the user's email for OAuth login.
Signature:
oauthSendOtp(body: OAuthSendOtp, options?: Core.RequestOptions): Core.APIPromise<OAuthSendOtp>Parameters:
body(OAuthSendOtp): Object containing user email.email(string): The email address to send the OTP to.
options(Core.RequestOptions): Additional request options.
Returns: Promise<OAuthSendOtp>
Example:
await client.auth.oauthSendOtp({
email: 'user@example.com',
});forgetPassword
Send a password reset request for a user's account using their token and password.
Signature:
forgetPassword(body: ForgetPasswordParams, options?: Core.RequestOptions): Core.APIPromise<ForgetPasswordParams>Parameters:
body(ForgetPasswordParams): Object containing user credentials.token(string): The token associated with the user's account.password(string): The new password to set for the account.
options(Core.RequestOptions): Additional request options.
Returns: Promise<ForgetPasswordParams>
Example:
await client.auth.forgetPassword({
token: 'token',
password: 'newSecurePassword123',
});sendEmailConfirm
Send a confirmation email to the user's address to verify ownership.
Signature:
sendEmailConfirm(body: OAuthSendEmail, options?: Core.RequestOptions): Core.APIPromise<OAuthSendEmail>Parameters:
body(OAuthSendEmail): Object containing user email.email(string): The email address to send the confirmation link to.
options(Core.RequestOptions): Additional request options.
Returns: Promise<OAuthSendEmail>
Example:
await client.auth.sendEmailConfirm({
email: 'user@example.com',
});refreshToken
Refresh the access token using a refresh token.
Signature:
refreshToken(body: AuthRefreshTokenParams, options?: Core.RequestOptions): Core.APIPromise<CustomTokenRefresh>Parameters:
body(AuthRefreshTokenParams): Object containing the refresh token.refresh(string): Refresh token.
Returns: Promise<CustomTokenRefresh>
Example:
const refreshResponse = await client.auth.refreshToken({
refresh: 'refresh_token',
space_slug_name: 'default-1fa0d173-9c7c-4460-afa0-5a524dfcdff6',
});register
Register a new user account.
Signature:
register(body: AuthRegisterParams, options?: Core.RequestOptions): Core.APIPromise<Registration>Parameters:
body(AuthRegisterParams): Object containing user registration details.email(string): User's email address.password(string): User's chosen password.first_name(string): User's first name (optional).last_name(string): User's last name (optional).otp(string): User's OTP code (optional).
Returns: Promise<Registration>
Example:
const registerResponse = await client.auth.register({
first_name: 'Example',
last_name: 'Example',
email: 'user@example.com',
password: 'example_password',
});oauth2SpaceDF
Log in a user via SpaceDF Console OAuth2.
Signature:
oauth2SpaceDF(body: OAuthSpaceDF, options?: Core.RequestOptions): Core.APIPromise<OAuthSpaceDF>Parameters:
body(OAuthSpaceDF): Object containing OAuth2 parameters.code_verifier(string): The code verifier for PKCE.code(string): The authorization code obtained from SpaceDF Console.client_id(string): The client ID of the application.
options(Core.RequestOptions): Additional request options.
Returns: Promise<OAuthSpaceDF>
Example:
const spaceDFAuthResponse = await client.auth.oauth2SpaceDF({
code_verifier: 'verifier',
code: 'auth_code_from_spacedf',
client_id: 'your-client-id',
});switchSpaces
Switch the user's active space using a refresh token.
Signature:
switchSpaces(body: AuthRefreshTokenParams, options?: Core.RequestOptions): Core.APIPromise<CustomTokenRefresh>Parameters:
body(AuthRefreshTokenParams): Object containing the refresh token and target space.refresh(string): Refresh token.space(string): Target space to switch to.
options(Core.RequestOptions): Additional request options.
Returns: Promise<CustomTokenRefresh>
Example:
const switchResponse = await client.auth.switchSpaces({
refresh: 'refresh_token',
space: 'target_space',
});changePassword
Change the current user password.
Signature:
changePassword(body: AuthChangePasswordParams, options?: Core.RequestOptions): Core.APIPromise<AuthChangePasswordParams>Parameters:
body(AuthChangePasswordParams): Object containing the current password and new password.password(string): Current password.new_password(string): New password.
options(Core.RequestOptions): Additional request options.
Returns: Promise<AuthChangePasswordParams>
Example:
const switchResponse = await client.auth.switchSpaces({
password: 'current_password',
new_password: 'new_password',
});The SpacePolicies class provides methods for retrieving and listing space policies. Below are the details for each method, including parameters, return types, and example usage.
retrieve
Retrieve a specific space policy by its ID.
Signature:
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<SpacePolicy>Parameters:
id(string): The ID of the space policy to retrieve.options(Core.RequestOptions): Additional request options.
Returns: Promise<SpacePolicy>
Example:
const spacePolicy = await client.spacePolicies.retrieve(1);list
List all space policies or filter them based on query parameters.
Signature:
list(spaceName: string, query?: SpacePolicyListParams, options?: Core.RequestOptions): Core.APIPromise<SpacePolicyListResponse>;
list(spaceName: string, options?: Core.RequestOptions): Core.APIPromise<SpacePolicyListResponse>;
list(spaceName: string, query: SpacePolicyListParams | Core.RequestOptions = {}, options?: Core.RequestOptions): Core.APIPromise<SpacePolicyListResponse>Parameters:
spaceNamestring: The space slug name.query(SpacePolicyListParams): (optional) Filters to apply when listing policies.options(Core.RequestOptions): Additional request options.
Returns: Promise<SpacePolicyListResponse>
Example:
const spacePolicies = await client.spacePolicies.list('your-space-slug', { page: 1, limit: 10 });The SpaceRoleUsers class provides methods for managing users within specific space roles. Below are the details for each method, including parameters, return types, and example usage.
retrieve
Retrieve a specific space role user by their ID.
Signature:
retrieve(id: string, params: SpaceRoleUsersParams, options?: Core.RequestOptions): Core.APIPromise<SpaceRoleUser>Parameters:
id(string): The ID of the space role user to retrieve.params(SpaceRoleUsersParams): Parameters containing the space slug.X-Space: (string): Space slug name.
options(Core.RequestOptions): Additional request options.
Returns: Promise<SpaceRoleUser>
Example:
const spaceRoleUser = await client.spaceRoleUsers.retrieve(1, { 'X-Space': 'example-space' });list
List all space role users or filter them based on query parameters.
Signature:
list(spaceName: string, params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<SpaceRoleUserListResponse>Parameters:
spaceName: (string): Header param for space slug name.params(SpaceRoleUserListParams): Parameters containing any additional filters.options(Core.RequestOptions): Additional request options.
Returns: Promise<SpaceRoleUserListResponse>
Example:
const spaceRoleUsers = await client.spaceRoleUsers.list('example-space', { page: 1, limit: 10 });
console.log(spaceRoleUsers);update
Update the details of a specific space role user.
Signature:
update(id: number, params: SpaceRoleParams, options?: Core.RequestOptions): Core.APIPromise<SpaceRoleParams>Parameters:
id(number): The ID of the space role user to update.params(SpaceRoleParams): Parameters containing updated space role details.space_role: (string): The updated space role for the user.X-Space: (string): The space slug name.
options(Core.RequestOptions): Additional request options.
Returns: Promise<SpaceRoleParams>
Example:
const updatedRole = await client.spaceRoleUsers.update(1, { space_role: 'new-role', 'X-Space': 'your-space-slug' });
console.log(updatedRole);partialUpdate
Partially update the details of a specific space role user.
Signature:
partialUpdate(id: number, params: SpaceRoleParams, options?: Core.RequestOptions): Core.APIPromise<SpaceRoleParams>Parameters:
id(number): The ID of the space role user to partially update.params(SpaceRoleParams): Parameters containing updated space role details.space_role: (string): The updated space role for the user.X-Space: (string): The space slug name.
options(Core.RequestOptions): Additional request options.
Returns: Promise<SpaceRoleParams>
Example:
const partialUpdatedRole = await client.spaceRoleUsers.partialUpdate(1, { space_role: 'another-role', 'X-Space': 'your-space-slug' });
console.log(partialUpdatedRole);setSpaceDefault
Set a specific space role user as the default for their space.
Signature:
setSpaceDefault(id: String, params: SpaceRoleUsersParams, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(string): The ID of the space role user to set as default.params(SpaceRoleUsersParams): Parameters containing the space slug.X-Space: (string): Space slug name.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.spaceRoleUsers.setSpaceDefault('3fa85f64-5717-4562-b3fc ...');
console.log('Space role user has been set as default.');delete
Delete a specific space role user by their ID.
Signature:
delete(id: number, params: SpaceRoleUsersParams, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(number): The ID of the space role user to delete.params(SpaceRoleUsersParams): Parameters containing the space slug.X-Space: (string): Space slug name.
options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.spaceRoleUsers.delete(1, { 'X-Space': 'example-space' });The Credentials class provides methods for retrieving OAuth credentials, such as the client ID.
retrieve
Retrieve the OAuth client ID.
Signature:
retrieve(options?: Core.RequestOptions): Core.APIPromise<OAuthCredentials>Parameters:
options(Core.RequestOptions): Additional request options.
Returns: Promise<OAuthCredentials>
Example:
const credentials = await client.credentials.retrieve();
console.log(credentials.client_id);The SpaceRoles class provides methods for managing roles within specific spaces. Below are the details for each method, including parameters, return types, and example usage.
create
Create a new space role.
Signature:
create(params: SpaceRoleCreateParams, options?: Core.RequestOptions): Core.APIPromise<SpaceRole>Parameters:
params(SpaceRoleCreateParams): Parameters for creating a new space role.name: (string): The name of the space role.policies: (Array): An array of policy IDs associated with the space role.X-Space: (string): Header param for space slug name.
options(Core.RequestOptions): Additional request options.
Returns: Promise<SpaceRole>
Example:
const newSpaceRole = await client.spaceRoles.create({
name: 'Admin',
policies: [1, 2],
'X-Space': 'example-space',
});retrieve
Retrieve a specific space role by its ID.
Signature:
retrieve(id: string, params: SpaceRolesParams, options?: Core.RequestOptions): Core.APIPromise<SpaceRole>Parameters:
id(string): The ID of the space role to retrieve.params(SpaceRolesParams): Parameters containing the space slug.X-Space: (string): Space slug name.
options(Core.RequestOptions): Additional request options.
Returns: Promise<SpaceRole>
Example:
const spaceRole = await client.spaceRoles.retrieve(1, { 'X-Space': 'example-space' });update
Update a specific space role by its ID.
Signature:
update(id: number, params: SpaceRoleUpdateParams, options?: Core.RequestOptions): Core.APIPromise<SpaceRole>Parameters:
id(number): The ID of the space role to update.params(SpaceRoleUpdateParams): Parameters for updating the space role.name: (string): The new name of the space role.policies: (Array): An updated array of policy IDs associated with the space role.X-Space: (string): Header param for space slug name.
options(Core.RequestOptions): Additional request options.
Returns: Promise<SpaceRole>
Example:
const updatedSpaceRole = await client.spaceRoles.update(1, {
name: 'Super Admin',
policies: [1, 3],
'X-Space': 'example-space',
});list
List all space roles or filter them based on query parameters.
Signature:
list(spaceName: string, params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<SpaceRoleListResponse>Parameters:
spaceName: (string): Header param for space slug name.params(ListParamsResponse): Parameters containing the additional filters.options(Core.RequestOptions): Additional request options.
Returns: Promise<SpaceRoleListResponse>
Example:
const spaceRoles = await client.spaceRoles.list('example-space', { page: 1, limit: 10 });delete
Delete a specific space role by its ID.
Signature:
delete(id: number, params: SpaceRoleDeleteParams, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(number): The ID of the space role to delete.params(SpaceRoleDeleteParams): Parameters containing the space slug.X-Space: (string): Space slug name.
options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.spaceRoles.delete(1, { 'X-Space': 'example-space' });The Spaces class provides methods for managing spaces within an application. Below are the details for each method, including parameters, return types, and example usage.
create
Create a new space.
Signature:
create(body: SpaceCreateParams, options?: Core.RequestOptions): Core.APIPromise<Space>Parameters:
body(SpaceCreateParams): Parameters for creating a new space.logo: (string): URL of the space logo.name: (string): The name of the space.slug_name: (string): Slug name for the space.is_active(boolean): (Optional) Whether the space is active.
options(Core.RequestOptions): Additional request options.
Returns: Promise<Space>
Example:
const newSpace = await client.spaces.create({
logo: 'https://example.com/logo.png',
name: 'My Space',
slug_name: 'my-space',
is_active: true,
});update
Update an existing space.
Signature:
update(params: SpaceUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Space>Parameters:
params(SpaceUpdateParams): Parameters for updating the space.logo: (string): URL of the new space logo.name: (string): The new name of the space.slug_name: (string): The new slug name for the space.X-Space: (string): Header param for space slug name.is_active(boolean): (Optional) Whether the space is active.
options(Core.RequestOptions): Additional request options.
Returns: Promise<Space>
Example:
const updatedSpace = await client.spaces.update({
logo: 'https://example.com/new-logo.png',
name: 'Updated Space',
slug_name: 'updated-space',
'X-Space': 'my-space',
is_active: true,
});list
List all spaces or filter them based on query parameters.
Signature:
list(params?: SpaceListParams, options?: Core.RequestOptions): Core.APIPromise<SpaceListResponse>Parameters:
params(SpaceListParams): (Optional) Parameters containing the space slug and any additional filters.X-Space: (string): Header param for space slug name (optional).
options(Core.RequestOptions): Additional request options.
Returns: Promise<SpaceListResponse>
Example:
const spaces = await client.spaces.list({ 'X-Space': 'my-space' });delete
Delete a specific space.
Signature:
delete(params: SpaceParams, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
params(SpaceParams): Parameters containing the space slug.X-Space: (string): Space slug name.
options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.spaces.delete({ 'X-Space': 'my-space' });invitation
Send an invitation to users to join a space.
Signature:
invitation(params: OAuthInvitationParams, options?: Core.RequestOptions): Core.APIPromise<OAuthInvitationParams>Parameters:
params(OAuthInvitationParams): Contains a list of receivers with emails and role IDs.receiver_list: (Receiver[]): A list of invitation targets.email(string): Email address of the user to invite.space_role_id(string): Role ID assigned to the user in the space.
X-Space: (string): The space slug name.
options(Core.RequestOptions): Additional request options.
Returns: Promise<OAuthInvitationParams>
Example:
const invitationResponse = await client.spaces.invitation({
receiver_list: [
{
email: 'user1@example.com',
space_role_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
},
{
email: 'user2@example.com',
space_role_id: '3fa85f64-5717-4562-b3fc-2c963f66afb3',
},
],
'X-Space': 'your-space-slug',
});joinSpace
Join a space using an invitation token.
Signature:
joinSpace(token: string, options?: Core.RequestOptions): Core.APIPromise<JoinSpaceResponse>Parameters:
token(string): The unique token received in the invitation link.options(Core.RequestOptions): Additional request options (e.g., headers).
Returns: Promise<JoinSpaceResponse>
Where JoinSpaceResponse is:
export interface JoinSpaceResponse {
result?: string;
error?: string;
}Example:
const joinResponse = await client.spaces.joinSpace('eyJ0b2tlbiI6ICJ4eXo0NTYiIH0...');
if (joinResponse.error) {
console.error('Failed to join space:', joinResponse.error);
} else {
console.log('Joined space successfully!', joinResponse.result);
}checkOrgByslugName
Check organization / space by slug name.
Signature:
checkOrgByslugName(slugName: string, options?: Core.RequestOptions): Core.APIPromise<CheckOrgByslugNameResponse>Parameters:
slugName(string): A slug name string identifying the space.options(Core.RequestOptions): Additional request options.
Returns: Promise<CheckOrgByslugNameResponse>
Where CheckOrgByslugNameResponse is:
export interface CheckOrgByslugNameResponse {
result?: string;
}Example:
const checkResponse = await client.spaces.checkOrgByslugName('default-8e4ee506-5937-4afb-9939-38fc8304a058');
console.log(checkResponse.result);
// Output: "Space with slug 'default-8e4ee506-5937-4afb-9939-38fc8304a058' not found."The OAuth2 class provides methods for handling OAuth2 authorization and token exchange processes within an application.
authorize
Initiates the OAuth2 authorization flow by generating a code challenge and sending the authorization request.
Signature:
async authorize(body: OAuth2AuthorizeParams, options?: Core.RequestOptions): Promise<OAuth2Authorize>Parameters:
body(OAuth2AuthorizeParams): Parameters required for authorization.client_id: (string): The client ID of the application.redirect_uri: (string): The URI to redirect to after authorization.scopes: (Array<'organization'>): Scopes for the authorization request.
options(Core.RequestOptions): (Optional) Additional request options.
Returns: Promise<OAuth2Authorize>
Example:
const authParams: OAuth2AuthorizeParams = {
client_id: 'your-client-id',
redirect_uri: 'https://yourapp.com/callback',
scopes: ['organization'],
};
const authResponse = await client.oauth2.authorize(authParams);token
Exchanges the authorization code for an access token.
Signature:
token(body: OAuth2Token, options?: Core.RequestOptions): Core.APIPromise<OAuth2Token>Parameters:
body(OAuth2Token): Parameters required to obtain an access token.client_id: (string): The client ID of the application.client_secret: (string): The client secret of the application.code: (string): The authorization code received from the authorization server.code_verifier: (string): The code verifier used in the authorization request.scopes: (Array<'organization'>): (Optional) Scopes for the token request.id_token: (string): (Optional) ID token if available.
Returns: Promise<OAuth2Token>
Example:
const tokenParams: OAuth2Token = {
client_id: 'your-client-id',
client_secret: 'your-client-secret',
code: 'authorization-code',
code_verifier: 'your-code-verifier',
};
const tokenResponse = await oauth2.token(tokenParams);The Dashboards class provides methods to manage dashboards and their associated widgets within an application.
create
Creates a new dashboard.
Signature:
create(params: DashboardCreateParams, options?: Core.RequestOptions): Core.APIPromise<Dashboard>Parameters:
params(DashboardCreateParams): Parameters required for creating a dashboard.name: (string): The name of the dashboard.X-Space: (string): The space slug name.
Returns: Promise<Dashboard>
Example:
const dashboardParams: DashboardCreateParams = {
name: 'New Dashboard',
'X-Space': 'your-space-slug',
};
const newDashboard = await client.dashboards.create(dashboardParams);retrieve
Retrieves a specific dashboard by its ID.
Signature:
retrieve(id: string, params: DashboardRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<Dashboard>Parameters:
id(string): The ID of the dashboard to retrieve.params(DashboardRetrieveParams): Parameters required for retrieving a dashboard.X-Space: (string): The space slug name.
Returns: Promise<Dashboard>
Example:
const dashboardId = 1;
const dashboardDetails = await client.dashboards.retrieve(dashboardId, { 'X-Space': 'your-space-slug' });update
Updates an existing dashboard.
Signature:
update(id: number, params: DashboardUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Dashboard>Parameters:
id(number): The ID of the dashboard to update.params(DashboardUpdateParams): Parameters required for updating a dashboard.name: (string): The new name of the dashboard.X-Space: (string): The space slug name.
Returns: Promise<Dashboard>
Example:
const updateParams: DashboardUpdateParams = {
name: 'Updated Dashboard',
'X-Space': 'your-space-slug',
};
const updatedDashboard = await client.dashboards.update(dashboardId, updateParams);list
Lists all dashboards within a specific space.
Signature:
list(params: DashboardListParams, options?: Core.RequestOptions): Core.APIPromise<DashboardListResponse>Parameters:
params(DashboardListParams): Parameters for listing dashboards.X-Space: (string): The space slug name.
Returns: Promise<DashboardListResponse>
Example:
const dashboardsList = await client.dashboards.list({ 'X-Space': 'your-space-slug' });delete
Deletes a specific dashboard by its ID.
Signature:
delete(id: number, params: DashboardDeleteParams, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(number): The ID of the dashboard to delete.params(DashboardDeleteParams): Parameters required for deleting a dashboard.X-Space: (string): The space slug name.
Returns: Promise<void>
Example:
await client.dashboards.delete(dashboardId, { 'X-Space': 'your-space-slug' });createWidget
Creates a new widget in a specified dashboard.
Signature:
createWidget(dashboardId: string, params: WidgetCreateParams, options?: Core.RequestOptions): Core.APIPromise<Widget>Parameters:
dashboardId(string): The ID of the dashboard to create the widget in.params(WidgetCreateParams): Parameters required for creating a widget.configuration: (any): Configuration settings for the widget.X-Space: (string): The space slug name.
Returns: Promise<Widget>
Example:
const widgetParams: WidgetCreateParams = {
configuration: { /_ widget configuration _/ },
'X-Space': 'your-space-slug',
};
const newWidget = await client.dashboards.createWidget(dashboardId, widgetParams);retrieveWidget
Retrieves a specific widget by its ID from a dashboard.
Signature:
retrieveWidget(dashboardId: string, id: number, params: WidgetRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<Widget>Parameters:
dashboardId(string): The ID of the dashboard containing the widget.id(number): The ID of the widget to retrieve.params(WidgetRetrieveParams): Parameters required for retrieving a widget.X-Space: (string): The space slug name.
Returns: Promise<Widget>
Example:
const widgetDetails = await client.dashboards.retrieveWidget(dashboardId, widgetId, { 'X-Space': 'your-space-slug' });updateWidget
Updates an existing widget in a specified dashboard.
Signature:
updateWidget(dashboardId: string, id: number, params: WidgetUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Widget>Parameters:
dashboardId(string): The ID of the dashboard containing the widget.id(number): The ID of the widget to update.params(WidgetUpdateParams): Parameters required for updating a widget.configuration: (any): New configuration settings for the widget.X-Space: (string): The space slug name.
Returns: Promise<Widget>
Example:
const updateWidgetParams: WidgetUpdateParams = {
configuration: { /_ new widget configuration _/ },
'X-Space': 'your-space-slug',
};
const updatedWidget = await client.dashboards.updateWidget(dashboardId, widgetId, updateWidgetParams);listWidgets
Lists all widgets within a specific dashboard.
Signature:
listWidgets(dashboardId: string, params: WidgetListParams, options?: Core.RequestOptions): Core.APIPromise<WidgetListResponse>Parameters:
dashboardId(string): The ID of the dashboard to list widgets from.params(WidgetListParams): Parameters for listing widgets.X-Space: (string): The space slug name.ordering: (string): (Optional) Field to use when ordering the results.
Returns: Promise<WidgetListResponse>
Example:
const widgetsList = await client.dashboards.listWidgets(dashboardId, { 'X-Space': 'your-space-slug' });deleteWidget
Deletes a specific widget by its ID from a dashboard.
Signature:
deleteWidget(dashboardId: string, id: number, params: WidgetDeleteParams, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
dashboardId(string): The ID of the dashboard containing the widget.id(number): The ID of the widget to delete.params(WidgetDeleteParams): Parameters required for deleting a widget.X-Space: (string): The space slug name.
Returns: Promise<void>
Example:
await client.dashboards.deleteWidget(dashboardId, widgetId, { 'X-Space': 'your-space-slug' });The Buildings class provides methods to manage buildings and to create/list floors within a building.
create
Creates a new building.
Signature:
create(params: BuildingCreateParams, options?: Core.RequestOptions): Core.APIPromise<Building>Parameters:
params(BuildingCreateParams): Parameters for creating a building.name(string): Building name.description(string): Building description.location({ latitude?: number; longitude?: number }): Building location.
options(Core.RequestOptions): Additional request options.
Returns: Promise<Building>
Example:
const newBuilding = await client.buildings.create({
name: 'HQ',
description: 'Main office',
location: { latitude: 37.7749, longitude: -122.4194 },
});retrieve
Retrieves a building by ID.
Signature:
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Building>Parameters:
id(string): Building ID.options(Core.RequestOptions): Additional request options.
Returns: Promise<Building>
Example:
const building = await client.buildings.retrieve('1');update
Updates a building by replacing fields.
Signature:
update(id: number, params: Partial<BuildingCreateParams>, options?: Core.RequestOptions): Core.APIPromise<Building>Parameters:
id(number): Building ID.params(Partial): Building fields to update.options(Core.RequestOptions): Additional request options.
Returns: Promise<Building>
Example:
const updatedBuilding = await client.buildings.update(1, {
description: 'Updated description',
});partialUpdate
Partially updates a building.
Signature:
partialUpdate(id: number, params: Partial<BuildingCreateParams>, options?: Core.RequestOptions): Core.APIPromise<Building>Parameters:
id(number): Building ID.params(Partial): Building fields to update.options(Core.RequestOptions): Additional request options.
Returns: Promise<Building>
Example:
const patchedBuilding = await client.buildings.partialUpdate(1, {
name: 'HQ - North',
});list
Lists buildings.
Signature:
list(params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<BuildingListResponse>Parameters:
params(ListParamsResponse): List/pagination parameters.limit(number): (Optional) Number of results per page.offset(number): (Optional) Starting index for results.ordering(string): (Optional) Field to order results by.search(string): (Optional) Search term.bbox(string): (Optional) Bounding box.
options(Core.RequestOptions): Additional request options.
Returns: Promise<BuildingListResponse>
Example:
const buildings = await client.buildings.list({ limit: 20, offset: 0 });delete
Deletes a building by ID.
Signature:
delete(id: number, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(number): Building ID.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.buildings.delete(1);createFloor
Creates a floor within a building.
Signature:
createFloor(buildingId: string, params: FloorCreateParams, options?: Core.RequestOptions): Core.APIPromise<Floor>Parameters:
buildingId(string): Building ID.params(FloorCreateParams): Parameters for creating a floor.name(string): Floor name.description(string): Floor description.level(number): Floor level.scene_asset(string): Scene asset reference.
options(Core.RequestOptions): Additional request options.
Returns: Promise<Floor>
Example:
const newFloor = await client.buildings.createFloor(1, {
name: 'Floor 1',
description: 'First floor',
level: 1,
scene_asset: 's3://bucket/floor-1.glb',
});listFloors
Lists floors within a building.
Signature:
listFloors(buildingId: number, params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<FloorListResponse>Parameters:
buildingId(number): Building ID.params(ListParamsResponse): List/pagination parameters.limit(number): (Optional) Number of results per page.offset(number): (Optional) Starting index for results.ordering(string): (Optional) Field to order results by.search(string): (Optional) Search term.bbox(string): (Optional) Bounding box.
options(Core.RequestOptions): Additional request options.
Returns: Promise<FloorListResponse>
Example:
const floors = await client.buildings.listFloors(1, { limit: 50 });The Floors class provides methods to manage individual floors, and to create/list rooms (areas) within a floor.
retrieve
Retrieves a floor by ID.
Signature:
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Floor>Parameters:
id(string): Floor ID.options(Core.RequestOptions): Additional request options.
Returns: Promise<Floor>
Example:
const floor = await client.floors.retrieve(10);update
Updates a floor.
Signature:
update(id: number, params: FloorUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Floor>Parameters:
id(number): Floor ID.params(FloorUpdateParams): Floor fields to update.name(string): Floor name.description(string): Floor description.level(number): Floor level.scene_asset(string): Scene asset reference.
options(Core.RequestOptions): Additional request options.
Returns: Promise<Floor>
Example:
const updated = await client.floors.update(10, {
name: 'Floor 1 (Renovated)',
description: 'Updated plan',
level: 1,
scene_asset: 's3://bucket/floor-1-v2.glb',
});partialUpdate
Partially updates a floor.
Signature:
partialUpdate(id: number, params: FloorUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Floor>Parameters:
id(number): Floor ID.params(FloorUpdateParams): Floor fields to update.options(Core.RequestOptions): Additional request options.
Returns: Promise<Floor>
Example:
const patched = await client.floors.partialUpdate(10, {
scene_asset: 's3://bucket/floor-1-hotfix.glb',
});delete
Deletes a floor by ID.
Signature:
delete(id: number, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(number): Floor ID.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.floors.delete(10);listRooms
Lists rooms (areas) within a floor.
Signature:
listRooms(floorId: number, params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<RoomListResponse>Parameters:
floorId(number): Floor ID.params(ListParamsResponse): List/pagination parameters.limit(number): (Optional) Number of results per page.offset(number): (Optional) Starting index for results.ordering(string): (Optional) Field to order results by.search(string): (Optional) Search term.bbox(string): (Optional) Bounding box.
options(Core.RequestOptions): Additional request options.
Returns: Promise<RoomListResponse>
Example:
const rooms = await client.floors.listRooms(10, { limit: 100 });createRoom
Creates a room (area) within a floor.
Signature:
createRoom(floorId: number, params: RoomCreateParams, options?: Core.RequestOptions): Core.APIPromise<Room>Parameters:
floorId(number): Floor ID.params(RoomCreateParams): Parameters for creating a room.name(string): Room name.description(string): (Optional) Room description.area_type(string): Area type.scene_asset(string): Scene asset reference.
options(Core.RequestOptions): Additional request options.
Returns: Promise<Room>
Example:
const room = await client.floors.createRoom(10, {
name: 'Conference Room A',
description: 'Large meeting room',
area_type: 'room',
scene_asset: 's3://bucket/room-a.glb',
});The Facilities class provides methods to manage facilities.
create
Creates a new facility.
Signature:
create(params: FacilityCreateParams, options?: Core.RequestOptions): Core.APIPromise<Facility>Parameters:
params(FacilityCreateParams): Parameters for creating a facility.name(string): Facility name.description(string): Facility description.location({ latitude: number; longitude: number }): Facility location.scene_asset(string): Scene asset reference.
options(Core.RequestOptions): Additional request options.
Returns: Promise<Facility>
Example:
const facility = await client.facilities.create({
name: 'Warehouse',
description: 'Primary distribution center',
location: { latitude: 37.7749, longitude: -122.4194 },
scene_asset: 's3://bucket/warehouse.glb',
});retrieve
Retrieves a facility by ID.
Signature:
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Facility>Parameters:
id(string): Facility ID.options(Core.RequestOptions): Additional request options.
Returns: Promise<Facility>
Example:
const facility = await client.facilities.retrieve(1);update
Updates a facility.
Signature:
update(id: number, params: FacilityUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Facility>Parameters:
id(number): Facility ID.params(FacilityUpdateParams): Facility fields to update.name(string): Facility name.description(string): Facility description.location({ latitude: number; longitude: number }): Facility location.scene_asset(string): Scene asset reference.
options(Core.RequestOptions): Additional request options.
Returns: Promise<Facility>
Example:
const updated = await client.facilities.update(1, {
name: 'Warehouse (East)',
description: 'Updated description',
location: { latitude: 37.7749, longitude: -122.4194 },
scene_asset: 's3://bucket/warehouse-v2.glb',
});partialUpdate
Partially updates a facility.
Signature:
partialUpdate(id: number, params: FacilityUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Facility>Parameters:
id(number): Facility ID.params(FacilityUpdateParams): Facility fields to update.options(Core.RequestOptions): Additional request options.
Returns: Promise<Facility>
Example:
const patched = await client.facilities.partialUpdate(1, {
description: 'Patched description',
location: { latitude: 37.7749, longitude: -122.4194 },
scene_asset: 's3://bucket/warehouse-hotfix.glb',
name: 'Warehouse',
});list
Lists facilities.
Signature:
list(params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<FacilityListResponse>Parameters:
params(ListParamsResponse): List/pagination parameters.limit(number): (Optional) Number of results per page.offset(number): (Optional) Starting index for results.ordering(string): (Optional) Field to order results by.search(string): (Optional) Search term.bbox(string): (Optional) Bounding box.
options(Core.RequestOptions): Additional request options.
Returns: Promise<FacilityListResponse>
Example:
const facilities = await client.facilities.list({ limit: 25 });delete
Deletes a facility by ID.
Signature:
delete(id: number, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(number): Facility ID.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.facilities.delete(1);The Device States class provides methods to retrieve various device state metrics (daily, hourly, minutely, monthly) from an API.
retrieveDaily
Retrieves daily device states.
Signature:
retrieveDaily(params: DailyRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<DailyRetrieveResponse>Parameters:
params(DailyRetrieveParams): Parameters for retrieving daily device states.X-Space: (string): Space slug name.- Other query parameters specific to daily retrieval.
Returns: Promise<DailyRetrieveResponse>
Example:
const dailyParams: DailyRetrieveParams = {
'X-Space': 'your-space-slug',
// other parameters
};
const dailyData = await client.deviceStates.retrieveDaily(dailyParams);retrieveHourly
Retrieves hourly device states.
Signature:
retrieveHourly(params: HourlyRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<HourlyRetrieveResponse>Parameters:
params(HourlyRetrieveParams): Parameters for retrieving hourly device states.X-Space: (string): Space slug name.- Other query parameters specific to hourly retrieval.
Returns: Promise<HourlyRetrieveResponse>
Example:
const hourlyParams: HourlyRetrieveParams = {
'X-Space': 'your-space-slug',
// other parameters
};
const hourlyData = await client.deviceStates.retrieveHourly(hourlyParams);retrieveMinutely
Retrieves minutely device states.
Signature:
retrieveMinutely(params: MinutelyRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<MinutelyRetrieveResponse>Parameters:
params(MinutelyRetrieveParams): Parameters for retrieving minutely device states.X-Space: (string): Space slug name.- Other query parameters specific to minutely retrieval.
Returns: Promise<MinutelyRetrieveResponse>
Example:
const minutelyParams: MinutelyRetrieveParams = {
'X-Space': 'your-space-slug',
// other parameters
};
const minutelyData = await client.deviceStates.retrieveMinutely(minutelyParams);retrieveMonthly
Retrieves monthly device states.
Signature:
retrieveMonthly(params: MonthlyRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<MonthlyRetrieveResponse>Parameters:
params(MonthlyRetrieveParams): Parameters for retrieving monthly device states.X-Space: (string): Space slug name.- Other query parameters specific to monthly retrieval.
Returns: Promise<MonthlyRetrieveResponse>
Example:
const monthlyParams: MonthlyRetrieveParams = {
'X-Space': 'your-space-slug',
// other parameters
};
const monthlyData = await client.deviceStates.retrieveMonthly(monthlyParams);The Users class provides methods for managing the authenticated user's profile, including retrieving, updating, and deleting their information.
getMe
Retrieve the profile of the authenticated user.
Signature:
getMe(options?: Core.RequestOptions): Core.APIPromise<Profile>Parameters:
options(Core.RequestOptions): Additional request options.
Returns: Promise<Profile>
Example:
const userProfile = await client.users.getMe();
console.log(userProfile.first_name);updateMe
Update the profile of the authenticated user.
Signature:
updateMe(body: Profile, options?: Core.RequestOptions): Core.APIPromise<Profile>Parameters:
body(Profile): Object containing updated user profile details.first_name(string): User's first name.last_name(string): User's last name.email(string): User's email address.location(string): User's location.avatar(string): URL of the user's avatar.company_name(string): User's company name.title(string): User's title.
options(Core.RequestOptions): Additional request options.
Returns: Promise<Profile>
Example:
const updatedProfile = await client.users.updateMe({
first_name: 'John',
last_name: 'Doe',
email: 'john.doe@example.com',
});
console.log(updatedProfile);deleteMe
Delete the profile of the authenticated user.
Signature:
deleteMe(options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.users.deleteMe();
console.log('User profile deleted.');The PresignedUrl class provides a method for retrieving a presigned URL along with the associated file name.
get
Retrieve a presigned URL and its associated file name.
Signature:
get(options?: Core.RequestOptions): Core.APIPromise<PresignedUrlResponse>Parameters:
options(Core.RequestOptions): Additional request options.
Returns: Promise<PresignedUrlResponse>
Example:
const response = await client.presignedUrl.get();
console.log(response.presigned_url);
console.log(response.file_name);The DeviceConnector class provides methods for retrieving and listing connector. Below are the details for each method, including parameters, return types, and example usage.
create
Create a new device connector.
Signature:
create(params: DeviceConnectorParams, options?: Core.RequestOptions): Core.APIPromise<DeviceConnectorParams>Parameters:
- params (DeviceConnectorParams): Parameters for creating a device connector:
- network_server (string): The URL or address of the network server.
- name (string): The name of the device connector.
- connector_type (string): The type of the connector (e.g., mqtt, http).
- status? (string): Optional status of the connector.
- deviceHttpConfig? (DeviceHttpConfig): Optional HTTP-specific configuration:
- api_token (string): Token used to authenticate HTTP requests.
- address_url (string): Base URL of the HTTP endpoint.
- deviceMqttConfig? (DeviceMqttConfig): Optional MQTT-specific configuration:
- mqtt_broker (string): Address of the MQTT broker.
- username (string): Username for broker authentication.
- password (string): Password for broker authentication.
- options (Core.RequestOptions): Additional request options.
Returns: Promise <DeviceConnectorParams>
Example:
const newMqttConnector = await client.deviceConnector.create({
network_server: 'poue4567-e89...',
name: 'MQTT Connector 1',
connector_type: 'mqtt_broker',
deviceMqttConfig: {
mqtt_broker: 'mqtt://broker.example.com',
username: 'user123',
password: 'secretpass',
},
});
const newHttpConnector = await client.deviceConnector.create({
network_server: 'poue4567-e89...',
name: 'HTTP Connector 1',
connector_type: 'http_server',
deviceHttpConfig: {
api_token: 'your_api_token_here',
address_url: 'http://api.example.com/data',
},
});testConnectionPreview
Test connection to a device connector without saving it (preview only).
Signature:
testConnectionPreview(params: DeviceConnectorParams, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
- params (DeviceConnectorParams): Parameters for testing a device connector connection:
- network_server (string): The URL or address of the network server.
- name (string): The name of the device connector.
- connector_type (string): The type of the connector (e.g., mqtt, http).
- status? (string): Optional status of the connector.
- deviceHttpConfig? (DeviceHttpConfig): Optional HTTP-specific configuration:
- api_token (string): Token used to authenticate HTTP requests.
- address_url (string): Base URL of the HTTP endpoint.
- deviceMqttConfig? (DeviceMqttConfig): Optional MQTT-specific configuration:
- mqtt_broker (string): Address of the MQTT broker.
- username (string): Username for broker authentication.
- password (string): Password for broker authentication.
- options (Core.RequestOptions): Additional request options.
Returns: Promise <void>
Example:
await client.deviceConnector.testConnectionPreview({
network_server: 'poue4567-e89...',
name: 'MQTT Connector Preview',
connector_type: 'mqtt_broker',
deviceMqttConfig: {
mqtt_broker: 'mqtt://broker.example.com',
username: 'testuser',
password: 'testpass',
},
});
await client.deviceConnector.testConnectionPreview({
network_server: 'poue4567-e89...',
name: 'HTTP Connector Preview',
connector_type: 'http_server',
deviceHttpConfig: {
api_token: 'test_api_token',
address_url: 'http://api.example.com/data',
},
});testConnection
Test an existing device connector by ID.
Signature:
testConnection(id: string, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(string): A UUID string identifying the device connector to test.options? (Core.RequestOptions): Additional request options such as custom headers.
Returns: Promise <void>
Example:
await client.deviceConnector.testConnection('123e4567-e89b-12d3-a456-426614174000');The DeviceModel class provides methods for retrieving and listing device model. Below are the details for each method, including parameters, return types, and example usage.
create
Create a new device model.
Signature:
create(params: DeviceModelParams, options?: Core.RequestOptions): Core.APIPromise<DeviceModelParams>Parameters:
- params (DeviceModelParams): Parameters for creating a device model:
- name (string): The name of the device model.
- alias (string): The alias of the device model.
- image_url (string): The image URL of the device model.
- default_config (object): The default configuration object.
- manufacture (string): The manufacturer of the device model.
- options (Core.RequestOptions): Additional request options.
Returns: Promise
Example:
const newDeviceModel = await client.deviceModel.create({
name: 'Model X',
alias: 'model_x',
image_url: 'http://example.com/image.png',
default_config: {},
manufacture: '123e4567-e89...',
});retrieve
Retrieve a device model by its ID.
Signature:
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<DeviceModelParams>Parameters:
id(string): The unique identifier of the device model to retrieve.options(Core.RequestOptions): Additional request options.
Returns: Promise<DeviceModelParams>
Example:
const deviceModel = await client.deviceModel.retrieve('123e4567-e89b-12d3-a456-426614174000');
console.log(deviceModel.name);update
Update an existing device model by its ID.
Signature:
update(id: string, params: DeviceModelParams, options?: Core.RequestOptions): Core.APIPromise<DeviceModelParams>Parameters:
id(string): The unique identifier of the device model to update.params(DeviceModelParams): The data to update the device model with:name(string): The name of the device model.alias(string): The alias of the device model.image_url(string): The image URL of the device model.default_config(object): The default configuration object.manufacture(string): The manufacturer of the device model.
options(Core.RequestOptions): Additional request options.
Returns: Promise<DeviceModelParams>
Example:
const updatedDeviceModel = await client.deviceModel.update('123e4567-e89b-12d3-a456-426614174000', {
name: 'Model Y',
alias: 'model_y',
image_url: 'http://example.com/image2.png',
default_config: { setting: true },
manufacture: '123e4567-e89...',
});
console.log(updatedDeviceModel);list
Retrieve a list of device models with optional filters.
Signature:
list(params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<DeviceModelListResponse>Parameters:
params(ListParamsResponse): Query parameters to filter and paginate the results:ordering(string, optional): Which field to use when ordering the results.search(string, optional): A search term.limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.
options(Core.RequestOptions): Additional request options.
Returns: Promise<DeviceModelListResponse>
Example:
const deviceModels = await client.deviceModel.list({
ordering: 'name',
search: 'model',
limit: 10,
offset: 0,
});
console.log(deviceModels.results);delete
Delete a device models by its ID.
Signature:
delete(id: string, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(string): A UUID string identifying this device models.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.deviceModel.delete('a557d013-f6...');The Device class provides methods for retrieving and listing device. Below are the details for each method, including parameters, return types, and example usage.
create
Create a new device.
Signature:
create(params: DeviceParams, options?: Core.RequestOptions): Core.APIPromise<DeviceParams>Parameters:
params(DeviceParams): Parameters for creating a device:status(string, optional): The status of the device.device_connector(string): The connector type or identifier for the device.device_model(string): The model identifier of the device.
options(Core.RequestOptions): Additional request options.
Returns: Promise<DeviceParams>
Example:
const newDevice = await client.devices.create({
status: 'active',
device_connector: '123e4567-e89...',
device_model: 'poye4567-e89...',
});retrieve
Retrieve details of a device by its ID.
Signature:
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<DeviceParams>Parameters:
id(string): The unique identifier of the device to retrieve.options(Core.RequestOptions): Additional request options.
Returns: Promise<DeviceParams>
Example:
const device = await client.devices.retrieve('1l3e4567-e89...');
console.log(device.device_model);update
Update an existing device by its ID.
Signature:
update(id: string, params: DeviceParams, options?: Core.RequestOptions): Core.APIPromise<DeviceParams>Parameters:
id(string): The unique identifier of the device to update.params(DeviceParams): Parameters to update the device with:status(string, optional): The status of the device.device_connector(string): The connector type or identifier for the device.device_model(string): The model identifier of the device.
options(Core.RequestOptions): Additional request options.
Returns: Promise<DeviceParams>
Example:
const updatedDevice = await client.devices.update('device-id-123', {
status: 'active',
device_connector: '123e4567-e89...',
device_model: 'ks3e4567-e89...',
});list
List devices with optional pagination.
Signature:
list(params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<DeviceListResponse>Parameters:
params(ListParamsResponse): Query parameters for listing devices:limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.bbox(string, optional): A bounding box filter (for example:minLon,minLat,maxLon,maxLat).
options(Core.RequestOptions): Additional request options.
Returns: Promise<DeviceListResponse>
Example:
const devices = await client.devices.list({ limit: 10, offset: 0 });
console.log(devices.results);delete
Delete a device by its ID.
Signature:
delete(id: number, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(number): The unique identifier of the device to delete.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.devices.delete('123e4567-e89...');
console.log('Device deleted successfully.');check claim code
Check the device by claim code
Signature:
checkClaimCode(claim_code: string, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
claim_code(string): The unique code of the device.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.devices.checkClaimCode('123e4567-e89...');The Manufacturers class provides methods for retrieving and listing manufacturers of device. Below are the details for each method, including parameters, return types, and example usage.
create
Create a new manufacturer.
Signature:
create(params: ManufacturersParams, options?: Core.RequestOptions): Core.APIPromise<ManufacturersParams>Parameters:
params(ManufacturersParams): Parameters for creating a manufacturer:name(string): The name of the manufacturer.location(string): The location of the manufacturer.description(string): A description of the manufacturer.portal_url(string): The portal URL information of the manufacturer.national(string): The nationality or country of the manufacturer.
options(Core.RequestOptions): Additional request options.
Returns: Promise<ManufacturersParams>
Example:
const newManufacturer = await client.manufacturers.create({
name: 'Acme Corp',
location: 'USA',
description: 'Leading manufacturer of widgets',
portal_url: 'https://acme.example.com',
national: 'US',
});
```
</details>
<details>
<summary><strong>retrieve</strong></summary>
Retrieve details of a manufacturer by its ID.
**Signature:**
```typescript
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<ManufacturersParams>Parameters:
id(string): The unique identifier of the manufacturer to retrieve.options(Core.RequestOptions): Additional request options.
Returns: Promise<ManufacturersParams>
Example:
const manufacturer = await client.manufacturers.retrieve('123e4567-e89...');
console.log(manufacturer.name);update
Update an existing manufacturer by its ID.
Signature:
update(id: string, params: ManufacturersParams, options?: Core.RequestOptions): Core.APIPromise<ManufacturersParams>Parameters:
id(string): The unique identifier of the manufacturer to update.params(ManufacturersParams): Parameters for updating the manufacturer:name(string): The name of the manufacturer.location(string): The location of the manufacturer.description(string): A description of the manufacturer.portal_url(string): The portal URL information of the manufacturer.national(string): The nationality or country of the manufacturer.
options(Core.RequestOptions): Additional request options.
Returns: Promise<ManufacturersParams>
Example:
const updatedManufacturer = await client.manufacturers.update('123e4567-e89...', {
name: 'Acme Corp Updated',
location: 'USA',
description: 'Updated description',
portal_url: 'https://acme.example.com',
national: 'US',
});list
List manufacturers with optional filtering, ordering, and pagination.
Signature:
list(params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<ManufacturersListResponse>Parameters:
params(ListParamsResponse): Query parameters for filtering, ordering, and pagination:ordering(string, optional): Which field to use when ordering the results.search(string, optional): A search term to filter results.limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.
options(Core.RequestOptions): Additional request options.
Returns: Promise<ManufacturersListResponse>
Response shape:
count(integer): Total number of manufacturers matching the query.next(string | null): URL to the next page of results, ornull.previous(string | null): URL to the previous page of results, ornull.results(ManufacturersParams[]): Array of manufacturer objects.
Example:
const listResponse = await client.manufacturers.list({
ordering: 'name',
search: 'acme',
limit: 10,
offset: 0,
});
console.log(listResponse.results);delete
Delete a manufacturer by its ID.
Signature:
delete(id: number, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(number): A UUID string identifying this manufacturer. (Note: Type isnumberin code but described as UUID string)options(Core.RequestOptions): Additional request options.
Returns: Promise<void> (No content on success)
Example:
await client.manufacturers.delete('123e4567-e89...');The NetworkServer class provides methods for retrieving and listing network server. Below are the details for each method, including parameters, return types, and example usage.
create
Create a new network server.
Signature:
reate(params: NetworkServerParams, options?: Core.RequestOptions): Core.APIPromise<NetworkServerParams>Parameters:
params(NetworkServerParams): Parameters for creating a new network server.name: (string): The name of the network server.logo: (string): The logo of the network server.description: (string): The description of the network server.type_connect: (string[]): An array of connection types supported by the network server.
Possible values may include:"mqtt_broker": The server connects using MQTT protocol."http_server": The server exposes HTTP endpoints.
options(Core.RequestOptions): Additional request options.
Returns: Promise<NetworkServerParams>
Example:
const newNetworkServer = await client.networkServer.create({
name: 'Chirpstack',
logo: 'logo-url',
description: 'example-description',
type_connect: ['mqtt_broker', 'http_server'],
});retrieve
Retrieve details of a network server by its ID.Signature:
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<NetworkServerParams>Parameters:
id(string): The unique identifier of the network server to retrieve.options(Core.RequestOptions): Additional request options.
Returns: Promise<NetworkServerParams>
Example:
const networkServer = await client.networkServer.retrieve('a557d013-f6...');
console.log(networkServer.name);update
Update an existing network server by its ID.
Signature:
update(id: string, params: NetworkServerParams, options?: Core.RequestOptions): Core.APIPromise<NetworkServerParams>Parameters:
id(string): The unique identifier of the network server to update.params(NetworkServerParams): Parameters for updating the network server.name: (string): The name of the network server.logo: (string): The logo of the network server.description: (string): The description of the network server.type_connect: (string[]): An array of connection types supported by the network server. Possible values include:"mqtt_broker": The server connects using MQTT protocol."http_server": The server exposes HTTP endpoints.
options(Core.RequestOptions): Additional request options.
Returns: Promise<NetworkServerParams>
Example:
const updatedNetworkServer = await client.networkServer.update('a557d013-f6 ...', {
name: 'Chirpstack Updated',
logo: 'new-logo-url',
description: 'updated-description',
type_connect: ['mqtt_broker'],
});list
List network servers with optional filtering, ordering, and pagination.
Signature:
list(params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<NetworkServerListResponse>Parameters:
params(ListParamsResponse): Query parameters for filtering, ordering, and pagination:ordering(string, optional): Which field to use when ordering the results.search(string, optional): A search term to filter results.limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.
options(Core.RequestOptions): Additional request options.
Returns: Promise<NetworkServerListResponse>
Response shape:
count(integer): Total number of network servers matching the query.next(string | null): URL to the next page of results, ornull.previous(string | null): URL to the previous page of results, ornull.results(NetworkServer[]): Array of network server objects.
Example:
const listResponse = await client.networkServer.list({
ordering: 'name',
search: 'chirpstack',
limit: 10,
offset: 0,
});
console.log(listResponse.results);delete
Delete a network server by its ID.
Signature:
delete(id: string, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(string): A UUID string identifying this network server.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.networkServer.delete('a557d013-f6...');The Widgets class provides methods to manage dashboard widgets, including bulk updating widget configurations. This class allows you to update multiple widgets at once with their respective configurations.
updateWidgets
Updates multiple widgets with their configurations in a single bulk operation.
Signature:
updateWidgets(params: WidgetsUpdateParams[], options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
params(WidgetsUpdateParams[]): Array of widget update parameters.id(string): The unique identifier of the widget to update.configuration(any): The configuration object for the widget.
options(Core.RequestOptions): Additional request options.
Returns:
Core.APIPromise<void>: A promise that resolves when the bulk update is complete.
Example Usage:
import { SpaceDFSDK } from 'spacedf-sdk-node';
const client = new SpaceDFSDK({
organization: 'your-org-id',
});
// Update multiple widgets
await client.widgets.updateWidgets([
{
id: 'widget-1',
configuration: {
title: 'Temperature Monitor',
refreshInterval: 5000,
chartType: 'line',
},
},
{
id: 'widget-2',
configuration: {
title: 'Device Status',
showLegend: true,
colorScheme: 'dark',
},
},
]);Error Handling:
try {
await client.widgets.updateWidgets(widgetUpdates);
console.log('Widgets updated successfully');
} catch (error) {
if (error instanceof SpaceDFSDK.BadRequestError) {
console.error('Invalid widget configuration:', error.message);
} else if (error instanceof SpaceDFSDK.NotFoundError) {
console.error('One or more widgets not found:', error.message);
} else {
console.error('Failed to update widgets:', error.message);
}
}The DeviceSpaces class provides methods for managing device spaces within an application. Device spaces allow for grouping and organizing devices within specific spaces. Below are the details for each method, including parameters, return types, and example usage.
create
Create a new device space.
Signature:
create(params: DeviceSpacesParams, options?: Core.RequestOptions): Core.APIPromise<DeviceSpacesParams>Parameters:
params(DeviceSpacesParams): Parameters for creating a new device space.name(string): The name of the device space.description(string): A description of the device space.dev_eui(string): A dev_eui of device space.
options(Core.RequestOptions): Additional request options.
Returns: Promise<DeviceSpacesParams>
Example:
const newDeviceSpace = await client.deviceSpaces.create({
name: 'Sensor Network A',
description: 'Device space for temperature and humidity sensors',
dev_eui: '8437687685476895',
});list
List device spaces with optional filtering, ordering, and pagination.
Signature:
list(params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<DeviceSpacesListResponse>Parameters:
params(ListParamsResponse): Query parameters for filtering, ordering, and pagination:ordering(string, optional): Which field to use when ordering the results.search(string, optional): A search term to filter results.limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.include_latest_checkpoint(boolean, optional): Include latest checkpoint
options(Core.RequestOptions): Additional request options.
Returns: Promise<DeviceSpacesListResponse>
Response shape:
count(integer): Total number of device spaces matching the query.next(string | null): URL to the next page of results, ornull.previous(string | null): URL to the previous page of results, ornull.results(DeviceSpacesParams[]): Array of device space objects.
Example:
const listResponse = await client.deviceSpaces.list(
{
ordering: 'name',
search: 'sensor',
limit: 10,
offset: 0,
},
{
'X-Space': 'space-slug-name',
},
);
console.log(listResponse.results);listPublic
List public device spaces with optional filtering, ordering, and pagination.
Signature:
listPublic(params?: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<DeviceSpacesListResponse>Parameters:
params(ListParamsResponse, optional): Query parameters for filtering, ordering, and pagination:ordering(string, optional): Which field to use when ordering the results.search(string, optional): A search term to filter results.limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.
options(Core.RequestOptions, optional): Additional request options.
Returns: Promise<DeviceSpacesListResponse>
Response shape:
count(integer): Total number of device spaces matching the query.next(string | null): URL to the next page of results, ornull.previous(string | null): URL to the previous page of results, ornull.results(DeviceSpacesParams[]): Array of device space objects.
Example:
const publicDeviceSpaces = await client.deviceSpaces.listPublic({
ordering: 'name',
limit: 10,
offset: 0,
});
console.log(publicDeviceSpaces.results);retrievePublic
Retrieve a public device space by its ID.
Signature:
retrievePublic(id: string, options?: Core.RequestOptions): Core.APIPromise<DeviceSpacesParams>Parameters:
id(string): A UUID string identifying this device space.options(Core.RequestOptions, optional): Additional request options.
Returns: Promise<DeviceSpacesParams>
Example:
const publicDeviceSpace = await client.deviceSpaces.retrievePublic('3fa85f64-5717-4562-b3fc-2c963f66afa6');
console.log(publicDeviceSpace.name);retrieveByDeviceId
Retrieve the device space associated with a device.
Signature:
retrieveByDeviceId(deviceId: string, options?: Core.RequestOptions): Core.APIPromise<DeviceSpacesParams>Parameters:
deviceId(string): Identifier of the device whose device space should be retrieved.options(Core.RequestOptions): Additional request options.
Returns: Promise<DeviceSpacesParams>
Example:
const deviceSpace = await client.deviceSpaces.retrieveByDeviceId('8437687685476895');
console.log(deviceSpace.name, deviceSpace.dev_eui);partialUpdate
Partially update a device space by its ID.
Signature:
partialUpdate(id: string, params: DeviceSpacesParams, options?: Core.RequestOptions): Core.APIPromise<DeviceSpacesParams>Parameters:
id(string): A UUID string identifying this device space.params(DeviceSpacesParams): Fields to update on the device space.options(Core.RequestOptions): Additional request options.
Returns: Promise<DeviceSpacesParams>
Example:
const updated = await client.deviceSpaces.partialUpdate('789e0123-e89b-12d3-a456-426614174002', {
name: 'Sensor Network A (West Wing)',
description: 'Updated description',
dev_eui: '8437687685476895',
});
console.log(updated.name);delete
Delete a device space by its ID.
Signature:
delete(id: string, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(string): A UUID string identifying this device space.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.deviceSpaces.delete('789e0123-e89b-12d3-a456-426614174002');bulkUpdatePosition
Updates the position of multiple device spaces in a single bulk operation.
Signature:
bulkUpdatePosition(params: DeviceSpacesBulkUpdatePositionParams[], options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
params(DeviceSpacesBulkUpdatePositionParams[]): Array of device space position update parameters.id(string): The unique identifier of the device space.position(object): The new position of the device space.x(number): The X coordinate.y(number): The Y coordinate.z(number): The Z coordinate.
options(Core.RequestOptions): Additional request options.
Returns:
Core.APIPromise<void>: A promise that resolves when the bulk update is complete.
Example Usage:
// Update positions for multiple device spaces
await client.deviceSpaces.bulkUpdatePosition([
{
id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
position: {
x: 10.5,
y: 20.0,
z: 0.0,
},
},
{
id: '789e0123-e89b-12d3-a456-426614174002',
position: {
x: -5.0,
y: 12.3,
z: 1.5,
},
},
]);The Trip class provides methods for managing device trips, including creating, retrieving, updating, listing, and deleting trip records. Trips represent journeys or data collection periods for devices. Below are the details for each method, including parameters, return types, and example usage.
interface TripParams {
space_device: string; // The unique identifier of the device associated with this trip
start_at: string; // The start timestamp of the trip (ISO 8601 format)
ended_at: string; // The end timestamp of the trip (ISO 8601 format)
}interface TripListParams extends ListParamsResponse {
include_checkpoints?: boolean; // Whether to include checkpoints in the response
}This interface extends ListParamsResponse which includes:
limit?: number- Number of results to return per pageoffset?: number- The initial index from which to return the resultsordering?: string- Which field to use when ordering the resultssearch?: string- A search term to filter results
type TripListResponse = ListResponse<TripParams>;Where ListResponse<T> includes:
count: number- Total number of trips matching the queryresults: TripParams[]- Array of trip objectsnext?: string | null- URL to the next page of results, or nullprevious?: string | null- URL to the previous page of results, or null
create
Create a new trip record.
Signature:
create(params: TripParams, options?: Core.RequestOptions): Core.APIPromise<TripParams>Parameters:
params(TripParams): Parameters for creating a new trip.space_device: (string): The unique identifier of the device associated with this trip.start_at: (string): The start timestamp of the trip (ISO 8601 format).ended_at: (string): The end timestamp of the trip (ISO 8601 format).
options(Core.RequestOptions): Additional request options.
Returns: Promise<TripParams>
Example:
const newTrip = await client.trip.create({
space_device: 'device-uuid-123',
start_at: '2024-01-15T08:00:00Z',
ended_at: '2024-01-15T18:30:00Z',
});retrieve
Retrieve details of a trip by its ID.
Signature:
retrieve(id: string, params: TripListParams, options?: Core.RequestOptions): Core.APIPromise<TripParams>Parameters:
id(string): The unique identifier of the trip to retrieve.params(TripListParams): Query parameters for the request.include_checkpoints(boolean, optional): Whether to include checkpoints in the response.ordering(string, optional): Which field to use when ordering the results.search(string, optional): A search term to filter results.limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.
options(Core.RequestOptions): Additional request options.
Returns: Promise<TripParams>
Example:
const trip = await client.trip.retrieve('trip-uuid-456', {
include_checkpoints: true,
});
console.log(trip.space_device);list
List trips with optional filtering, ordering, and pagination.
Signature:
list(params: TripListParams & { space_device__device_id: string }, options?: Core.RequestOptions): Core.APIPromise<TripListResponse>Parameters:
params(TripListParams & { space_device__device_id: string }): Query parameters for filtering, ordering, and pagination:space_device__device_id(string): Required. The device ID to filter trips by.ordering(string, optional): Which field to use when ordering the results.search(string, optional): A search term to filter results.limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.include_checkpoints(boolean, optional): Whether to include checkpoints in the response.
options(Core.RequestOptions): Additional request options.
Returns: Promise<TripListResponse>
Response shape:
count(integer): Total number of trips matching the query.next(string | null): URL to the next page of results, ornull.previous(string | null): URL to the previous page of results, ornull.results(TripParams[]): Array of trip objects.
Example:
const listResponse = await client.trip.list({
space_device__device_id: 'device-uuid-123',
ordering: 'start_at',
limit: 20,
offset: 0,
include_checkpoints: false,
});
console.log(listResponse.results);update
Update an existing trip by its ID (full update).
Signature:
update(id: string, params: TripParams, options?: Core.RequestOptions): Core.APIPromise<TripParams>Parameters:
id(string): The unique identifier of the trip to update.params(TripParams): Parameters for updating the trip.space_device: (string): The unique identifier of the device associated with this trip.start_at: (string): The start timestamp of the trip (ISO 8601 format).ended_at: (string): The end timestamp of the trip (ISO 8601 format).
options(Core.RequestOptions): Additional request options.
Returns: Promise<TripParams>
Example:
const updatedTrip = await client.trip.update('trip-uuid-456', {
space_device: 'device-uuid-123',
start_at: '2024-01-15T09:00:00Z',
ended_at: '2024-01-15T19:00:00Z',
});partialUpdate
Partially update an existing trip by its ID.
Signature:
partialUpdate(id: string, params: Partial<TripParams>, options?: Core.RequestOptions): Core.APIPromise<TripParams>Parameters:
id(string): The unique identifier of the trip to update.params(Partial): Parameters for partially updating the trip. Only provided fields will be updated.space_device(string, optional): The unique identifier of the device associated with this trip.start_at(string, optional): The start timestamp of the trip (ISO 8601 format).ended_at(string, optional): The end timestamp of the trip (ISO 8601 format).
options(Core.RequestOptions): Additional request options.
Returns: Promise<TripParams>
Example:
const partiallyUpdatedTrip = await client.trip.partialUpdate('trip-uuid-456', {
ended_at: '2024-01-15T20:00:00Z',
});delete
Delete a trip by its ID.
Signature:
delete(id: string, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(string): The unique identifier of the trip to delete.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.trip.delete('trip-uuid-456');The Telemetry class provides methods for retrieving telemetry entities, alerts, events, automations, actions, notifications, and geofences. This class allows you to search and filter telemetry entities by display type and search terms, bulk-update entity visibility (visible and hidden IDs), retrieve alerts, query events by device, list telemetry actions, manage notification subscriptions, manage automations (list, create, retrieve, update, delete), and manage geofences (list, create, retrieve, update, delete, test).
entities.list
List telemetry entities with optional filtering, ordering, and pagination.
Signature:
list(params: EntitiesListParams, options?: Core.RequestOptions): Core.APIPromise<EntitiesListResponse>Parameters:
params(EntitiesListParams): Query parameters for filtering, ordering, and pagination:display_type(string, optional): Display type filter (e.g., "chart").search(string, optional): A search term to filter results.ordering(string, optional): Which field to use when ordering the results.limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.
options(Core.RequestOptions): Additional request options.
Returns: Promise<EntitiesListResponse>
Response shape:
count(integer): Total number of entities matching the query.next(string | null): URL to the next page of results, ornull.previous(string | null): URL to the previous page of results, ornull.results(Entity[]): Array of entity objects.
Example:
const entities = await client.telemetry.entities.list({
display_type: 'chart',
search: 'Water Depth',
limit: 10,
offset: 0,
});
console.log(entities.results);Example with minimal parameters:
const entities = await client.telemetry.entities.list({
display_type: 'chart',
search: 'Water Depth',
});
console.log(entities.count);entities.bulkUpdate
Bulk-update telemetry entity visibility by sending arrays of entity IDs to mark as visible or hidden. This issues a POST to /telemetry/v1/entities/bulk-update with a JSON body.
Signature:
bulkUpdate(params: BulkUpdateEntitiesParams, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
params(BulkUpdateEntitiesParams): JSON body parameters:visible_entity_ids(string[]): Entity IDs to set as visible.hidden_entity_ids(string[]): Entity IDs to set as hidden.
options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.telemetry.entities.bulkUpdate({
visible_entity_ids: ['entity-id-1', 'entity-id-2'],
hidden_entity_ids: ['entity-id-3'],
});alerts.list
List telemetry alerts with optional filtering, ordering, and pagination.
Signature:
list(params: AlertsListParams, options?: Core.RequestOptions): Core.APIPromise<AlertsListResponse>Parameters:
params(AlertsListParams): Query parameters for filtering, ordering, and pagination:search(string, optional): A search term to filter results.ordering(string, optional): Which field to use when ordering the results.limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.
options(Core.RequestOptions): Additional request options.
Returns: Promise<AlertsListResponse>
Response shape:
count(integer): Total number of alerts matching the query.next(string | null): URL to the next page of results, ornull.previous(string | null): URL to the previous page of results, ornull.results(Alert[]): Array of alert objects.
Example:
const alerts = await client.telemetry.alerts.list({
search: 'critical',
limit: 10,
offset: 0,
});
console.log(alerts.results);Example with minimal parameters:
const alerts = await client.telemetry.alerts.list({
search: 'critical',
});
console.log(alerts.count);automations.list
List telemetry automations with optional filtering and pagination.
Signature:
list(params: AutomationsListParams, options?: Core.RequestOptions): Core.APIPromise<AutomationsListResponse>Parameters:
params(AutomationsListParams): Query parameters for filtering and pagination:search(string, optional): A search term to filter results.ordering(string, optional): Which field to use when ordering the results.limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.
options(Core.RequestOptions): Additional request options.
Returns: Promise<AutomationsListResponse>
Response shape:
count(integer): Total number of automations matching the query.next(string | null): URL to the next page of results, ornull.previous(string | null): URL to the previous page of results, ornull.results(Automation[]): Array of automation objects.
Example:
const automations = await client.telemetry.automations.list({
search: 'Low Battery',
limit: 10,
offset: 0,
});
console.log(automations.results);automations.create
Create a new telemetry automation.
Signature:
create(params: AutomationParams, options?: Core.RequestOptions): Core.APIPromise<Automation>Parameters:
params(AutomationParams): Automation payload:name(string): The automation name.device_id(string): Device UUID that this automation applies to.action_ids(string[]): Action IDs to execute when the rule is triggered.event_rule(AutomationEventRule): Event rule definition:rule_key(string): Rule key identifier.definition.conditions.and(AutomationRuleCondition[]): Rule conditions.is_active(boolean): Whether the rule is currently active.repeat_able(boolean): Whether the rule can repeat.cooldown_sec(number): Cooldown time in seconds.description(string): Human-readable rule description.
options(Core.RequestOptions): Additional request options.
Returns: Promise<Automation>
Example:
const automation = await client.telemetry.automations.create({
name: 'Low Battery Alert',
device_id: 'device-uuid-123',
action_ids: ['action-uuid-1'],
event_rule: {
rule_key: 'battery_low',
definition: {
conditions: {
and: [{ battery: { lte: 20 } }],
},
},
is_active: true,
repeat_able: true,
cooldown_sec: 300,
description: 'Trigger when battery is less than or equal to 20%',
},
});
console.log(automation.id);automations.retrieve
Retrieve an automation by its ID.
Signature:
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Automation>Parameters:
id(string): The unique identifier of the automation to retrieve.options(Core.RequestOptions): Additional request options.
Returns: Promise<Automation>
Example:
const automation = await client.telemetry.automations.retrieve('automation-uuid-123');
console.log(automation.name);automations.update
Update an existing automation by its ID (full update).
Signature:
update(id: string, params: AutomationParams, options?: Core.RequestOptions): Core.APIPromise<Automation>Parameters:
id(string): The unique identifier of the automation to update.params(AutomationParams): Updated automation payload.options(Core.RequestOptions): Additional request options.
Returns: Promise<Automation>
Example:
const updated = await client.telemetry.automations.update('automation-uuid-123', {
name: 'Low Battery Alert Updated',
device_id: 'device-uuid-123',
action_ids: ['action-uuid-1', 'action-uuid-2'],
event_rule: {
rule_key: 'battery_low',
definition: {
conditions: {
and: [{ battery: { lte: 15 } }],
},
},
is_active: true,
repeat_able: true,
cooldown_sec: 180,
description: 'Trigger when battery is less than or equal to 15%',
},
});
console.log(updated.updated_at);automations.delete
Delete an automation by its ID.
Signature:
delete(id: string, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(string): The unique identifier of the automation to delete.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.telemetry.automations.delete('automation-uuid-123');actions.list
List telemetry actions with optional filtering and pagination.
Signature:
list(params: ListParamsResponse, options?: Core.RequestOptions): Core.APIPromise<ActionsListResponse>Parameters:
params(ListParamsResponse): Query parameters for filtering and pagination:search(string, optional): A search term to filter results.ordering(string, optional): Which field to use when ordering the results.limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.bbox(string, optional): A bounding box filter.
options(Core.RequestOptions): Additional request options.
Returns: Promise<ActionsListResponse>
Response shape:
count(integer): Total number of actions matching the query.next(string | null): URL to the next page of results, ornull.previous(string | null): URL to the previous page of results, ornull.results(Action[]): Array of action objects.
Action shape:
id(string): Action UUID.name(string): Action name.key(string): Action key.created_at(string, optional): Creation timestamp.data(object): Action payload:channel(string): Channel identifier.message(string): Message content.
Example:
const actions = await client.telemetry.actions.list({
search: 'battery',
limit: 10,
offset: 0,
});
console.log(actions.results);notifications.subscribe
Subscribe a push notification endpoint for telemetry notifications.
Signature:
subscribe(params: NotificationsSubscribeParams, options?: Core.RequestOptions): Core.APIPromise<unknown>Parameters:
params(NotificationsSubscribeParams): Subscription payload:auth(string): Push subscription auth secret.endpoint(string): Push service endpoint URL.p256dh(string): Push subscription (p256dh) public key.
options(Core.RequestOptions): Additional request options.
Returns: Promise<unknown>
Example:
await client.telemetry.notifications.subscribe({
auth: 'string1',
endpoint: 'string3',
p256dh: 'string5',
});automations.summary
Get a summary of automations counts.
Signature:
summary(options?: Core.RequestOptions): Core.APIPromise<{
total: number;
active: number;
disabled: number;
}>Parameters:
options(Core.RequestOptions): Additional request options.
Returns: Promise<{ total: number; active: number; disabled: number }>
Example:
const summary = await client.telemetry.automations.summary();
console.log(summary.total);
console.log(summary.active);
console.log(summary.disabled);events.list
List telemetry events for a device with optional filtering and pagination.
Signature:
list(device_id: string, params: EventsListParams, options?: Core.RequestOptions): Core.APIPromise<ListResponse<TelemetryEvent>>Parameters:
device_id(string): The unique identifier of the device to fetch events for.params(EventsListParams): Query parameters for filtering and pagination:limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.search(string, optional): A search term to filter results.
options(Core.RequestOptions): Additional request options.
Returns: Promise<ListResponse<TelemetryEvent>>
Response shape:
count(integer): Total number of events matching the query.next(string | null): URL to the next page of results, ornull.previous(string | null): URL to the previous page of results, ornull.results(TelemetryEvent[]): Array of telemetry event objects.
TelemetryEvent shape:
id(integer): Event ID.event_type(string): Event type (e.g.,"device_event").event_level(string): Event level/category (e.g.,"automation").title(string): Human-readable event title.entity_id(string): Entity UUID associated with the event.time_fired(string): ISO timestamp when the event fired.geofence(object, optional): Geofence metadata, when applicable:id(string): Geofence UUID.name(string): Geofence name.type_zone(string): Zone type (e.g.,"danger").
automation(object, optional): Automation metadata, when applicable:id(string): Automation UUID.name(string): Automation name.
location(object, optional): Location, when applicable:latitude(number): Latitude.longitude(number): Longitude.
Example:
const events = await client.telemetry.events.list('device-uuid-123', {
search: 'Danger Zone',
limit: 10,
offset: 0,
});
console.log(events.results);geofences.list
List geofences with optional filtering and pagination.
Signature:
list(params: GeofencesListParams, options?: Core.RequestOptions): Core.APIPromise<GeofencesListResponse>Parameters:
params(GeofencesListParams): Query parameters for filtering and pagination:name(string, optional): Filter geofences by name.bbox(string, optional): Filter geofences by bounding box (format:minLon,minLat,maxLon,maxLat).ordering(string, optional): Which field to use when ordering the results.limit(integer, optional): Number of results to return per page.offset(integer, optional): The initial index from which to return the results.
options(Core.RequestOptions): Additional request options.
Returns: Promise<GeofencesListResponse>
Response shape:
count(integer): Total number of geofences matching the query.next(string | null): URL to the next page of results, ornull.previous(string | null): URL to the previous page of results, ornull.results(Geofence[]): Array of geofence objects.
Example:
const geofences = await client.telemetry.geofences.list({
name: 'Warehouse',
limit: 10,
offset: 0,
});
console.log(geofences.results);geofences.create
Create a new geofence.
Signature:
create(params: Omit<Geofence, 'id'>, options?: Core.RequestOptions): Core.APIPromise<Geofence>Parameters:
params(Omit<Geofence, 'id'>): Geofence data (all fields exceptid):name(string): The name of the geofence.color(string): Display color for the geofence.type_zone('safe' | 'danger'): Zone type.definition(object): Conditions (e.g.conditions.and).features(PolygonGeometry[]): Polygon features for the geofence.
options(Core.RequestOptions): Additional request options.
Returns: Promise<Geofence>
Example:
const newGeofence = await client.telemetry.geofences.create({
name: 'Safe Zone A',
color: '#00ff00',
type_zone: 'safe',
definition: { conditions: { and: [] } },
features: [
/* PolygonGeometry[] */
],
});
console.log(newGeofence.id);geofences.retrieve
Retrieve a geofence by its ID.
Signature:
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Geofence>Parameters:
id(string): The unique identifier of the geofence to retrieve.options(Core.RequestOptions): Additional request options.
Returns: Promise<Geofence>
Example:
const geofence = await client.telemetry.geofences.retrieve('123e4567-e89b-12d3-a456-426614174000');
console.log(geofence.name);geofences.update
Update an existing geofence by its ID (full update).
Signature:
update(id: string, params: Omit<Geofence, 'id'>, options?: Core.RequestOptions): Core.APIPromise<Geofence>Parameters:
id(string): The unique identifier of the geofence to update.params(Omit<Geofence, 'id'>): Updated geofence data (same shape as create).options(Core.RequestOptions): Additional request options.
Returns: Promise<Geofence>
Example:
const updatedGeofence = await client.telemetry.geofences.update('123e4567-e89b-12d3-a456-426614174000', {
name: 'Safe Zone A Updated',
color: '#00ff00',
type_zone: 'safe',
definition: { conditions: { and: [] } },
features: [
/* PolygonGeometry[] */
],
});geofences.test
Validate a geofence payload (conditions/features) without creating or updating a saved geofence.
Signature:
test(params: Omit<Geofence, 'id' | 'name' | 'color'>, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
params(Omit<Geofence, 'id' | 'name' | 'color'>): Geofence data to test:type_zone('safe' | 'danger'): Zone type.definition(object): Conditions (e.g.conditions.and).features(PolygonGeometry[]): Polygon features for the geofence.
options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.telemetry.geofences.test({
type_zone: 'safe',
definition: { conditions: { and: [] } },
features: [
/* PolygonGeometry[] */
],
});geofences.delete
Delete a geofence by its ID.
Signature:
delete(id: string, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
id(string): The unique identifier of the geofence to delete.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.telemetry.geofences.delete('123e4567-e89b-12d3-a456-426614174000');The Organizations class provides methods for managing organizations within an application.
checkSlugName
Check organizations by slug name.
Signature:
checkSlugName(slugName: string, options?: Core.RequestOptions): Core.APIPromise<void>Parameters:
slugName(string): A slug name string identifying this organization.options(Core.RequestOptions): Additional request options.
Returns: Promise<void>
Example:
await client.organizations.checkSlugName('danang');The CustomDomain class provides methods for managing and resolving custom domains.
resolve
Resolve a custom domain to obtain organization details.
Signature:
resolve(host: string, options?: Core.RequestOptions): Core.APIPromise<ResolveResponse>Parameters:
host(string): The host name of the custom domain to resolve.options(Core.RequestOptions): Additional request options.
Returns: Promise<ResolveResponse>
Example:
const response = await client.customDomains.resolve('custom.example.com');
console.log(response.org_slug);
console.log(response.org_name);The Plans class provides methods for retrieving subscription plans, including their pricing items, features, and support entitlements.
type PlanCode = 'free' | 'pro';type BillingCycle = 'monthly' | 'yearly';type FeatureValueType = 'limit' | 'boolean' | 'quota';interface Plan {
id: string; // Unique identifier of the plan
name: string; // Human-readable plan name (e.g. "Free")
code: PlanCode; // Machine-readable plan code (e.g. "free")
description: string; // Description of the plan
plan_items: PlanItem[]; // Pricing options for each billing cycle
is_current_plan: boolean; // Whether this is the caller's current plan
created_at: string; // Creation timestamp (ISO 8601 format)
updated_at: string; // Last update timestamp (ISO 8601 format)
features: PlanFeature[]; // Feature entitlements for the plan
support: PlanFeature[]; // Support entitlements for the plan
}interface PlanItem {
id: string; // Unique identifier of the plan item
price: string; // Price as a decimal string (e.g. "0.00")
icon: string; // Icon reference for the plan item
currency: string; // Currency code (e.g. "USD")
discount: number; // Discount applied to the price
billing_cycle: BillingCycle; // Billing cycle for this item
is_active: boolean; // Whether this item is currently active
created_at: string; // Creation timestamp (ISO 8601 format)
updated_at: string; // Last update timestamp (ISO 8601 format)
}interface PlanFeature {
id: string; // Unique identifier of the plan feature
feature: Feature; // The underlying feature definition
enabled: boolean; // Whether the feature is enabled for the plan
limit_value: number | null; // Numeric limit/quota, or null for boolean features
metadata: Record<string, unknown>; // Additional feature metadata
}interface Feature {
id: string; // Unique identifier of the feature
code: string; // Machine-readable feature code (e.g. "device.max_count")
name: string; // Human-readable feature name
description: string; // Description of the feature
value_type: FeatureValueType; // How the feature's value is interpreted
}retrieve
Retrieve a plan by its code.
Signature:
retrieve(plan: PlanCode, options?: Core.RequestOptions): Core.APIPromise<Plan>Parameters:
plan(PlanCode): The plan code identifying the plan ('free'or'pro').options(Core.RequestOptions, optional): Additional request options.
Returns: Promise<Plan>
Example:
const plan = await client.plans.retrieve('free');
console.log(plan.name);
console.log(plan.is_current_plan);
console.log(plan.features.map((f) => f.feature.code));