Nog CLI Developer Guide - v0.10.5
    Preparing search index...
    USAGE_TEMPLATE: "# API Client Usage Guide\n\n> **API:** {{API_TITLE}} v{{API_VERSION}}\n\n> Generated by [nog-cli](https://github.com/geckozr/nog-cli) - NestJS OpenAPI Generator CLI \n> Generated at: {{TIMESTAMP}} \n> nog-cli version: {{NOGCLI_VERSION}}\n\nThis directory contains the auto-generated NestJS HTTP client for your OpenAPI specification.\n\n## Quick Start\n\n### Installation\n\nInstall the required peer dependencies in your NestJS project:\n\n```bash\nnpm install @nestjs/common @nestjs/axios axios rxjs class-validator class-transformer\n```\n\nThese files are ready to be imported directly into your NestJS application.\n\n## Usage\n\n### 1. Import the ApiModule in your app module\n\n**⚠️ IMPORTANT:** You MUST use `.forRoot()` to import the module, not just `ApiModule` alone.\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { ApiModule } from './api-client/api.module';\n\n@Module({\n imports: [\n // ✅ CORRECT - Use forRoot() with configuration\n ApiModule.forRoot({\n baseUrl: 'https://api.example.com',\n headers: {\n 'X-Api-Key': 'your-api-key',\n },\n }),\n ],\n})\nexport class AppModule {}\n```\n\n**❌ Common Mistake:** Don't import like this:\n```typescript\n@Module({\n imports: [ApiModule], // ❌ WRONG - Missing .forRoot()\n})\n```\n\nThis will cause dependency injection errors like:\n```\nError: Nest can't resolve dependencies of the YourService (?)\n```\n\n### 2. Inject services in your controllers/services\n\n```typescript\nimport { Injectable } from '@nestjs/common';\nimport { {{FIRST_SERVICE}} } from './api-client/services/{{FIRST_SERVICE_FILE}}.service';\n\n@Injectable()\nexport class MyService {\n constructor(private readonly {{FIRST_SERVICE_CAMEL}}: {{FIRST_SERVICE}}) {}\n\n async example() {\n // Use the service methods\n const result = await this.{{FIRST_SERVICE_CAMEL}}.someMethod();\n return result;\n }\n}\n```\n\n### 3. Passing query parameters\n\nMethods with query parameters use an inline object type for better DX:\n\n```typescript\n// ✅ Only pass the parameters you need\nconst users = await usersService.searchUsers({\n fields: ['id', 'name', 'email'],\n groups: ['members'],\n pageSize: 20,\n});\n\n// ✅ Parameters are optional - pass none if you want defaults\nconst allUsers = await usersService.searchUsers();\n\n// ✅ IDE autocomplete and JSDoc for each parameter\nconst results = await usersService.searchUsers({\n keywords: 'john', // <- Hover for description\n orderBy: 'createdAt', // <- Type-safe enum values\n});\n```\n\n## Configuration Options\n\nThe `ApiModuleConfig` interface accepts:\n\n- `baseUrl` (required): Base URL for all API requests\n- `headers` (optional): Default headers included in all requests\n- `httpOptions` (optional): Additional Axios configuration options\n\n## Error Handling\n\nThe generated services throw `ApiException<T>` for HTTP errors, where `T` is the typed error response from your OpenAPI spec:\n\n```typescript\nimport { ApiException } from './api-client/api.exception';\nimport { UnauthorizedError } from './api-client/models/UnauthorizedError';\nimport { NotFoundError } from './api-client/models/NotFoundError';\n\ntry {\n const result = await {{FIRST_SERVICE_CAMEL}}.getCurrentAuth();\n} catch (error) {\n if (error instanceof ApiException) {\n console.log('Status:', error.status);\n console.log('Error data:', error.data);\n\n // Use helper methods for cleaner code\n if (error.hasStatus(401)) {\n const unauthorizedError = error.data as UnauthorizedError;\n console.log('Error code:', unauthorizedError.code);\n }\n\n if (error.hasStatus(404)) {\n const notFoundError = error.data as NotFoundError;\n console.log('Entity type:', notFoundError.entityType);\n }\n\n // Or use the is() helper to check and cast in one step\n if (error.is<UnauthorizedError>(401)) {\n console.log('Unauthorized:', error.data.code);\n }\n }\n}\n```\n\n### ApiException Helper Methods\n\n- `hasStatus(status)` - Check if the exception has a specific HTTP status code\n- `is<T>(status)` - Type guard that checks status and narrows the type of `data` to `T`\n\n```typescript\n// hasStatus() - simple status check\nif (error.hasStatus(401, 403)) {\n console.log('Authentication or authorization error');\n}\n\n// is<T>() - status check with type narrowing\nif (error.is<NotFoundError>(404)) {\n // error.data is now typed as NotFoundError\n console.log('Entity not found:', error.data.entityType);\n}\n```\n\n### Using with NestJS Exception Filters\n\nYou can create a global filter to convert `ApiException` to NestJS exceptions:\n\n```typescript\nimport { ExceptionFilter, Catch, ArgumentsHost, HttpException } from '@nestjs/common';\nimport { ApiException } from './api-client/api.exception';\n\n@Catch(ApiException)\nexport class ApiExceptionFilter implements ExceptionFilter {\n catch(exception: ApiException, host: ArgumentsHost) {\n const ctx = host.switchToHttp();\n const response = ctx.getResponse();\n\n response.status(exception.status).json({\n statusCode: exception.status,\n message: exception.message,\n error: exception.data,\n });\n }\n}\n```\n\n## Available Services\n\nThe following services are available based on your OpenAPI tags:\n\n{{SERVICES_LIST}}\n\nCheck the individual service files for available methods.\n\n---\n\n## About nog-cli\n\nThis client was generated using **nog-cli** (NestJS OpenAPI Generator CLI).\n\n- 🔗 **GitHub**: [github.com/geckozr/nog-cli](https://github.com/geckozr/nog-cli)\n- 📦 **npm**: [npmjs.com/package/@gecko_zr/nog-cli](https://www.npmjs.com/package/@gecko_zr/nog-cli)\n- 🐛 **Issues**: [Report a bug](https://github.com/geckozr/nog-cli/issues)\n- ❤️ **Sponsor**: [Support this project](https://github.com/sponsors/geckozr)\n\n### Generate your own SDK\n\n```bash\n# Use without installing\nnpx @gecko_zr/nog-cli generate ./your-openapi.json -o ./generated\n\n# Or install globally\nnpm install -g @gecko_zr/nog-cli\nnog-cli generate ./your-openapi.json -o ./generated\n```\n" = ...

    USAGE.md template for generated SDK documentation. This template contains placeholder variables that will be replaced during generation.