hateoas-hal-types
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Typescript types for HAL in HATEOAS

This repository exports a set of typescript types for HAL in HATEOAS.

It exports the following Types:

Type Description
HalLink href string
RepresentationModel HalLinks
EntityModel Properties + Rel Links
CollectionModel Entity Collection + MetaData Links
PagedModel Entity Collection + PageInfo + PageLink

Example

type Foo = {
    A:string
    B:HalLink
}

// Helper to build HalModel
const test: EntityModel<Foo> = {
    A:"abc",
    _links:{
     self: {href: "https://self.self"}
        B: {href: "https://test.test"}
    }
}

// Helper to access HalModel
console.log(test.A)
console.log(test._links.B.href)

Package Sidebar

Install

npm i hateoas-hal-types

Weekly Downloads

10

Version

1.0.1

License

MIT

Unpacked Size

4.34 kB

Total Files

5

Last publish

Collaborators

  • jyk0128