Skip to main content

Class: VersionProcessor

A processor class for handling version definitions based on the HTTP context. It uses registered version resolvers to determine the current version from the request and updates the version definition accordingly.

Implements​

Constructors​

Constructor​

new VersionProcessor(httpOptions): VersionProcessor

Parameters​

httpOptions​

HttpPluginOptions

Returns​

VersionProcessor

Methods​

process()​

process(version, context): void

Processes the version definition based on the HTTP context. It uses the registered version resolver to determine the current version from the request and updates the version definition accordingly.

Parameters​

version​

VersionDefinition | undefined

The version definition to be processed.

context​

Pick<HttpContext, "request" | "response" | "session">

The HTTP context containing request, response, and session information.

Returns​

void

Implementation of​

Processable.process


registerVersion()​

static registerVersion(type, resolver): void

Registers a version resolver for a specific version type.

Parameters​

type​

VersionType

The version type for which the resolver is registered.

resolver​

VersionResolver

The version resolver to be registered.

Returns​

void