Settings client
The SDK provides a Settings client
to provide some extra utilities for retrieving settings.
Settings are entities that can be used with the querying client and the entities client. This client can be useful because it replaces some queries that would otherwise have to be manually written.
The client
variable in the following code examples refers to the IMClient
instance. When using the Web SDK, the variable name can be chosen freely, but it is also called client
at instantiation in the documentation.
Get the category ID
For example, the following snippet gets the id of the PortalConfiguration category:
long? id = await MClient.Settings.GetCategoryIdAsync("PortalConfiguration");
Get a setting
For example, in the PortalConfiguration category, there is a setting named Authentication that can be retrieved using the following method:
IEntity setting = await MClient.Settings.GetSettingAsync("PortalConfiguration", "Authentication");
It is possible to pass an entity load configuration to the client.
Get all the settings for a category
Getting all the settings for a category is also possible. For example, the following snippet gets all the rendition settings:
IList<IEntity> renditionSettings = await MClient.Settings.GetSettingsForCategoryAsync("Renditions");
It is possible to pass an entity load configuration.