CCRX Molecule

Our web service API.

Summary
CCRX Molecule
Preference Dialog
CommentsCCRX (Common Code Request and Exchange) molecule provides the following important Web Service that a user can take advantage of to offer file/folder based applications and services to other members.
Properties
typestring, ( r )
pref.namestring, ( r )
currentUserstring, ( r )
Functions
attach
detach
delete
rename
clone
serialize
query
askUserForData
askUserToSaveData

Preference Dialog

Comments

CCRX (Common Code Request and Exchange) molecule provides the following important Web Service that a user can take advantage of to offer file/folder based applications and services to other members.

Get current user’s name.  This service lets you know who is using your application.  (see currentUser)

Request data from current user.  This service opens a vault explorer dialog and ask current user to select a file.  Upon user’s approval, the content of the file is passed to the requesting application’s callback function.  The user can cancel the request and dismiss the dialog.  In that case, no data is transfered.  (see askUserForData)

Save data to file.  This service opens a vault explorer dialog and ask current user to select a folder and provide a file name.  Upon user’s approval, the implementer’s callback is queried repeatedly for data until an empty string is encountered.  The data is then saved to the named file in current user’s vault.  The user can cancel the request and dismiss the dialog.  In that case, no data is transfered.  (see askUserToSaveData)

Query public repository for data.  This service allows implementers to make filtered query to our public repository.  (see query)

Properties

type

string, ( r )

Type of this molecule, ccrx.

pref.name

string, ( r )

The scriptable name for this molecule.  This name can be set using rename function dynamically.

currentUser

string, ( r )

Returns the nickname of current user.

Functions

attach

attach(droplet);

Attach this molecule to the given droplet.

Parameters

droplet(object) a droplet.

Returns

N/A

detach

detach();

Remove this molecule from its droplet.

Parameters

N/A

Returns

N/A

delete

delete();

Delete this molecule.

Parameters

N/A

Returns

N/A

rename

rename(name);

Rename this molecule.

Parameters

name(string) a new name.

Returns

N/A

clone

clone();

Create a clone of this molecule.

Parameters

N/A

Returns

(object) a molecule.

serialize

serialize();

Serialize this molecule into its JSON representation.

Parameters

N/A

Returns

(string) JSON representation of a molecule.

query

query(filter, callback);

This function queries the repository for previously published objects (applications, formations, droplets, blueprints) using the given filter and passes back the result to the callback function given either as a script molecule or a document-level function.

Parameters

filter(object) a set of key/value pairs.
callback(mixed) a script molecule or a document-level function.

Possible keys are,

nameName of the published object.
publisherNickname of the publisher.
descpartial description text.
commpartial comment text.
categoryThe category of the object.
tagSearch by tag.
implementsThe blueprint IDs that the object implements.
attrbSearch by attribute.
filterSearch by type (application, formation, droplet, or blueprint).
guidSearch by the unique ID of an object.
startReturns the object starting from the given index.  Default 0.
countThe number of objects to return.
orderbyOrder of the result using one of the values below.  Default is the latest first.

At the completion of the query, the callback function is passed the result in the input parameter params and params.result contains the records as an array of object.  (e.g. var record = params.result[2]; ).

Each record has the following properties,

nameName of the published object.
timeUnix time this object was published.
quidObject’s unique ID.
nicknameNickname of the publisher.
ownerOwner of the object.
categoryThe category of the object.
typeObject type (application, formation, droplet, or blueprint).
implementsThe blueprint IDs that this object implements.
descriptionFull description of the object.
commentsFull comments of the object.
unitidThe unique ID of the parent object that this object belongs to.  (a droplet’s parent formation ID.)
costThe cost of this object.
tagsThe tags associated with this object.
embedURLThe URL that this object, in raw JSON string, is located and can be embedded into another project.

Returns

N/A

askUserForData

askUserForData(callback);

Open the Vault Explorer dialog (see vaultExplorerOpen) and ask the current user to select a file from his/her vault.  The file content is returned to the given javascript callback function as input parameter params.

vaultExplorerOpen

Parameters

callback(mixed) a script molecule or a document-level function.

Returns

N/A

askUserToSaveData

askUserToSaveData(file_extension, size, callback);

Similar to askUserForData but ask the current user to select a folder and specify a file name so that the caller of this function can save data into a file in user’s vault.  (see vaultExplorerSave)

vaultExplorerSave

Once the user selects a folder and a file name, the callback function is repeatedly called to obtain return value as content.  The implementer can return an empty string to designate the end.  The data is forcefully truncated to the size specified.

Parameters

file_extension(string) a preferred extension of the file name.
size(int) the Byte size of the content to be saved.
callback(mixed) a script molecule or a document-level function.

Returns

N/A

string, ( r )
Close