Nog CLI Developer Guide - v0.10.5
    Preparing search index...

    Generates NestJS service classes with dual HTTP transport methods.

    Dual Method Strategy:

    • Observable Method (suffix $): Issues raw HTTP calls via HttpService, returns Observable<T>.
    • Promise Method: Wraps the Observable sibling using firstValueFrom(), returns Promise<T> for convenience.

    Both methods share the same URL construction, parameter binding, and error handling logic; the Promise variant simply adapts the Observable for async/await patterns.

    Each service includes:

    • Dependency injection of HttpService via constructor.
    • Type-safe operation methods derived from OpenAPI operationIds.
    • JSDoc descriptions from OpenAPI operation summaries.
    • Standard file header with generation metadata.
    Index

    Constructors

    Methods

    Constructors

    • Instantiates the service writer.

      Parameters

      • project: Project

        The ts-morph Project instance for AST manipulation.

      • outputDir: string

        The target directory where service files will be written.

      • allModels: IrModel[] = []

        The complete list of IR models (used for type resolution in method signatures).

      • specTitle: string = 'Unknown Spec'

        The OpenAPI specification title for file header metadata.

      • specVersion: string = 'Unknown Version'

        The OpenAPI specification version for file header metadata.

      Returns ServiceWriter

    Methods

    • Generates all service files based on the provided services list.

      Parameters

      • services: IrService[]

        List of services to generate.

      Returns Promise<void>

      Promise resolving when every service file has been written.