/// <summary> /// Returns a JSON representation of this instance. /// </summary> /// <returns>JObject</returns> public SetType(dynamic data) : base((object)data) { if (data == null) { return; } this.ElementType = AttributeTypeFactory.Create(data.elementType); }
/// <summary> /// Initializes this instance with JSON data from an API response. /// </summary> /// <param name="data">JSON object</param> public AttributeDefinition(dynamic data) { if (data == null) { return; } AttributeConstraint attributeConstraint; TextInputHint inputHint; string attributeConstraintStr = (data.attributeConstraint != null ? data.attributeConstraint.ToString() : string.Empty); string inputHintStr = (data.inputHint != null ? data.inputHint.ToString() : string.Empty); this.Type = AttributeTypeFactory.Create(data.type); this.Name = data.name; this.Label = new LocalizedString(data.label); this.InputTip = new LocalizedString(data.inputTip); this.IsRequired = data.isRequired; this.AttributeConstraint = Enum.TryParse(attributeConstraintStr, out attributeConstraint) ? (AttributeConstraint?)attributeConstraint : null; this.InputHint = Enum.TryParse(inputHintStr, out inputHint) ? (TextInputHint?)inputHint : null; this.IsSearchable = data.isSearchable; }