@hello.nrfcloud.com/proto
Version:
Documents the communication protocol between the hello.nrfcloud.com backend and the web application
43 lines (42 loc) • 1.41 kB
JavaScript
import { ObjectID, ObjectInstanceID, ObjectVersion, Resources } from '@hello.nrfcloud.com/proto-map/api';
import { Type } from '@sinclair/typebox';
import { Context } from './Context.js';
import { deviceId } from './deviceId.js';
import { IsoDateType } from './IsoDateType.js';
export var SenMLImport = Type.Object({
importId: Type.String({
minLength: 1,
title: 'Import ID',
description: 'The Ulid for the import',
examples: [
'01ARZ3NDEKTSV4RRFFQ69G5FAV'
]
}),
timestamp: IsoDateType('The timestamp when the update was received.'),
success: Type.Boolean({
title: 'Success',
description: 'Whether the processing succeeded.'
}),
senML: Type.Record(Type.String({
minLength: 1
}), Type.Any(), {
title: 'SenML',
description: 'The imported SenML'
}),
lwm2m: Type.Optional(Type.Array(Type.Object({
ObjectID: ObjectID,
ObjectInstanceID: Type.Optional(ObjectInstanceID),
ObjectVersion: Type.Optional(ObjectVersion),
Resources: Resources
})))
});
export var SenMLImports = Type.Object({
'@context': Type.Literal(Context.senMLImports.toString()),
id: deviceId,
imports: Type.Array(SenMLImport, {
minItems: 0
})
}, {
title: 'SenML imports',
description: 'Describes the results of processing the SenML sent by devices.'
});