import { DynamicModule } from '@nestjs/common'; import { HttpClientConfig } from './interfaces/http-client-config.interface'; /** * HTTP客户端模块 * 类似Spring Boot的自动配置机制,集成现有的cache服务 * * @example * // 最简单的方式 - 使用所有默认配置 * HttpClientModule.forRoot() * * @example * // 只覆盖部分配置 * HttpClientModule.forRoot({ * baseURL: 'https://api.example.com', * timeout: 5000, * }) * * @example * // 深度合并配置 * HttpClientModule.forRoot({ * logging: { * logLevel: 'debug', * // 其他 logging 配置会使用默认值 * }, * }) */ export declare class HttpClientModule { /** * 动态注册HTTP客户端模块 * @param config 用户配置,所有字段都是可选的 * @returns DynamicModule */ static forRoot(config?: Partial): DynamicModule; /** * 异步注册HTTP客户端模块 * @param config 异步配置,所有字段都是可选的 * @returns DynamicModule * * @example * HttpClientModule.forRootAsync({ * useFactory: (configService: ConfigService) => ({ * baseURL: configService.get('API_BASE_URL'), * timeout: 5000, * }), * inject: [ConfigService], * }) */ static forRootAsync(config: { useFactory: (...args: any[]) => Promise> | Partial; inject?: any[]; imports?: any[]; }): DynamicModule; /** * 安全地从环境变量解析整数 * @param configService NestJS ConfigService * @param key 环境变量键 * @param defaultValue 默认值 * @returns 解析后的数字或默认值 */ private static parseEnvInt; private static parseEnvBoolean; /** * 从环境变量加载配置 */ private static loadConfigFromEnvironment; }