Class ModelBase
Represents the base class for most model classes and provides utility methods for converting data from raw response objects into model class instances.
- class ModelBase()
Represents the base class for most model classes such as
Container,DocumentorUser.- param object json:
Raw response object representation from which a model instance is being created. The resulting model class instance will retain all properties of the underlying raw response object. Some data might be re-encoded depending on the model class.
Methods
- ModelBase.updateFromJson(json)
Update this model instance by setting all properties from the given json object.
- param object json:
Raw response object representation from which a model instance is typically being created.
- ModelBase.mapToType(object, type, predicate)
Map the given object to the given model type. For arrays, if a predicate function is provided, only instances passing the predicate filter function are converted; all other instances are omitted.
- param object object:
Source object representing an object or array of objects that are being converted.
- param function type:
Model class constructor function that the given object is converted into.
- param function predicate:
Optional: Predicate function that - if provided - is used to filter objects if an array of objects is provided. Only instances for which the predicate filter function returns
trueare converted; all other instances are omitted.
- ModelBase.parseDate(jsonDate)
Parse c# date format (for example
/Date(1245398693390)/) to Javascript date object. Also understand dates in the formatYYYY-MM-DDTHH:mm:ssZ.- param string jsonDate:
Input date in c# date format when encoding c# DateTime objects as JSON.
- ModelBase.encodeDate(d)
Construct a date string in c# date format (for example
/Date(1245398693390)/) from the given date or ISO string.- param date d:
Javascript date object or string representing a date in ISO format.
- ModelBase.isMinDate(jsonDate)
Returns
true, if the given date in c# format represents the minimum possible date value.
- ModelBase.isMaxDate(jsonDate)
Returns
true, if the given date in c# format represents the maximum possible date value.
- ModelBase.parseDateDisplay(jsonDate)
Format a given date string in c# date format (for example
/Date(1245398693390)/) into the standard date format in a human-readable presentation.- param string jsonDate:
Input date in c# date format when encoding c# DateTime objects as JSON.
- ModelBase.parseDateTimeDisplay(jsonDate)
Format a given date and time string in c# date/time format (for example
/Date(1245398693390)/) into the standard date and time format in a human-readable presentation.- param string jsonDate:
Input date in c# date format when encoding c# DateTime objects as JSON.
- ModelBase.encodeCustomFieldDate(d)
Return the given date encoded in a specific format that is required for custom field data based on the given Javascript date object.
- param date d:
Javascript date object.
- ModelBase.getChoicesDisplay(choices, value)
Returns the display label of the given encoding value based on the given list of choices.
- param array choices:
List of name/value pairs representing possible a list of possible choices - mapping an encoding value to a presentation label.
- param object value:
The encoded value for which the corresponding display label is returned.
- ModelBase.getChoicesAsPairs(choices)
Return the given choices as label/value pairs. The result is an array of objects, where each object encodes the properties
labelandvalue.- param array choices:
List of choices that is converted into a list of name/value pairs.
- ModelBase.toJsonDict(dotnetDictionary)
- Map a c# dictionary encoding via JSON into a plain object literal
(object properties).
- param array dotnetDictionary:
c# dictionary encoding via JSON.
- ModelBase.toBoolOrNull(value)
Parse given value as a boolean (
trueorfalse) ornull. For possible boolean expressions, this method will convert0,1,noandyes(case-insensitive). For all other cases,nullis returned.- param object value:
Input object that is converted into a boolean value.
- ModelBase.getCustomFieldDictionary(customFieldDescription, customFields)
Return a document-level custom field dictionary object (as required by the default JSON encoding of c# Dictionary objects) based on the given custom field values.
- param object customFieldDescription:
Meta information about all document-level custom fields that the system supports.
- param object customFields:
Custom field values.