Dictionary API
Version: 1.0.0
Status:
Dictionary interface for Thunder framework.
(Defined with IDictionary in IDictionary.h)
Table of Contents
Introduction
Scope
This document describes purpose and functionality of the Dictionary interface (version 1.0.0). It includes detailed specification about its methods provided and notifications sent.
Case Sensitivity
All identifiers of the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.
Acronyms, Abbreviations and Terms
The table below provides and overview of acronyms used in this document and their definitions.
Acronym | Description |
---|---|
API | Application Programming Interface |
HTTP | Hypertext Transfer Protocol |
JSON | JavaScript Object Notation; a data interchange format |
JSON-RPC | A remote procedure call protocol encoded in JSON |
The table below provides and overview of terms and abbreviations used in this document and their definitions.
Term | Description |
---|---|
callsign | The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique. |
References
Ref ID | Description |
---|---|
HTTP | HTTP specification |
JSON-RPC | JSON-RPC 2.0 specification |
JSON | JSON specification |
Thunder | Thunder API Reference |
Description
Dictionary JSON-RPC interface.
This interface uses legacy
lowercase
naming convention. With the next major release the naming convention will change tocamelCase
.
Methods
The following methods are provided by the Dictionary interface:
Dictionary interface methods:
Method | Description |
---|---|
get | Getters for the dictionary |
set | Setters for the dictionary |
pathentries | Get a list of all entries for this namespace (could be keys or nested namespaces) |
get method
Getters for the dictionary.
Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.path | string | mandatory | NameSpace path to be used |
params.key | string | mandatory | Key to be used |
Result
Name | Type | M/O | Description |
---|---|---|---|
result | string | mandatory | Value that was retrieved |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.get",
"params": {
"path": "...",
"key": "..."
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "..."
}
set method
Setters for the dictionary.
Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.path | string | mandatory | NameSpace path to be used |
params.key | string | mandatory | Key to be used |
params.value | string | mandatory | Value to be set |
Result
Name | Type | M/O | Description |
---|---|---|---|
result | null | mandatory | Always null |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.set",
"params": {
"path": "...",
"key": "...",
"value": "..."
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
pathentries method
Get a list of all entries for this namespace (could be keys or nested namespaces).
Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.path | string | mandatory | Namespace path where to get the keys and/or nested namespaces for |
Result
Name | Type | M/O | Description |
---|---|---|---|
result | array | mandatory | Available nested namespaces and keys for this namespace path |
result[#] | object | mandatory | ... |
result[#].name | string | mandatory | Name of Key or Namespace |
result[#].type | string | mandatory | Type (must be one of the following: Namespace, PersistentKey, VolatileKey) |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.pathentries",
"params": {
"path": "..."
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": [
{
"name": "...",
"type": "PersistentKey"
}
]
}
Notifications
Notifications are autonomous events triggered by the internals of the implementation and broadcasted via JSON-RPC to all registered observers. Refer to [Thunder] for information on how to register for a notification.
The following events are provided by the Dictionary interface:
Dictionary interface events:
Notification | Description |
---|---|
modified | Changes on the subscribed namespace |
modified notification
Changes on the subscribed namespace..
Parameters
The path parameter shall be passed within the id parameter to the
register
call, i.e.<path>.<client-id>
.
Notification Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.key | string | mandatory | Key which value changed |
params.value | string | mandatory | Value that changed |
Example
Registration
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.register",
"params": {
"event": "modified",
"id": "abc.myid"
}
}
Notification
{
"jsonrpc": "2.0",
"method": "abc.myid.modified",
"params": {
"key": "...",
"value": "..."
}
}
The client ID parameter is passed within the notification designator, i.e.
<path>.<client-id>.modified
.The path parameter is passed within the notification designator, i.e.
<path>.<client-id>.modified
.