1.0.0 • Published 3 years ago

hateoas-hal-types-test-my v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Typescript types for HAL in HATEOAS

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

It exports the following Types:

TypeDescription
HalLinkhref string
RepresentationModelHalLinks
EntityModelProperties + Rel Links
CollectionModelCollection + MetaData Links
PagedModelCollection Model + PageInfo

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)