Every server extension defines a set of configuration data
in its *.Schema.json file.
The "ComplexConfig" sample extension is a server extension
with relatively complex configuration data.
Additionally, the configuration data can be viewed/edited via
the server configuration page.
If you want to learn about JSON schema and how to use
(recursive) definitions, this is a good starting point.
The extension uses the "RequestListener" interface to provide
functions to interact with the configuration data.
The implementations of the ComplexConfig.MarkAsDone and
ComplexConfig.CreateReport function symbols
showcase the usage of the GetConfigValue, ReplaceConfigValue
and RenameConfigValue functions that are used by almost
all server extensions.
First steps:
-
Read all data from the "Garden" project.
Request:
{ "requestType": "ReadWrite", "commands": [ { "symbol": "ComplexConfig.Config::projects::Garden", "commandOptions": [ "SendErrorMessage" ] } ] }Response:
{ "requestType": "ReadWrite", "commands": [ { "symbol": "ComplexConfig.Config::projects::Garden", "readValue": { "done": [], "reports": [], "todo": [ { "name": "Mow the lawn" }, { "name": "Plant trees", "notes": [ { "children": [ { "text": "Oak" }, { "text": "Maple" } ], "text": "Species" } ] } ] } } ] } -
Move a
todolist item to thedonelist using theComplexConfig.MarkAsDonefunction symbol.Request:
{ "requestType": "ReadWrite", "commands": [ { "symbol": "ComplexConfig.MarkAsDone", "writeValue": { "project": "Garden", "index": 1 }, "commandOptions": [ "SendErrorMessage" ] } ] }Response:
{ "requestType": "ReadWrite", "commands": [ { "symbol": "ComplexConfig.MarkAsDone" } ] } -
Add a summary of all the items from the
donelist to thereportsarray. Then clear thedonearray. We do this by calling theComplexConfig.CreateReportfunction symbol.Request:
{ "requestType": "ReadWrite", "commands": [ { "symbol": "ComplexConfig.CreateReport", "writeValue": { "project": "Garden" }, "commandOptions": [ "SendErrorMessage" ] } ] }Response:
{ "requestType": "ReadWrite", "commands": [ { "symbol": "ComplexConfig.CreateReport" } ] } -
Read all data from the "Garden" project after calling
ComplexConfig.MarkAsDoneandComplexConfig.CreateReport.Request:
{ "requestType": "ReadWrite", "commands": [ { "symbol": "ComplexConfig.Config::projects::Garden", "commandOptions": [ "SendErrorMessage" ] } ] }Response:
{ "requestType": "ReadWrite", "commands": [ { "symbol": "ComplexConfig.Config::projects::Garden", "readValue": { "done": [], "reports": [ "# Done in the week of Monday, February 20, 2023\r\n1. Plant trees\r\n - Species\r\n - Oak\r\n - Maple\r\n" ], "todo": [ { "name": "Mow the lawn" } ] } } ] }