1.5.0 • Published 6 years ago

@nrfcloud/models v1.5.0

Weekly downloads
90
License
BSD-3-Clause
Repository
github
Last release
6 years ago

Models

npm latest version npm next version Build Status Greenkeeper badge semantic-release Commitizen friendly DeepScan Grade Known Vulnerabilities Maintainability Test Coverage

Contains model definitions for the REST API.

Testing

Install dependencies

npm i

Run the tests

npm test

JSON-LD Entity Definitions

All entities require a 'context' which explicitly types their JSON representation. The version is used to express schema changes per entity. This is inspired by JSON-LD.

ApiIndex

Describes entry points of an API.

{
    "$context": "https://github.com/nRFCloud/models#ApiIndex",
    "$contextVersion": 1,
    "links": [
        {
            "$context": "https://github.com/nRFCloud/models#Link",
            "$contextVersion": 1,
            "href": "https://foo.iot.us-east-1.amazonaws.com",
            "subject": "https://aws.amazon.com/iot-platform/",
            "rel": "production" 
        },
        {
            "$context": "https://github.com/nRFCloud/models#Link",
            "$contextVersion": 1,
            "href": "https://bar.execute-api.us-east-1.amazonaws.com/prod",
            "subject": "https://nrfcloud.com/",
            "rel": "production" 
        }
    ]
}

JSON Schema: ApiIndex.json
Source: ApiIndex.ts

Link

Describes a link.

{
    "$context": "https://github.com/nRFCloud/models#Link",
    "$contextVersion": 1,
    "href": "https://api.nrfcloud.com/stage/custom-cards/foo/some-id",
    "subject": "https://github.com/nRFCloud/models#CustomCard",
    "rel": "next" 
}

JSON Schema: Link.json
Source: Link.ts

Status

Describes the status of the system.

{
    "$context": "https://github.com/nRFCloud/models#Status",
    "$contextVersion": 1,
    "maintenance": false,
    "version": "1.0.0-beta.1",
    "time: "2017-10-02T11:05:46.793Z"
}

JSON Schema: Status.json
Source: Status.ts

List

Describes a list.

{
    "$context": "https://github.com/NordicPlayground/nrfcloud-custom-cards-client#List",
    "$contextVersion": 1,
    items: [
        {
            "$context": "...",
            "$contextVersion": ...,
            ...
        }
    ],
    total: 1,
    links: [
        {
            "$context": "https://github.com/NordicPlayground/nrfcloud-custom-cards-client#Link",
            "$contextVersion": 1,
            "href": "...",
            "subject": "...",
            "rel": "next" 
        }
    ]
}

JSON Schema: Link.json
Source: Link.ts

Errors

HttpProblem

All error responses are expressed using this message format. See https://datatracker.ietf.org/doc/draft-ietf-appsawg-http-problem/.

{
	"$context" : "https://www.ietf.org/id/draft-ietf-appsawg-http-problem-01.txt",
	"$contextVersion" : 1,
	"type" : "https://github.com/nRFCloud/models#EntityNotFoundError",
	"title" : "Entity not found",
	"status" : 404,
	"detail" : "EntityNotFoundError: Custom card \"foo\" does not exist!"
}

JSON Schema: HttpProblem.json
Source: HttpProblem.ts

AccessDeniedError

Thrown if the access to a resource was denied.

BadRequestError

Thrown if the request was malformed.

EntityNotFoundError

Thrown if a requested resource could not be found.

InternalError

Thrown if an unexpected internal error happened.

3.0.1

6 years ago

3.0.0

6 years ago

2.1.5

6 years ago

2.1.4

6 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.5.0

7 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago