UNPKG

@siren-js/client

Version:
70 lines (69 loc) 2.46 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { ArrayMinSize, IsArray, IsMimeType, IsOptional, IsString } from 'class-validator'; import { IsUri } from '../utils/is-uri'; /** * Represent a sub-entity as a link */ export class EmbeddedLink { /** * List of strings describing the nature of the `Link` based on the current representation. Possible values are * implementation-dependent and should be documented. */ class = []; /** * URI of the linked resource. */ href; /** * List of strings describing the relationship of the `Link` to its `Entity`, per [RFC 8288](https://tools.ietf.org/html/rfc8288). */ rel; /** * Text describing the nature of the link. */ title; /** * Hint indicating what the media type of the result of dereferencing the `Link` should be, per [RFC 8288](https://tools.ietf.org/html/rfc8288#section-3.4.1). */ type; /** * Visits this embedded link. */ async accept(visitor) { await visitor.visitEmbeddedLink(this); } } __decorate([ IsArray(), IsString({ each: true }), IsOptional(), __metadata("design:type", Array) ], EmbeddedLink.prototype, "class", void 0); __decorate([ IsUri(), __metadata("design:type", String) ], EmbeddedLink.prototype, "href", void 0); __decorate([ IsArray(), ArrayMinSize(1), IsString({ each: true }), __metadata("design:type", Array) ], EmbeddedLink.prototype, "rel", void 0); __decorate([ IsString(), IsOptional(), __metadata("design:type", String) ], EmbeddedLink.prototype, "title", void 0); __decorate([ IsMimeType(), IsOptional(), __metadata("design:type", String) ], EmbeddedLink.prototype, "type", void 0);