1
>
/*---------------------------------------------------------------------------------------------
uriTemplate.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
export interface IUriTemplateVariable {
7
>
readonly explodable: boolean;
8
>
readonly name: string;
9
>
readonly optional: boolean;
10
>
readonly prefixLength?: number;
11
>
readonly repeatable: boolean;
12
>
}
13
>
14
>
interface IUriTemplateComponent {
15
>
readonly expression: string;
16
>
readonly operator: string;
17
>
readonly variables: readonly IUriTemplateVariable[];
18
>
}
19
>
20
>
/**
21
>
* Represents an RFC 6570 URI Template.
22
>
*/
23
>
export class UriTemplate {
24
>
/**
25
>
* The parsed template components (expressions).
26
>
*/
27
>
public readonly components: ReadonlyArray<IUriTemplateComponent | string>;
28
>
29
>
private constructor(
30
public readonly template: string,
31
components: ReadonlyArray<IUriTemplateComponent | string>