Skip to content

Configuration

Initialize the SDK before using any module.

import { ESPRMBase } from "@espressif/rainmaker-admin-sdk";
ESPRMBase.configure({
baseUrl: "https://api.rainmaker.espressif.com",
version: "v1",
});
OptionTypeRequiredDescription
baseUrlstringYesESP RainMaker API base URL
versionstringNoAPI version (defaults to v1)
customStorageAdapterESPRMStorageAdapterInterfaceNoCustom storage adapter for token persistence
timeoutMsnumberNoPer-request timeout in milliseconds. Default 30000; 0 disables

By default, the SDK uses localStorage for token persistence. For server-side or non-browser environments, provide a custom storage adapter:

import { ESPRMBase, ESPRMStorageAdapterInterface } from "@espressif/rainmaker-admin-sdk";
const myStorage: ESPRMStorageAdapterInterface = {
setItem(key: string, value: string): void {
// your implementation
},
getItem(key: string): Promise<string | null> {
// your implementation
},
removeItem(key: string): void {
// your implementation
},
clear(): void {
// your implementation
},
};
ESPRMBase.configure({
baseUrl: "https://api.rainmaker.espressif.com",
customStorageAdapter: myStorage,
});

For smaller bundles, import modules directly via sub-paths:

import { ESPRMBase } from "@espressif/rainmaker-admin-sdk/ESPRMBase";
import { ESPRMAdminNode } from "@espressif/rainmaker-admin-sdk/ESPRMAdminNode";
import { ESPRMAdminOTAImage } from "@espressif/rainmaker-admin-sdk/ESPRMAdminOTAImage";