UNPKG

1.64 kBTypeScriptView Raw
1import { VersioningType } from '../enums/version-type.enum';
2/**
3 * Indicates that this will work for any version passed in the request, or no version.
4 *
5 * @publicApi
6 */
7export declare const VERSION_NEUTRAL: unique symbol;
8export declare type VersionValue = string | string[] | typeof VERSION_NEUTRAL;
9/**
10 * @publicApi
11 */
12export interface VersionOptions {
13 /**
14 * Specifies an optional API Version. When configured, methods
15 * withing the controller will only be routed if the request version
16 * matches the specified value.
17 *
18 * Supported only by HTTP-based applications (does not apply to non-HTTP microservices).
19 *
20 * @see [Versioning](https://docs.nestjs.com/techniques/versioning)
21 */
22 version?: VersionValue;
23}
24export interface HeaderVersioningOptions {
25 type: VersioningType.HEADER;
26 /**
27 * The name of the Request Header that contains the version.
28 */
29 header: string;
30}
31export interface UriVersioningOptions {
32 type: VersioningType.URI;
33 /**
34 * Optional prefix that will prepend the version within the URI.
35 *
36 * Defaults to `v`.
37 *
38 * Ex. Assuming a version of `1`, for `/api/v1/route`, `v` is the prefix.
39 */
40 prefix?: string | false;
41}
42export interface MediaTypeVersioningOptions {
43 type: VersioningType.MEDIA_TYPE;
44 /**
45 * The key within the Media Type Header to determine the version from.
46 *
47 * Ex. For `application/json;v=1`, the key is `v=`.
48 */
49 key: string;
50}
51/**
52 * @publicApi
53 */
54export declare type VersioningOptions = HeaderVersioningOptions | UriVersioningOptions | MediaTypeVersioningOptions;