Creates a new TenantOS API client instance
The constructor validates the provided configuration, sets up the HTTP client with appropriate defaults, configures request/response interceptors, and initializes all resource instances for API operations.
Client configuration including base URL, API key, and options
ReadonlyaliasReadonlyaliasReadonlybrandsReadonlyexternalReadonlyfilesReadonlyinventoryReadonlyipReadonlynetworkReadonlyosReadonlypxeReadonlypxeReadonlypxeReadonlypxeReadonlyrdnsReadonlyremoteReadonlyrolesReadonlysearchReadonlyserversReadonlysubnetsReadonlysystemReadonlytasksReadonlyusersReadonlyvpsGet the client configuration (readonly)
Returns a readonly copy of the client configuration that was provided during client initialization. This can be useful for debugging or logging purposes.
Readonly copy of the client configuration
Get available system timezones
Retrieves a list of all available timezones that can be used for system configuration and scheduling operations.
Promise that resolves to an array of timezone strings
Get system version information
Retrieves version information about the TenantOS system, including the current software version and build information.
Promise that resolves to system version information
Test API connectivity and authentication
Performs a simple ping request to verify that the client can successfully connect to the TenantOS API and that the provided authentication credentials are valid.
Promise that resolves to true if connection is successful, false otherwise
Make a raw request to the API with automatic retry logic
This is the core method that handles all HTTP requests to the TenantOS API. It includes automatic retry logic for transient failures, comprehensive error handling, and request/response logging when debug mode is enabled.
The method will automatically retry requests that fail due to:
The expected type of the response data
Request configuration including method, URL, data, and parameters
Promise that resolves to the API response
// Make a GET request
const response = await client.request<Server>({
method: 'GET',
url: '/api/servers/123'
});
// Make a POST request with data
const response = await client.request<Server>({
method: 'POST',
url: '/api/servers',
data: {
hostname: 'new-server.example.com',
servername: 'New Server'
}
});
Main TenantOS API client with comprehensive error handling and retry logic
The TenantosClient class is the primary entry point for interacting with the TenantOS API. It provides a unified interface for all API operations, including server management, network device configuration, user administration, and system monitoring.
Features:
Example: Basic Usage
Example: Advanced Configuration
Example: Error Handling