-
addReferenceToObj
-
Explicitly add a FatFractal 'reference to another object' to this object. For example, addReferenceToObj(user.ffUrl, "ffUser", profile)
will add a reference to the 'user' object to the 'profile' object.
Parameters:
| Name |
Type |
Description |
ffUrl |
String
|
the referenced object's ffUrl |
refName |
String
|
the name we are giving to this reference relationship |
obj |
Object
|
the object to which we are adding the reference |
- Source:
-
createObjAtUri
-
A CRUD CREATE method that will attempt to create a new resource on the your apps backend at the
relativeUrl location. Returns the object, or null in the event of a failure.
Parameters:
| Name |
Type |
Description |
data |
Object
|
The instance of any arbitrary class object to be created and persisted on the your apps backend. |
relativeUrl |
String
|
is the url for this resource relative to your applications base HREF. |
- Source:
Returns:
the returned object from the your apps backend.
-
Type
-
objectWithMetadata
Example
createdMyStuff = ff.createObjAtUrl(myStuff, "/Furniture");
-
deleteObj
-
A CRUD DELETE method that will attempt to delete an existing resource from the your apps backend.The object
must have previously been retrieved or created via the FF API.
Parameters:
| Name |
Type |
Description |
obj |
object
|
The instance of any arbitrary class object to be deleted from the your apps backend. |
- Source:
Example
ff.deleteObj(currentTopCeleb);
-
deleteObjAtUri
-
A CRUD DELETE method that will attempt to delete an existing resource from the your apps backend when
passed in the url location for the object.The object must have previously been retrieved or created via
the FF API.
Parameters:
| Name |
Type |
Description |
ffUrl |
Object
|
The ffUrl of the object to be deleted from the your apps backend. |
- Source:
Example
ff.deleteObjAtUrl("/Celebrity/" + data.pickedGuid);
-
getAllGuids
-
A CRUD READ method that will attempt to retrieve 0..N resources from the your apps backend.
Returns an Array containing all of the guids for the objects of that type at that resource location.
Parameters:
| Name |
Type |
Description |
requestUri |
string
|
(required) is the url for this query. |
- Source:
Returns:
An array that contains all the guids for the objects of that type at that resource location.
-
Type
-
[string]
Example
totalRatings = ff.getAllGuids("/WouldYa");
-
getArrayFromUri
-
A CRUD READ method that will attempt to retrieve 0..N resources from the your apps backend.
Returns an Array containing all of the objects of that type at that resource location.
Parameters:
| Name |
Type |
Description |
requestUri |
string
|
(required) is the url for this query. For example @"/ff/resources/MyObjects/(foo eq 'fooValue')" |
- Source:
Returns:
An array that contains all objects of that type at that resource location.
-
Type
-
[{objectWithMetadata}]
Example
yourRatings = ff.getArrayFromUri("/WouldYa/(createdBy eq '" + createdBy + "')");
-
getEventHandlerData
-
Get object data from within an event handler
- Source:
Returns:
event handler object data and metadata
Example
var data = ff.getEventHandlerData();
print("object created at " + data.createdAt + " by " + data.createdBy");
-
getExtensionRequestData
-
Get request data from within a server extension
- Source:
- See:
-
Returns:
extension request data, with the following fields:
httpMethod: the HTTP method (eg. GET, POST, PUT, DELETE, HEAD)
httpRequestUri: the request URI, relative to your application’s base URL
httpParameters: A map of the request parameters
httpHeaders: A map of the request headers
httpCookies: For convenience, a map of the cookies from the Cookie request header
httpContent: A map corresponding to the JSON content supplied in the request body, if any
ffUser: the guid of the logged-in user.
-
getGroup
-
Utility method to get an FFUserGroup from the datastore.
Parameters:
| Name |
Type |
Description |
groupGuid |
string
|
the guid of the FFUserGroup we want to retrieve |
- Source:
Returns:
the group
-
Type
-
FFUserGroup
-
getGuids
-
A CRUD READ method that will attempt to up to a given number of guids from a specified location.
Parameters:
| Name |
Type |
Description |
resourceLocation |
|
uri of the desired resources |
count |
|
maximum number of guids to return |
- Source:
Returns:
guids
-
Type
-
Array
-
getHttpAppAddress
-
Get the HTTP address of the application
- Source:
Returns:
HTTP address
-
Type
-
string
-
getHttpsAppAddress
-
Get the HTTPS address of the application
- Source:
Returns:
HTTPS address
-
Type
-
string
-
getObjFromUri
-
A CRUD READ method that will attempt to retrieve a single resource from this relative URL.
Parameters:
| Name |
Type |
Description |
ffUrl |
string
|
(required) is the url for this resource relative to the #baseUrl property set above. |
- Source:
Returns:
the returned object from the your apps backend.
-
Type
-
objectWithMetadata
Example
readMyStuff = ff.getObjFromUri(myStuffUri);
-
getReferredObject
-
Get a referred object
Parameters:
| Name |
Type |
Description |
refName |
String
|
the name of the reference relationship |
obj |
Object
|
the referring object |
- Source:
-
getUser
-
Utility method to get an FFUser from the datastore.
Parameters:
| Name |
Type |
Description |
userGuid |
string
|
the guid of the FFUser we want to retrieve |
- Source:
Returns:
the user
-
Type
-
FFUser
-
grabBagAdd
-
Add an item to the object's named grab bag.
Parameters:
| Name |
Type |
Description |
itemUrl |
|
The ffUrl of the item which is to be added |
parentUrl |
|
The ffUrl of the object whose grab bag is going to be updated |
grabBagName |
|
The grab bag name |
- Source:
Example
grabBagAdd(anOrderLine.ffUrl, anOrder.ffUrl, "OrderLines");
-
grabBagGetAll
-
Get all items from the object's named grab bag
Parameters:
| Name |
Type |
Description |
parentUrl |
|
The ffUrl of the object from whose grab bag we are retrieving |
grabBagName |
|
The grab bag name |
- Source:
Returns:
All objects from specified grab bag
-
Type
-
Array
Example
var grabBagContents = grabBagGetAll(anOrder.ffUrl, "OrderLines");
-
grabBagGetAllForQuery
-
Get items, via query, from the object's named grab bag
Parameters:
| Name |
Type |
Description |
parentUrl |
|
The ffUrl of the object from whose grab bag we are retrieving |
grabBagName |
|
The grab bag name |
query |
|
The query string in FatFractal Query Language format |
- Source:
Returns:
Objects from specified grab bag matching query
-
Type
-
Array
Example
var results = grabBagGetAllForQuery(anOrder.ffUrl, "OrderLines", "(orderLineValue gt 1000)");
-
grabBagRemove
-
Remove an item from the object's named grab bag.
For example, grabBagRemove(anOrderLine.ffUrl, anOrder.ffUrl, "OrderLines")
Parameters:
| Name |
Type |
Description |
itemUrl |
|
The ffUrl of the item which is to be removed |
parentUrl |
|
The ffUrl of the object whose grab bag is going to be updated |
grabBagName |
|
The grab bag name |
- Source:
-
removeReferenceFromObj
-
Remove the FatFractal 'reference to another object' with the name 'refName' from this object.
Parameters:
| Name |
Type |
Description |
refName |
String
|
the name of the reference relationship |
obj |
Object
|
the object from which to remove the reference |
- Source:
-
resetPassword
-
Force a password change for this user.
Parameters:
| Name |
Type |
Description |
userGuid |
String
|
the guid of the user whose password is being changed |
password |
String
|
the new password |
- Source:
-
response
-
Returns a handle to the response object which your extension's code needs to populate in order for data to be returned from your extension.
- Source:
- See:
-
Returns:
response object containing the following fields: responseCode, statusMessage, result, mimeType
Example
var r = ff.response();
r.responseCode = 200;
r.statusMessage = "All is well";
-
sendEmail
-
Improved email-sending function; capable of sending HTML email. Future enhancements to this method will enable
sending of attachments (for example, BLOBs from the FatFractal data store).
Parameters:
| Name |
Type |
Description |
data |
|
an object with the following fields:
{string} host The SMTP host
{string} port The SMTP port
{string} auth Whether authorization is required (true or false)
{string} authPort The SMTP port for authorization
{string} username The SMTP username
{string} password The SMTP password
{string} from The sendMail from email address.
{string} to The sendMail to email address.
{string} subject The sendMail subject.
{string} text Plain text content
{string} html HTML content |
- Source:
- See:
-
-
sendPushNotifications
-
The sendPushNotifications method allows any Event Handler or Server Extension to send a Push
Notifications programatically.
Parameters:
| Name |
Type |
Description |
userGuids |
[string]
|
An array of userGuid sendPushNotifications will send to. |
message |
string
|
The message to send in the Push Notifications. |
- Source:
Example
r = ff.sendPushNotifications (user, message).response();
-
sendSMTPEmail
-
The sendSMTPMail method allows any Event Handler or Server Extension to send an email programatically.
Parameters:
| Name |
Type |
Description |
host |
string
|
The SMTP host |
port |
string
|
The SMTP port |
auth |
string
|
Whether authorization is required (true or false) |
authPort |
string
|
The SMTP port for authorization |
username |
string
|
The SMTP username |
password |
string
|
The SMTP password |
fromAddress |
string
|
The sendMail from email address. |
toAddress |
string
|
The sendMail to email address. |
subject |
string
|
The sendMail subject. |
body |
string
|
The sendMail body. |
- Source:
Example
ff.sendSMTPEmail("smtp.gmail.com", "465", "true", "465", "YourUserName", "YourPassword",
"Your email address", "Recipient email address", "Hello, World!", "Hello from FatFractal")
-
setDefaultPermissionOnObject
-
Set the default permissions for this object. If object has a specific ACL, it is removed so that the defaults
apply (PERMIT commands or, if there are no PERMIT commands, the overall system default (public can read, only
creator can write)
Parameters:
| Name |
Type |
Description |
ffUrl |
string
|
the ffUrl of the object on which we are setting the permissions |
- Source:
Returns:
-
Type
-
void
-
setPermissionOnObject
-
Sets a specific ACL on an individual object
Parameters:
| Name |
Type |
Description |
ffUrl |
string
|
the ffUrl of the object on which we are setting the permissions |
readUsers |
array
|
array of guids (or ffUrls) of the users who will be entitled to read the object |
readGroups |
array
|
array of guids (or ffUrls) of the groups who will be entitled to read the object |
writeUsers |
array
|
array of guids (or ffUrls) of the users who will be entitled to modify the object |
writeGroups |
array
|
array of guids (or ffUrls) of the groups who will be entitled to modify the object |
- Source:
Returns:
-
Type
-
void
-
updateObj
-
A CRUD UPDATE method that will attempt to update an existing resource on the your apps backend. The object
must have previously been retrieved or created via the FF API.
Parameters:
| Name |
Type |
Description |
data |
object
|
The instance of any arbitrary class object to be created and persisted on
the your apps backend. |
- Source:
Returns:
the returned object from the your apps backend.
-
Type
-
objectWithMetadata
Example
newTopCeleb = ff.updateObj(currentTopCeleb);