Class RsterApiModule<NAME, MODULES, METHODS>

Rster module class. Used to create a module with @rster/builder.

We use type parameters to more specifically index the typing of the module. This allows us to get the correct typing for the native method. From a functional perspective, the type parameters are not needed.

Type Parameters

  • NAME extends string

    The name of the module.

  • MODULES extends {
        [key: string]: RsterApiModule<typeof key, any, any>;
    }

    The modules of the module.

  • METHODS extends {
        [key: string]: AnyRsterApiMethod;
    }

    The methods of the module.

Hierarchy

  • RsterApiModule

Constructors

  • The constructor of the RsterApiModule class.

    Type Parameters

    • NAME extends string

    • MODULES extends {
          [key: string]: RsterApiModule<typeof key, any, any>;
      }

    • METHODS extends {
          [key: string]: AnyRsterApiMethod;
      }

    Parameters

    • name: NAME

      The name of the module.

    • description: string[]

      The description of the module.

    • modules: MODULES

      The modules of the module.

    • methods: METHODS

      The methods of the module.

    • Optional httpPath: string

      The http path of the module. Will be joined with the parent module's path.

    • Optional httpMethod: Method

      The http method of the module.

    Returns RsterApiModule<NAME, MODULES, METHODS>

Properties

description: string[]

The description of the module.

httpMethod?: Method

The http method of the module.

httpPath?: string

The http path of the module. Will be joined with the parent module's path.

methodList: Values<METHODS>

A list of the methods of the module.

methods: METHODS

The methods of the module.

moduleList: Values<MODULES>

A list of the modules of the module.

modules: MODULES

The modules of the module.

name: NAME

The name of the module.

Methods

  • Returns the native representation of the module.

    Returns RemoveNeverProperties<{
        [key in string | number | symbol]: key extends keyof METHODS
            ? ReturnType<MODULES[key]["native"]> & ReturnType<METHODS[key]["native"]>
            : ReturnType<MODULES[key]["native"]>
    }> & RemoveNeverProperties<{
        [key in string | number | symbol]: key extends keyof MODULES
            ? never
            : ReturnType<METHODS[key]["native"]>
    }>

    The native representation of the module.

  • Adds the module to the context.

    Parameters

    • Optional ctx: Context

      The context to add the module to.

    Returns void

    See

    Context

Generated using TypeDoc