-
Notifications
You must be signed in to change notification settings - Fork 2
Enginio Data Storage SDK API
Miska Kaipiainen edited this page Mar 23, 2014
·
7 revisions
EDS - Constructor
- Qtc.Eds() - Constructor
EDS - Helper functions for working with custom data types
- Qtc.Eds.Geoloc() - Helper for creating Geoloc object
- Qtc.Eds.Time() - Helper for creating Time object
- Qtc.Eds.Ref() - Helper for creating Ref object
EDS - Collections
- Qtc.Eds.collection() - Assign collection
- Qtc.Eds.collection.insert() - Insert an object into a collection
- Qtc.Eds.collection.update() - Update an existing object
- Qtc.Eds.collection.remove() - Remove an object from a collection
- Qtc.Eds.collection.findOne() - Find an object in collection
- Qtc.Eds.collection.find() - Query for objects in a collection
- Qtc.Eds.collection.count() - Count objects matching the query in a collection
EDS - Files
- Qtc.Eds.collection.attachFile() - Attach a file to an object
- Qtc.Eds.collection.getFileInfo() - Get file information
- Qtc.Eds.collection.getFileDownloadUrl() - Get file download URL
- Qtc.Eds.collection.downloadFile() - Download a file
EDS - Custom REST API requests
- Qtc.Eds.rest() - Custom REST API requests
var eds = new Qtc.Eds( options );
The constructor for EDS instance. The options
is an object with following parameters:
- address - An address of this EDS instance
- backendId - A backend id of this EDS instance
- secret - (optional) A security token for this EDS instance
// The typical constructor may look something like this...
var eds = new Qtc.Eds({
address: "", // enter your EDS instance address
backendId: "", // enter your EDS instance backend id
secret: "" // enter your EDS instance secret token
});
eds.rest( verb, path, options, callback );
The custom rest request to EDS instance. Arguments:
- verb - A HTTP request verb: GET, POST, PUT, DELETE
- path - A path for the request. Please see http://developer.qtc.io/eds/rest/reference
- options - (optional) An options for the request
- callback - A callback function to be called when request is completed.
// example of using the custom REST API call to get objects in collection "places"
eds.rest("GET", "/objects/places", function(e, result){
// do something with result
});
var collection = eds.collection( name, useInternals );
Assign collection instance. Arguments:
- name - A name of the collection.
- useInternals - (optional) This boolean value applies only if the collection name is "users" or "usergroups". If set to true, the collection points to EDS users and usergroups collection. If not set, the collection points to custom user defined objects.
Returns a collection instance.
// assign collection "places" to variable
var places = eds.collection("places");
// do something with collection...
collection.insert( obj, callback );
Inserts an object into collection. Arguments:
- obj - An object to be inserted.
-
callback - A callback function called after the operation. Callback function is called with two arguments: callback(error, result).
-
error
- The error code. If the request is successful,error
isnull
. -
result
- The response to request.
-
// example: assume we have collection "places"
places.insert({ name: "Paris", country: "France" }, function(e,result){
// do something with collection...
});
collection.update( objId, obj, callback );
Updates an object in a collection. Arguments:
- objId - An object id to be updated.
- obj - An object containing the updated fields.
-
callback - A callback function called after the operation. Callback function is called with two arguments: callback(error, result).
-
error
- The error code. If the request is successful,error
isnull
. -
result
- The response to request.
-
// example: assume we have collection "contacts"
contacts.update( "532ed53900deff4eee0003ee", {
email: "batman@newemailaddress.org"
}, function(e, result){
// do something with result
});