Interface InteractionRoute<T>

Routes are used to handle the pathing for API calls.

They can have dynamic values in the paths they support. Typings are used to indicate the keys used to indicate what the corresponding values are.

interface InteractionRoute<T> {
    getPath: ((parameters?: Record<T, string>) => string);
    matchPath: ((path: string) => undefined | Record<T, string>);

Type Parameters

  • T extends string = never

Implemented by



getPath: ((parameters?: Record<T, string>) => string)

Returns the path that is the result of having the specified values for the dynamic parameters.

Will throw an error in case the input parameters object is missing one of the expected keys.

Type declaration

    • (parameters?): string
    • Parameters

      • Optionalparameters: Record<T, string>

        Values for the dynamic parameters.

      Returns string

matchPath: ((path: string) => undefined | Record<T, string>)

Checks if the provided path matches the route (pattern).

The result will be undefined if there is no match.

If there is a match the result object will have the corresponding values for all the parameters.

Type declaration

    • (path): undefined | Record<T, string>
    • Parameters

      • path: string

        The path to verify.

      Returns undefined | Record<T, string>