Class RsterApi<NAME, MODULES, METHODS>

Rster api class. Used to create an api with @rster/builder.

We use type parameters to more specifically index the typing of the api. 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 api.

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

    The modules of the api.

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

    The methods of the api.

Hierarchy

  • RsterApi

Constructors

  • The constructor of the RsterApi class.

    Type Parameters

    • NAME extends string

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

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

    Parameters

    • name: NAME

      The name of the api.

    • description: string[]

      The description of the api.

    • modules: MODULES

      The modules of the api.

    • methods: METHODS

      The methods of the api.

    Returns RsterApi<NAME, MODULES, METHODS>

Properties

description: string[]

The description of the api.

methodList: Values<METHODS>

A list of the methods of the api.

methods: METHODS

The methods of the api.

moduleList: Values<MODULES>

A list of the modules of the api.

modules: MODULES

The modules of the api.

name: NAME

The name of the api.

Methods

  • Returns the api as a native object. This is userful if you want to use the api definition as functions on your server-side, so you don't have to define the functionality in another place

    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"]>
    }>

  • Returns the api as a restful api. RestfulApi

    Returns RestfulApi

    See

    RestfulApi

Generated using TypeDoc