API Reference
Complete API reference for the Teardown React Native SDK.
The main SDK class that orchestrates all clients.
new TeardownCore(options: TeardownCoreOptions)
| Property | Type | Required | Description |
|---|
org_id | string | Yes | Organization ID from dashboard |
project_id | string | Yes | Project ID from dashboard |
api_key | string | Yes | API key from dashboard |
storageAdapter | StorageAdapter | Yes | Storage adapter instance |
deviceAdapter | DeviceInfoAdapter | Yes | Device info adapter instance |
forceUpdate | ForceUpdateClientOptions | No | Force update configuration |
| Method | Returns | Description |
|---|
setLogLevel(level) | void | Set logging verbosity |
shutdown() | void | Cleanup SDK resources |
| Property | Type | Description |
|---|
api | ApiClient | Backend API client |
device | DeviceClient | Device information client |
identity | IdentityClient | Identity management client |
forceUpdate | ForceUpdateClient | Version checking client |
Manages user and device identification.
| Method | Returns | Description |
|---|
identify(persona?) | AsyncResult<IdentityUser> | Identify user/device |
refresh() | AsyncResult<IdentityUser> | Re-identify current user |
reset() | void | Clear session data |
getIdentifyState() | IdentifyState | Get current state |
getSessionState() | Session | null | Get current session |
onIdentifyStateChange(listener) | () => void | Subscribe to state changes |
shutdown() | void | Cleanup listeners |
interface Persona {
user_id?: string;
email?: string;
name?: string;
}
interface Session {
session_id: string;
device_id: string;
user_id: string;
token: string;
}
type IdentifyState =
| { type: 'unidentified' }
| { type: 'identifying' }
| { type: 'identified'; session: Session; version_info: VersionInfo };
Manages version checking and force updates.
| Method | Returns | Description |
|---|
getVersionStatus() | VersionStatus | Get current version status |
onVersionStatusChange(listener) | () => void | Subscribe to status changes |
shutdown() | void | Cleanup listeners |
| Property | Type | Default | Description |
|---|
checkIntervalMs | number | 300000 | Min time between checks. 0 = every foreground, -1 = disabled |
checkOnForeground | boolean | true | Check when app foregrounds |
identifyAnonymousDevice | boolean | false | Check when not identified |
type VersionStatus =
| { type: 'initializing' }
| { type: 'checking' }
| { type: 'up_to_date' }
| { type: 'update_available' }
| { type: 'update_recommended' }
| { type: 'update_required' }
| { type: 'disabled' };
Collects device information.
| Method | Returns | Description |
|---|
getDeviceId() | Promise<string> | Get stable device UUID |
getDeviceInfo() | Promise<DeviceInfo> | Get full device info |
interface DeviceInfo {
timestamp: string;
os: OSInfo;
hardware: HardwareInfo;
application: ApplicationInfo;
}
Abstract class for storage implementations.
| Method | Returns | Description |
|---|
createStorage(key) | SupportedStorage | Create namespaced storage |
interface SupportedStorage {
preload(): void;
getItem(key: string): string | null;
setItem(key: string, value: string): void;
removeItem(key: string): void;
clear(): void;
keys(): string[];
}
Interface for device information adapters.
| Property | Type | Description |
|---|
applicationInfo | ApplicationInfo | App version info |
hardwareInfo | HardwareInfo | Device hardware info |
osInfo | OSInfo | Operating system info |
interface ApplicationInfo {
version: string;
buildNumber: string;
bundleId: string;
}
interface HardwareInfo {
deviceName: string;
brand: string;
deviceType: string;
}
interface OSInfo {
osName: string;
osVersion: string;
}
Type-safe result type for async operations.
type AsyncResult<T> =
| { success: true; data: T }
| { success: false; error: string };
const result = await core.identity.identify({ user_id: '123' });
if (result.success) {
console.log(result.data.session_id);
} else {
console.error(result.error);
}