Constants

The SDK comes with a number of constants that can be re-used in implementations. Constants can be found in Stylelabs.M.Sdk in the Constants class.

Structure

The constants class consists of multiple subclasses. These subclasses have the following structure.

There is a class per entity definition (Asset, AssetType, Job, and so on) containing:

  • Definition name

  • Property names

  • Relation names

  • Entity information (values for built-in entities)

Also, there is information about the REST API:

  • The api root path

  • Headers

  • Endpoints

    • Template name

    • Template variables

Extending constants

The constants class can be extended by "wrapping" the default constants.

RequestResponse
using Stylelabs.M.Sdk;

namespace Stylelabs.M.WebSdk.Examples
{
  public static class CustomConstants
  {
    public static class Asset
    {
      public const string DefinitionName = Constants.Asset.DefinitionName;

      public const string CustomProperty = "MyCustomPropertyName";
    }
  }
}

Constants from the SDK constants file can be excluded or included as required. Custom constants can also be added.

Do you have some feedback for us?

If you have suggestions for improving this article,