Platform Methods
Access TelemetryOS platform features including accounts, users, devices, applications, and proxy services for external content fetching.
Platform Methods
Access to accounts, users, devices, applications, and proxy services.
Overview
These methods provide access to TelemetryOS platform features and information:
- Accounts - Current account information
- Users - Current user information
- Devices - Device hardware information
- Applications - Application discovery and embedding
- Environment - Color scheme detection and subscription
Accounts API
Access information about the current TelemetryOS account.
Import
import { accounts } from '@telemetryos/sdk';getCurrent()
Retrieve current account information.
Signature:
async getCurrent(): Promise<{ id: string }>Returns: Promise resolving to account object
Example:
const account = await accounts().getCurrent();Users API
Access information about the current user.
Import
import { users } from '@telemetryos/sdk';getCurrent()
Retrieve current user information.
Signature:
async getCurrent(): Promise<{ id: string }>Returns: Promise resolving to user object
Example:
const user = await users().getCurrent();Devices API
Access device hardware information.
Import
import { devices } from '@telemetryos/sdk';getInformation()
Retrieve hardware information about the current device.
Signature:
async getInformation(): Promise<DeviceInformation>DeviceInformation Type:
type DeviceInformation = {
deviceSerialNumber: string;
deviceModel: string;
deviceManufacturer: string;
devicePlatform: string;
}Returns: Promise resolving to device information
Example:
const info = await devices().getInformation();Note: Only available on physical devices (not in admin portal)
Applications API
Discover and embed other TelemetryOS applications.
Import
import { applications } from '@telemetryos/sdk';getAllByMountPoint()
Find all applications with a specific mount point.
Signature:
async getAllByMountPoint(mountPoint: string): Promise<Application[]>Application Type:
type Application = {
name: string;
mountPoints: Record<string, MountPoint>;
}
type MountPoint = {
path: string;
[key: string]: any;
}Parameters:
mountPoint- Mount point identifier to search for
Returns: Array of applications with that mount point
Example:
const widgets = await applications().getAllByMountPoint('dashboard-widget');getByName()
Find a specific application by name.
Signature:
async getByName(name: string): Promise<Application | null>Parameters:
name- Application name
Returns: Application object or null if not found
Example:
const weatherApp = await applications().getByName('weather-widget');setDependencies()
Declare application dependencies for preloading.
Signature:
async setDependencies(applicationSpecifiers: string[]): Promise<{
ready: string[];
unavailable: string[];
}>Parameters:
applicationSpecifiers- Array of application specifier strings
Returns: Object with ready and unavailable arrays
Example:
const result = await applications().setDependencies([
'weather-widget-hash123',
'news-ticker-hash456'
]);Important: Call and await setDependencies() before loading sub-applications in iframes.
Environment API
Access environment settings including color scheme preferences.
Import
import { environment } from '@telemetryos/sdk';ColorScheme Type
type ColorScheme = 'light' | 'dark' | 'system'getColorScheme()
Retrieve the current color scheme setting.
Signature:
async getColorScheme(): Promise<ColorScheme>Returns: Promise resolving to the current color scheme
Example:
const colorScheme = await environment().getColorScheme();subscribeColorScheme()
Subscribe to color scheme changes.
Signature:
async subscribeColorScheme(handler: (colorScheme: ColorScheme) => void): Promise<boolean>Parameters:
handler- Callback function invoked when the color scheme changes
Returns: Promise resolving to true if subscription was successful
Example:
await environment().subscribeColorScheme((colorScheme) => {
console.log('Color scheme changed:', colorScheme);
});unsubscribeColorScheme()
Unsubscribe from color scheme changes.
Signature:
async unsubscribeColorScheme(handler?: (colorScheme: ColorScheme) => void): Promise<boolean>Parameters:
handler- Optional. The specific handler to remove. If omitted, all handlers are removed.
Returns: Promise resolving to true if unsubscription was successful
Example:
await environment().unsubscribeColorScheme();Next Steps
- Storage API - Store application data
- Code Examples - Complete integration examples
- Client API - Low-level messaging API
Updated 19 days ago