-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #461 from thingweb/UI-fixes
New TD and TM examples for the new UI
- Loading branch information
Showing
112 changed files
with
4,046 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This Folder contains multiple simple/basic examples of Thing Description as well as its most basic components. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"@context": "https://www.w3.org/2022/wot/td/v1.1", | ||
"id": "urn:uuid:0804d572-cce8-422a-bb7c-4412fcd56f06", | ||
"title": "MyLampThing", | ||
"$title": "Basic TD Example", | ||
"description": "Thing Description for a Lamp thing", | ||
"$description": "This is an example of the most basic form of a td", | ||
"securityDefinitions": { | ||
"basic_sc": {"scheme": "basic", "in": "header"} | ||
}, | ||
"security": "basic_sc", | ||
"properties": { | ||
"status": { | ||
"type": "string", | ||
"forms": [{"href": "https://mylamp.example.com/status"}] | ||
} | ||
}, | ||
"actions": { | ||
"toggle": { | ||
"forms": [{"href": "https://mylamp.example.com/toggle"}] | ||
} | ||
}, | ||
"events": { | ||
"overheating": { | ||
"data": {"type": "string"}, | ||
"forms": [{ | ||
"href": "https://mylamp.example.com/oh", | ||
"subprotocol": "longpoll" | ||
}] | ||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
examples/td/1-simple-default/contentMedia-&-contentEncoding.td.jsonld
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
{ | ||
"@context": "https://www.w3.org/2022/wot/td/v1.1", | ||
"id": "urn:uuid:014139c9-b267-4db5-9c61-cc2d2bfc217d", | ||
"title": "MyCameraThing", | ||
"$title": "contentMedia and contentEncoding TD Example", | ||
"description": "Thing description for a camera thing", | ||
"$description": "In some cases binary data is embedded in text-based values, e.g., a JSON string-based value embeds a base64 encoded image. The terms contentMediaType and contentEncoding can be used to clarify the context and encoding format of such name-value pairs.", | ||
"securityDefinitions": { | ||
"basic_sc": {"scheme": "basic", "in": "header"} | ||
}, | ||
"security": "basic_sc", | ||
"properties": { | ||
"image": { | ||
"description": "Provides latest image", | ||
"type": "string", | ||
"contentMediaType": "image/png", | ||
"contentEncoding": "base64", | ||
"forms": [{ | ||
"op": "readproperty", | ||
"href": "http://camera.example.com/lastPicture", | ||
"cov:methodName": "GET", | ||
"contentType": "application/json" | ||
}] | ||
} | ||
}, | ||
"actions": { | ||
"takePhoto": { | ||
"forms": [{ | ||
"op": "invokeaction", | ||
"href": "http://camera.example.com/snapshot", | ||
"contentType": "application/json" | ||
}] | ||
} | ||
}, | ||
"events": { | ||
"lowMemory": { | ||
"data": {"type": "string"}, | ||
"forms": [{ | ||
"href": "https://mycamera.example.com/oh", | ||
"contentType": "text/plain", | ||
"subprotocol": "longpoll" | ||
}] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"@context": "https://www.w3.org/2022/wot/td/v1.1", | ||
"id": "urn:uuid:014139c9-b267-4db5-9c61-cc2d2bfc217d", | ||
"title": "MyCameraThing", | ||
"$title": "contentType TD Example", | ||
"description": "Thing description for a camera thing", | ||
"$description": "The contentType member is used to assign a media type [RFC2046] including media type parameters as attribute-value pairs separated by a ; character.", | ||
"securityDefinitions": { | ||
"basic_sc": {"scheme": "basic", "in": "header"} | ||
}, | ||
"security": "basic_sc", | ||
"properties": { | ||
"status": { | ||
"type": "string", | ||
"forms": [{ | ||
"href": "https://mycamera.example.com/status", | ||
"contentType": "application/json" | ||
}] | ||
} | ||
}, | ||
"actions": { | ||
"takePhoto": { | ||
"forms": [{ | ||
"op": "invokeaction", | ||
"href": "http://camera.example.com/snapshot", | ||
"contentType": "application/json" | ||
}] | ||
} | ||
}, | ||
"events": { | ||
"lowMemory": { | ||
"data": {"type": "string"}, | ||
"forms": [{ | ||
"href": "https://mycamera.example.com/oh", | ||
"contentType": "text/plain", | ||
"subprotocol": "longpoll" | ||
}] | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"@context": "https://www.w3.org/2022/wot/td/v1.1", | ||
"id": "urn:uuid:014139c9-b267-4db5-9c61-cc2d2bfc217d", | ||
"title": "MyLampThing", | ||
"$title": "All Default Values TD Example", | ||
"description": "TD for a lamp thing", | ||
"$description": "A basic TD with all default values", | ||
"securityDefinitions": { | ||
"basic_sc": { | ||
"scheme": "basic", | ||
"in": "header" | ||
} | ||
}, | ||
"security": "basic_sc", | ||
"properties": { | ||
"status": { | ||
"type": "string", | ||
"readOnly": false, | ||
"writeOnly": false, | ||
"observable": false, | ||
"forms": [{ | ||
"op": [ | ||
"readproperty", | ||
"writeproperty" | ||
], | ||
"href": "https://mylamp.example.com/status", | ||
"contentType": "application/json" | ||
}] | ||
} | ||
}, | ||
"actions": { | ||
"toggle": { | ||
"safe": false, | ||
"idempotent": false, | ||
"forms": [{ | ||
"op": "invokeaction", | ||
"href": "https://mylamp.example.com/toggle", | ||
"contentType": "application/json" | ||
}] | ||
} | ||
}, | ||
"events": { | ||
"overheating": { | ||
"data": { | ||
"type": "string", | ||
"readOnly": false, | ||
"writeOnly": false | ||
}, | ||
"forms": [{ | ||
"op": "subscribeevent", | ||
"href": "https://mylamp.example.com/oh", | ||
"contentType": "application/json", | ||
"subprotocol": "longpoll" | ||
}] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"@context": "https://www.w3.org/2022/wot/td/v1.1", | ||
"id": "urn:uuid:0804d572-cce8-422a-bb7c-4412fcd56f06", | ||
"title": "MyLampThing", | ||
"$title": "Form Serialization TD Example", | ||
"description": "TD for a lamp thing", | ||
"$description": "This is an example for proper form serialization", | ||
"securityDefinitions": { | ||
"basic_sc": {"scheme": "basic", "in": "header"} | ||
}, | ||
"security": "basic_sc", | ||
"properties": { | ||
"brightness": { | ||
"readOnly": true, | ||
"writeOnly": false, | ||
"observable": false, | ||
"forms": [ | ||
{ | ||
"href": "https://mylamp.example.com/brightness", | ||
"contentType": "application/json", | ||
"op": "readproperty" | ||
} | ||
] | ||
} | ||
}, | ||
"actions": { | ||
"toggle": { | ||
"forms": [ | ||
{ | ||
"href": "https://mylamp.example.com/toggle", | ||
"op": "invokeaction", | ||
"contentType": "application/json" | ||
} | ||
] | ||
} | ||
}, | ||
"events": { | ||
"overheating": { | ||
"data": {"type": "string"}, | ||
"forms": [ | ||
{ | ||
"href": "https://mylamp.example.com/oh", | ||
"subprotocol": "longpoll", | ||
"op": "subscribeevent", | ||
"contentType": "application/json" | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"@context": "https://www.w3.org/2022/wot/td/v1.1", | ||
"id": "urn:uuid:0804d572-cce8-422a-bb7c-4412fcd56f06", | ||
"title": "MyLampThing", | ||
"$title": "@context TD Example", | ||
"description": "TD for a lamp thing", | ||
"$description": "A member with the name @context and a value of type string is generally used to identify the TD representation format version defined by this specification.", | ||
"securityDefinitions": { | ||
"basic_sc": {"scheme": "basic", "in": "header"} | ||
}, | ||
"security": "basic_sc", | ||
"properties": { | ||
"status": { | ||
"type": "string", | ||
"forms": [{"href": "https://mylamp.example.com/status"}] | ||
} | ||
}, | ||
"actions": { | ||
"toggle": { | ||
"forms": [{"href": "https://mylamp.example.com/toggle"}] | ||
} | ||
}, | ||
"events": { | ||
"overheating": { | ||
"data": {"type": "string"}, | ||
"forms": [{ | ||
"href": "https://mylamp.example.com/oh", | ||
"subprotocol": "longpoll" | ||
}] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This folder contains examples that show how an interaction affordance can provide additonal metadata as a response. |
59 changes: 59 additions & 0 deletions
59
examples/td/10-response-and-additional-response/additional-responses.td.jsonld
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"@context": "https://www.w3.org/2022/wot/td/v1.1", | ||
"id": "urn:uuid:0804d572-cce8-422a-bb7c-4412fcd56f06", | ||
"title": "MyCarThing", | ||
"$title": "Additional Responses TD Example", | ||
"description": "TD for a Car Thing", | ||
"$description": "The message received from the Thing as part of an Interaction Affordance can differ due to different reasons. Such reasons could be error cases or alternative responses for a valid response. In these cases, additionalResponses terms can be used to describe this behavior.", | ||
"securityDefinitions": { | ||
"basic_sc": {"scheme": "basic", "in": "header"} | ||
}, | ||
"security": "basic_sc", | ||
"schemaDefinitions": { | ||
"actionErrorPayload": { | ||
"type": "object", | ||
"properties": { | ||
"reason": { | ||
"type": "string", | ||
"enum": ["cold","hot","maintenance"] | ||
}, | ||
"timeStamp": { | ||
"description": "UNIX time in numbers indicating when the error happened", | ||
"type": "number" | ||
} | ||
} | ||
} | ||
}, | ||
"properties": { | ||
"status": { | ||
"type": "string", | ||
"forms": [{"href": "https://mycar.example.com/api/status"}] | ||
} | ||
}, | ||
"actions": { | ||
"startEngine": { | ||
"output": { | ||
"type": "string" | ||
}, | ||
"forms": [{ | ||
"op": "invokeaction", | ||
"href": "http://mycar.example.com/api/engine", | ||
"contentType": "application/json", | ||
"additionalResponses": [{ | ||
"success": false, | ||
"contentType": "application/json", | ||
"schema": "actionErrorPayload" | ||
}] | ||
}] | ||
} | ||
}, | ||
"events": { | ||
"overheating": { | ||
"data": {"type": "string"}, | ||
"forms": [{ | ||
"href": "https://mycar.example.com/api/oh", | ||
"subprotocol": "longpoll" | ||
}] | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
examples/td/10-response-and-additional-response/simple-response.td.jsonld
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"@context": "https://www.w3.org/2022/wot/td/v1.1", | ||
"id": "urn:uuid:014139c9-b267-4db5-9c61-cc2d2bfc217d", | ||
"title": "MyCameraThing", | ||
"$title": "Simple Response TD Example", | ||
"description": "TD for a Camera Thing", | ||
"$description": "The Interaction Affordance not only describes the request, but also provides metadata for the expected response. In such cases, the response member is used to indicate the representation format of the response payload. therefore no output schema is required, as the content type fully specifies the representation format.", | ||
"securityDefinitions": { | ||
"basic_sc": {"scheme": "basic", "in": "header"} | ||
}, | ||
"security": "basic_sc", | ||
"properties": { | ||
"status": { | ||
"type": "string", | ||
"forms": [{"href": "https://mycamera.example.com/status"}] | ||
} | ||
}, | ||
"actions": { | ||
"takePhoto": { | ||
"forms": [{ | ||
"op": "invokeaction", | ||
"href": "http://camera.example.com/api/snapshot", | ||
"contentType": "application/json", | ||
"response": { | ||
"contentType": "image/jpeg" | ||
} | ||
}] | ||
} | ||
}, | ||
"events": { | ||
"lowMemory": { | ||
"data": {"type": "string"}, | ||
"forms": [{ | ||
"href": "https://mycamera.example.com/oh", | ||
"subprotocol": "longpoll" | ||
}] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This folder contains examples on how multiple languages as well as reading directions can be implemented on a Thing Description. |
Oops, something went wrong.