/** * Tenants Resource * * Provides methods for managing tenants in the platform. * Requires JWT authentication with admin role. */ import type { HttpClient } from '../http/client'; import type { Tenant, TenantSettings, CreateTenantData, UpdateTenantData, UpdateTenantSettingsData } from '../types/tenants'; export declare class TenantsResource { private http; constructor(http: HttpClient); /** * List all tenants * * @returns Array of tenants * * @example * ```typescript * const tenants = await client.tenants.list(); * console.log(`Found ${tenants.length} tenants`); * ``` */ list(): Promise; /** * Get tenant by ID * * @param id - Tenant ID * @returns Tenant object * @throws {NotFoundError} If tenant not found * * @example * ```typescript * const tenant = await client.tenants.get('tenant_123'); * console.log(`Tenant: ${tenant.name}`); * ``` */ get(id: string): Promise; /** * Create a new tenant * * @param data - Tenant creation data * @returns Created tenant * @throws {ValidationError} If validation fails * * @example * ```typescript * const tenant = await client.tenants.create({ * name: 'Acme Corporation' * }); * console.log(`Created tenant ${tenant.id}`); * ``` */ create(data: CreateTenantData): Promise; /** * Update tenant * * @param id - Tenant ID * @param data - Tenant update data * @returns Updated tenant * @throws {NotFoundError} If tenant not found * @throws {ValidationError} If validation fails * * @example * ```typescript * const tenant = await client.tenants.update('tenant_123', { * name: 'Acme Corp (Updated)' * }); * ``` */ update(id: string, data: UpdateTenantData): Promise; /** * Delete tenant * * WARNING: This will permanently delete all tenant data including: * - Devices and sessions * - Messages and event logs * - Users associated with the tenant * - API tokens * - Advanced webhooks * * @param id - Tenant ID * @throws {NotFoundError} If tenant not found * * @example * ```typescript * await client.tenants.delete('tenant_123'); * console.log('Tenant deleted successfully'); * ``` */ delete(id: string): Promise; /** * Get tenant settings (legacy webhook configuration) * * Note: The API only has PUT for settings (upsert). This method calls PUT * with an empty body to retrieve current settings via upsert behavior. * * For new implementations, prefer using the AdvancedWebhook resource * which provides more features like JSONPath filtering, multi-URL delivery, * and comprehensive logging. * * @param tenantId - Tenant ID * @returns Tenant settings * @throws {NotFoundError} If tenant not found * * @example * ```typescript * const settings = await client.tenants.getSettings('tenant_123'); * console.log(`Webhook URL: ${settings.webhookUrl}`); * ``` */ getSettings(tenantId: string): Promise; /** * Update tenant settings (legacy webhook configuration) * * Note: For new implementations, prefer using the AdvancedWebhook resource. * * @param tenantId - Tenant ID * @param data - Settings update data * @returns Updated settings * @throws {NotFoundError} If tenant not found * @throws {ValidationError} If validation fails * * @example * ```typescript * const settings = await client.tenants.updateSettings('tenant_123', { * webhookUrl: 'https://api.example.com/webhook', * webhookSecret: 'my-secret-key', * retryAttempts: 3, * retryBackoffMs: 1000 * }); * ``` */ updateSettings(tenantId: string, data: UpdateTenantSettingsData): Promise; } //# sourceMappingURL=tenants.d.ts.map