resource field definitions
new (require("tastypie/fields/api"))(options)
Base field providing generic functionality around value serialization / deserialization
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Mixes In:
- Source:
Example
var x = new tastypie/fields.ApiField();
Requires
- module:events
- module:path
- module:util
- module:mout/lang/isFunction
- module:mout/lang/isString
- module:mout/lang/kindOf
- module:mout/date/strftime
- module:mout/object/get
- module:mout/object/hasOwn
- module:tastypie/lib/class
- module:tastypie/lib/class/options
- module:tastypie/lib/class/parent
Methods
-
<protected> augment(resource, name)
-
Injects dynamic properties onto field instance for later use
Parameters:
Name Type Description resource
Resource the resource instance this field is attached to
name
String The property name this field is associated to
- Source:
-
convert(val)
-
Converts data value into the serialization specific type.
Parameters:
Name Type Description val
Mixed value to convert
- Source:
Returns:
value The converted field value
- Type
- Mixed
-
dehydrate(object, attribute)
-
Converts a javascript object / value into something sutable for seriaation. ex. Date formatting
Parameters:
Name Type Description object
Object Object to dehydrate before serialization
attribute
Sting | function a name path or function to use to retrieve a value from the object
- Source:
Returns:
value object value converted to its internal type
- Type
- Mixed
-
format()
-
returns a sample of the format expected and returned by a field
- Source:
Returns:
The format expected for a particular field type
- Type
- String | undefined
-
hydrate(bundle)
-
Converts a serialized value in to a javascript object value
Parameters:
Name Type Description bundle
Bundle a bundle representing the current request
- Source: