@readium/shared
Version:
Shared models to be used across other Readium projects and implementations in Typescript
25 lines (24 loc) • 790 B
TypeScript
/** A lightweight implementation of URI Template (RFC 6570).
*
* Only handles simple cases, fitting Readium's use cases.
* See https://tools.ietf.org/html/rfc6570
*/
export declare class URITemplate {
uri: string;
/**
* List of URI template parameter keys, if the [Link] is templated.
*/
parameters: Set<string>;
constructor(uri: string);
/**
* List of URI template parameter keys, if the [Link] is templated.
*/
private getParameters;
/** Expands the URI by replacing the template variables by the given parameters.
* Any extra parameter is appended as query parameters.
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
*/
expand(parameters: {
[param: string]: string;
}): string;
}