///
///
import { ApiClient } from './client';
import { Auth } from './auth';
import { Devices } from './devices';
import { DeviceLogs } from './device_logs';
import { Memberships } from './memberships';
import { Parkings } from './parkings';
import { ParkingAreas } from './parking_areas';
import { Payments } from './payments';
import { Invoices } from './invoices';
import { Users } from './users';
import { Tenants } from './tenants';
import { System } from './system';
import { ClientConfig, Environment, LogLevel, ParkingStatus, DeviceFilters, EntityStatus, DeviceLogFilters } from './types';
import { logger } from './logger';
import * as testUtils from './test-utils';
export { ClientConfig, Environment, ParkingStatus, ApiResponse, ErrorResponse, AuthCredentials, AuthToken, TokenResponse, Device, DeviceLocationSearchResponse, DeviceParkingAreaAssignParams, DeviceParkingAreaAssociation, UpdateDeviceRequest, Webhook, WebhookCreateParams, WebhookUpdateParams, PaginationParams, PaginatedResponse, RateLimitInfo, Parking, ParkingCreateParams, ParkingUpdateParams, ParkingFilters, ParkingArea, ParkingAreaDeviceAssignment, ParkingAreaCreateParams, ParkingAreaUpdateParams, ParkingAreaFilters, ParkingAreaListResponse, ParkingAreaQueryParams, ParkingAreaType, CreateParkingAreaDevice, UserRole, UserStatus, User, UserDevice, UserPublic, UserRegisterParams, UserUpdateParams, UserPasswordUpdateParams, UserLoginParams, UserFilters, UserListResponse, LoginResponse, OtpRequestParams, OtpVerifyParams, ApiKeyCreateParams, Tenant, TenantCreateParams, TenantUpdateParams, TenantFilters, TenantListResponse, TenantUserAssignParams, Method, RequestOptions, EntityStatus, TerminalType, DeviceLog, DeviceLogFilters, Pagination as DeviceLogPagination, DeviceLogListResponse, DeviceAnalytics, DeviceAnalyticsParams, DeviceLogCount, DeviceLogCountParams, DeviceLogCleanupParams, DeviceLogCleanupResponse, Payment, PaymentType, PaymentStatus, PaymentFilters, PaymentListResponse, Invoice, InvoiceStatus, InvoiceSummaryUser, InvoiceItem, InvoiceFilters, InvoiceCreateParams, InvoiceUpdateParams, InvoiceListResponse, BalanceTransaction, BalanceTransactionFilters, BalanceTransactionListResponse, LicensePlate, LicensePlateCreateParams, LicensePlateListResponse, Membership, MembershipCreateParams, MembershipUpdateParams, MembershipSubscription, MembershipFilters, MembershipDevice, QrDataInfo, QrDataCreateParams, QrDataBulkCreateParams, QrDataAssignParams, QrDataBulkAssignParams, QrDataValidationResult, DeviceQrSummary, QrDataFilters } from './types';
export { ApiError, NetworkError, AuthenticationError, ValidationError, TokenExpiredError, RateLimitError, ConfigurationError, createStandardError, ErrorContext, ErrorCodes } from './errors';
export { Logger, LogLevel } from './logger';
export { logger };
export { testUtils };
/**
* Main client class for the LetsParky API v2.
*
* This is the primary entry point for interacting with the LetsParky API.
* It provides a unified interface that combines all API functionality including
* device management, parking operations, user management, tenant operations,
* and authentication.
*
* The client automatically handles:
* - Authentication and token management
* - Rate limiting and retries
* - Error handling and logging
* - Environment-specific configuration
*
* @example
* ```typescript
* // Basic usage with API key
* const client = new LetsParkyClient({
* apiKey: 'your-api-key',
* environment: Environment.PRODUCTION
* });
*
* // Usage with email/password
* const client = new LetsParkyClient({
* email: 'your-email',
* password: 'your-password',
* environment: Environment.STAGING
* });
*
* // Access specific functionality
* const devices = await client.listDevices();
* const parkings = await client.listParkings();
* const profile = await client.getProfile();
*
* // Or use the specialized clients directly
* const newDevice = await client.devices.create({
* name: 'Sensor 1',
* type: 'ultrasonic'
* });
* ```
*
* @since 1.0.0
*/
export declare class LetsParkyClient {
client: ApiClient;
auth: Auth;
devices: Devices;
deviceLogs: DeviceLogs;
memberships: Memberships;
parkings: Parkings;
parkingAreas: ParkingAreas;
payments: Payments;
invoices: Invoices;
users: Users;
tenants: Tenants;
system: System;
/**
* Creates a new LetsParkyClient instance.
*
* @param config - Configuration options for the client
* @param config.apiKey - API key for authentication (alternative to email/password)
* @param config.baseUrl - Custom base URL for the API (overrides environment-based URL)
* @param config.timeout - Request timeout in milliseconds (default: 30000)
* @param config.email - Email for authentication (requires password)
* @param config.password - Password for authentication (requires email)
* @param config.environment - Target environment (default: PRODUCTION)
* @param config.logLevel - Logging level (default: INFO)
* @param config.silentLogs - Disable all logging (default: false)
* @param config.useHttps - Force HTTPS usage (default: false, auto-enabled for production)
* @param config.acceptSelfSigned - Accept self-signed certificates in development (default: false)
* @param config.rateLimitRetryCount - Number of retries when rate limited (default: 3)
* @param config.rateLimitRetryDelay - Base delay between retries in milliseconds (default: 1000)
*
* @example
* ```typescript
* // Production client with API key
* const client = new LetsParkyClient({
* apiKey: 'pk_live_...',
* environment: Environment.PRODUCTION,
* logLevel: LogLevel.WARN
* });
*
* // Development client with credentials
* const devClient = new LetsParkyClient({
* email: 'dev-user',
* password: 'dev-password',
* environment: Environment.DEVELOPMENT,
* useHttps: false,
* acceptSelfSigned: true,
* logLevel: LogLevel.DEBUG
* });
* ```
*
* @throws {ConfigurationError} When invalid configuration is provided
* @throws {AuthenticationError} When automatic authentication fails (if email/password provided)
*
* @since 1.0.0
*/
constructor(config?: ClientConfig);
/**
* Sets the target environment for the client.
*
* This method changes the environment and automatically updates the base URL
* to match the selected environment. It also propagates the environment
* setting to validators and other components.
*
* @param environment - The target environment
*
* @example
* ```typescript
* const client = new LetsParkyClient();
*
* // Switch to development for testing
* client.setEnvironment(Environment.DEVELOPMENT);
*
* // Switch to production
* client.setEnvironment(Environment.PRODUCTION);
* ```
*
* @since 1.0.0
*/
setEnvironment(environment: Environment): void;
/**
* Sets the logging level for the client.
*
* This controls the verbosity of log output from the client and all
* its components. Higher levels include all lower levels.
*
* @param level - The logging level to set
*
* @example
* ```typescript
* const client = new LetsParkyClient();
*
* // Enable debug logging for development
* client.setLogLevel(LogLevel.DEBUG);
*
* // Only show errors in production
* client.setLogLevel(LogLevel.ERROR);
* ```
*
* @since 1.0.0
*/
setLogLevel(level: LogLevel): void;
/**
* Authenticates the client using configured email and password.
*
* This is a convenience method that delegates to the underlying client's
* authenticate method. The client must have been configured with email
* and password for this to work.
*
* @returns Promise that resolves when authentication is successful
*
* @throws {AuthenticationError} When email/password are missing or authentication fails
* @throws {NetworkError} When the request fails due to network issues
*
* @example
* ```typescript
* const client = new LetsParkyClient({
* email: 'your-email',
* password: 'your-password'
* });
*
* try {
* await client.authenticate();
* console.log('Successfully authenticated');
* } catch (error) {
* console.error('Authentication failed:', error.message);
* }
* ```
*
* @since 1.0.0
*/
authenticate(): Promise;
/**
* Retrieves a list of all devices.
*
* This is a convenience method that delegates to the devices client.
* For more advanced device operations, use the `devices` property directly.
*
* @returns Promise resolving to an array of devices
*
* @throws {AuthenticationError} When authentication is required or fails
* @throws {ApiError} When the API returns an error response
* @throws {NetworkError} When the request fails due to network issues
*
* @example
* ```typescript
* const client = new LetsParkyClient({ apiKey: 'your-api-key' });
*
* const devices = await client.listDevices();
* console.log(`Found ${devices.length} devices`);
*
* devices.forEach(device => {
* console.log(`- ${device.name} (${device.type})`);
* });
* ```
*
* @since 1.0.0
*/
listDevices(): Promise;
/**
* Get current rate limit information
*/
getRateLimitInfo(): import("./types").RateLimitInfo | null;
/**
* List all devices with pagination
* @param page Page number (starting from 1)
* @param limit Items per page
* @param filters Optional filters
*/
listDevicesPaginated(page?: number, limit?: number, filters?: DeviceFilters): Promise;
/**
* List all parkings
* @param filters Optional filter parameters for parkings
*/
listParkings(filters?: {
status?: ParkingStatus | ParkingStatus[];
device_id?: string;
user_id?: string;
page?: number;
limit?: number;
}): Promise;
/**
* Get user profile
* Convenience method that delegates to auth.getProfile()
*/
getProfile(): Promise;
/**
* List all tenants (SYSTEM only)
* @param filters Optional filter parameters for tenants
* Convenience method that delegates to tenants.list()
*/
listTenants(filters?: {
name?: string;
status?: EntityStatus | EntityStatus[];
page?: number;
limit?: number;
}): Promise;
/**
* Check if the API endpoint is responding
* Useful for verifying connectivity before running tests
* @returns Promise that resolves to true if the API is online, false otherwise
*/
isApiOnline(): Promise;
/**
* Get device logs with optional filtering
* Convenience method that delegates to deviceLogs.list()
* @param filters Optional filter parameters for device logs
*/
getDeviceLogs(filters?: {
device_id?: string;
device_ids?: string[];
status?: string[];
blocked?: boolean;
has_alarm?: boolean;
start_time?: string;
end_time?: string;
limit?: number;
offset?: number;
}): Promise;
/**
* Get analytics for a specific device
* Convenience method that delegates to deviceLogs.getAnalytics()
* @param device_id The device ID to get analytics for
* @param params Optional time range parameters
*/
getDeviceAnalytics(device_id: string, params?: {
start_time?: string;
end_time?: string;
}): Promise;
/**
* Get the latest log for a specific device
* Convenience method that delegates to deviceLogs.getLatest()
* @param device_id The device ID to get the latest log for
*/
getLatestDeviceLog(device_id: string): Promise;
/**
* Download device logs as an Excel file.
* In browser contexts this will prompt the user with a file download dialog.
* In Node.js it resolves with a Buffer containing the file contents.
*
* @param filters Optional filter parameters (same as getDeviceLogs)
*/
downloadDeviceLogs(filters?: DeviceLogFilters & {
limit?: number;
}): Promise;
}
export default LetsParkyClient;