Overview

Features

 
 

API Reference

The CloudBoost API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients, and we support cross-origin resource sharing to allow you to interact securely with our API from a client-side web application / mobile application (though you should remember that you should never expose your secret API master key in any public website's client-side code, Client Key can be exposed). JSON will be returned in all responses from the API, including errors (though if you're using API bindings / SDK, we will convert the response to the appropriate language-specific object).

 

Dependencies

This SDK require few external libraries.

 

Apps

In Cloudboost, you create an app each of which has its own AppID, Java Client Key and the Master Key that you apply to your web app. You master key is a secret which should not be shared in your client apps. Your account on CloudBoost can accommodate multiple apps. This is useful even if you have one application, since you can deploy different versions for test and production.

 

CB.CloudApp

This is your CloudApp object, and it is used to initalize your app with CloudBoost.

 

CloudApp.init( appId, appKey )

Initialises the app.

ClientKey and MasterKey are the two keys that are provided for each app your create. If you want a client of your app have access to CloudBoost API, its recommended you only share ClientKey with your app.
We dont recommend initialising your app with MasterKey unless you install our API and make requests from your server.

Package

Arguments
appId
Application ID with which your app is registered.
appKey
Client/Master key unique for your app
Returns

It doesn't return anything.

string myAppId = "schoolApp"; string myKey = "d1bae1c6978e3ecd3d5c8a0095767c9c"; CloudApp.init(myAppId, myKey);
 

CB.CloudObject

Your data in CloudBoost is represented with CloudObjects CloudObject. Each CloudObject belongs to a table in your database with us and each objct represents a row of data in that table. The data you can store in CloudObject has schema which you define in Table Designer in CloudBoost portal. You simply set whatever key-value pairs you want, and our backend will store it for you.

 

Constructor : CloudObject( columnName, [objectId] )

Instantiates a CloudObject object.

Argument
tableName
string The name of the table you want to deal with
Returns

It returns an instance of a CloudObject, because its a constructor.

Properties

Every instance of CloudObject has these properties

id
string The id of the CloudObject which is populated after the object is saved.
createdAt
Date The Date and time when the object was saved in the database.
updatedAt
Date The Date and time when the object was updated in the database.
isSearchable
boolean Set this to true if you want this object to be indexe for search and is accessible with CloudSearch
ACL
ACL Access Control List, by defualt this object is publicily readbale and writable. You set object leevel security here. Refer ACL's
//creates an object for Student table //all the CloudBoost functionality. var obj = new CB.CloudObject("Student");
 

CloudObject.Set( columnName, data )

Sets the value of an attribute of a CloudObject object.

Arguments
columnName
string The name of the column whose value is to be set.
data
Any dataThe value which is to be stored in the column.
Returns

void

var obj = new CB.CloudObject("Student"); //create a new object. obj.Set("name", "John Smith"); //store string obj.Set("age", 21); // store number Dictionary<string, object> address = new Dictionary<string,object>(); addressAdd("city","Hyderabad"); address.Add("state", "Telangana"); address.Add("country","India"); address.Add("zip", 500046); obj.Set("address",address);
 

CloudObject.Get( columnName )

Gets the value of an column of an instance of CloudObject object.

Argument
columnName
string The name of the column whose value is to be fetched.
Returns

It returns undefined if the attribute is not set previously otherwise returns the value of column which was previously set.

Dictionary<string,object> getAddressObject = new Dictionary<string,object>(); getAddressObject = (Dictionary)obj.Get("address"); //get the data. /* address will be a Dictionary Object getAddressObject["city"]; getAddressObject["state"]; which was saved using object.set */ string name = obj.Get("name");
 

CloudObject.Unset( columnName )

Sets the value of an column of a CloudObject object to null.

Argument
columnName
string The name of the column which is to be unset.
Returns

void

var obj = new CB.CloudObject("Student"); obj.Set("name", "John Smith"); obj.Get("name"); obj.Unset("name"); obj.Get("name");
 

CloudObject.SaveAsync()

Saves the CloudObject object to CloudBoost.

Argument
Error Handling

It throws CB.Exception.CloudBoostException

var obj = new CB.CloudObject("Student"); obj.Set("name", "Smith"); await obj.SaveAsync();
 

CloudObject.FetchAsync()

Refreshes a CloudObject object to by fetching its values from the database.

Error Handling

It throws CB.Exception.CloudBoostException

await obj.FetchAsync();
 

CloudObject.DeleteAsync()

Delete a CloudObject object, if it is saved in the database.

Error Handling

It throws CB.Exception.CloudBoostException

await obj.DeleteAsync();
 

CloudObject.IsSearchable

Indexes CloudObject for search using CloudSearch.

CloudObject obj = new CB.CloudObject('Student'); obj.Set("name", "John Smith"); obj.IsSearchable = true; //index this object for Search
 

CloudObject.On( tableName, eventType, Callback)

Realtime Notifications : Listens to CloudObject events like insert, update, delete in the database.

Argument
tableName
String Name of the table on which you want to listen for events. respective response.
eventType
String / Array Type of an event you want to listen to, Only created, updated, deleted are supported values.
Callback
Function Your custom function to fire when the event occours
Returns

void

//listen to an event CB.CloudObject.On("Student", "created", new Callback(action)); void action(Object result){ //function to fire }
 

CloudObject.Off( tableName, eventType )

Realtime Notifications : Switches off listening to CloudObject events like insert, update, delete in the database.

Argument
tableName
String Name of the table on which you want to stop listening for events to. respective response.
eventType
String / Array Type of an event you want to stop listening to, Only created, updated, deleted are supported values.
Returns

void

//stop listening to an event CB.CloudObject.Off("Student", "created");
 

CloudObject.Expires

Sets the expiration time for CloudObject. Expiration time is to be given as number of milliseconds from 1 Jan 1970.

var obj = new CB.CloudObject("Student"); obj.Set("name", "John Smith"); Date date = new Date(2015, 12, 25); obj.Expires = date.getTime()+1000;
 

CloudObject.Relate(columnName,tableName,objectId)

Relates a CloudObject which is already saved to this CloudObject. Can be used to relate objects together in a relation.

Argument
columnName
String Name of the column of the current CloudObject.
tableName
String Name of the table of the CloudObject which you want to relate to.
objectId
String Id of the object which you want to relate to.
Returns

void

var obj = new CB.CloudObject("Student"); obj.Relate("teacher","Teacher","xxxxxx""); //relates the teacher in the Teacher table with id xxxxx to this student.
 

Relationships

This section is dedicated to modelling relationships with CloudBoost.

There are usually three types of relationships.

  • One-to-One Relationship
  • One-to-many Relationship
  • Many-to-many Relationship

 

One-to-One Relationship

If you want to model one-to-one relationship. Then you need to create a new column of type Relation pointed to a table which you want it to be related to and set that column Unique property to true.

var student = new CB.CloudObject("Student"); var address = new CB.CloudObject("Address"); //here one student can only have one address for example. //address column of Student Table is pointed to the Address Table with unique set to true. student.Set("address", address); await student.SaveAsync();
 

One-to-Many Relationship

If you want to model one-to-many relationship. Then you need to create a new column of type Relation pointed to a table which you want it to be related to and set that column Unique property to false.

var teacher = new CB.CloudObject("Teacher"); var course = new CB.CloudObject("Course"); //here one teacher be assigned to many courses. //address column of Student Table is pointed to the Address Table with unique set to true. course.Set("teacher", address); student.SaveAsync();
 

Many-to-Many Relationship

If you want to model many-to-many relationship. Then you have two options

  1. #1 - Relation Option
  2. #2 - List Option
We will discuss both of these options below.


Relation Option

This option is recommended only if you have huge number of relationships assigned to any one object.

This relationship can be created by creating a third table and having two columns that are relatied to tables you want to have many to many relationships on.









List Option

This option is recommended only if you have small number of relationships assigned to any one object.

This relationship can be created by creating an array and having related objects pushed to that array and having that array saved in any column of the table.

//Type #1 : Relation Option var student = new CB.CloudObject("Student"); var course = new CB.CloudObject("Course"); //here one student be into many courses, and vice versa. var studentCourse = new CB.CloudObject("StudentCourse"); studentCourse.Set("student", student); studentCourse.Set("teacher", teacher); await studentCourse.SaveAsync(); // ====================================================== //Type #2 : List Option. var student = new CB.CloudObject("Student"); //create an array. var courseList = new ArrayList(); //a new course var course = new CB.CloudObject("Course"); //add it to the list. You can push any number of objects you need. courseList.Add(course); //here one student be into many courses, and vice versa. student.Set("courses", courseList); await student.SaveAsync();
 

CB.CloudQuery

It encapsulates a set of methods and attributes required to query your data in CloudApp to retrieve desired set of results.

 

Constructor

Instantiates a CloudQuery object.

Argument
tableName
string The name of the table you want to query on.
Returns

void

var query = new CB.CloudQuery("Student");
 

CloudQuery.EqualTo( columnName, data )

It adds a contriant for finding the subset of the data in which columnName is equal to data.

Arguments
columnName
string The column on which the contraint is to be applied
data
AnythingThe value of the equals contraint
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Student"); query.EqualTo("age", 21); //find all Students who age is 21 var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.ContainedIn( columnName, data )

If you want to retrieve objects matching several different values, you can use containedIn, providing an array of acceptable values. This is often useful to replace multiple queries with a single query.

Arguments
columnName
string The name of the column whose value is to be checked
data
Array The value(s) that are to be matched with.
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Student"); //Get Student where name is equal to Smith, Max or Lucy var list = new ArrayList(); list.Add("Smith"); list.Add("Max"); list.Add("Lucy"); query.ContainedIn("name", list); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.ContainsAll( columnName, data )

Find objects where the array data in columnName contains all of the elements of data.

Arguments
columnName
string The name of the column whose value is to be checked
data
Array The value(s) that are to be matched with.
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Student"); //find Students who are in JavaScript and C# class var list = new ArrayList(); list.Add("java"); list.Add("javascript"); query.ContainsAll("classes", list); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.StartsWith( columnName, data )

It adds a contriant to find the data in which value of columnName of each data is starts with data.

Arguments
columnName
string The name of the column whose value is to be checked
data
string The value that is to be checked with.
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Student"); //find all the Students who name starts with letter 'S' query.StartsWith("name", "S"); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.NotEqualTo( columnName, data )

It adds a contriant for finding the subset of the data in which columnName does not has the value data.

Arguments
columnName
string The attribute on which the contraint is to be applied
data
AnythingThe value of the equals contraint
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Student"); //find all Students info except of Smith query.NotEqualTo("name", "Smith"); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.NotContainedIn( columnName, data )

If you want to retrieve objects which doesnot include several different values, you can use notContainedIn, providing an array of acceptable values. This is often useful to replace multiple queries with a single query.

Arguments
columnName
string The name of the column whose value is to be checked
data
Array The value(s) that are to be matched with.
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Student"); //Get all Students except Smith, Max and Lucy var list = new ArrayList(); list.Add("Smith"); list.Add("Max"); list.Add("Lucy"); query.NotContainedIn("name", list); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.GreaterThan( columnName, data )

It adds a contriant for finding the subset of the data in which columnName has the value greater than data.

Arguments
columnName
string The attribute on which the contraint is to be applied
data
string / numberThe value of the equals contraint
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Teacher"); //find all the teachers who are old. query.GreaterThan("age", 60); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.GreaterThanEqualTo( columnName, data )

It adds a contriant for finding the subset of the data in which columnName has the value greater than or equals to data.

Arguments
columnName
string The attribute on which the contraint is to be applied
data
string / numberThe value of the equals contraint
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Teacher"); query.GreaterThanEqualTo("age", 60); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.LessThan( columnName, data )

It adds a contriant for finding the subset of the data in which columnName has the value less than data.

Arguments
columnName
string The attribute on which the contraint is to be applied
data
string/numberThe value of the equals contraint
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Student"); query.LessThan("age", 18); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.LessThanEqualTo( columnName, data )

It adds a contriant for finding the subset of the data in which columnName has the value less than or equals to data.

Arguments
columnName
string The attribute on which the contraint is to be applied
data
string/numberThe value of the equals contraint
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Student"); query.LessThanEqualTo("age", 17); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.Or( query1, query2 )

It adds a logical OR contriant between 2 CloudQuery objects for finding the set of the data satisfying conditions of both query1 and query2.

Both of the CloudQuery objects should be of the same collection otherwise it throws an error.

Arguments
query1
CloudQuery object
query2
CloudQuery object
Returns

It returns a CloudQuery object which contains OR'ed query of both of the CloudQuery objects.

//find all Student such that 10<age<18 var query1 = new CloudQuery("Student"); query1.LessThan("age", 18); var query2 = new CB.CloudQuery("Student""); query2.GreaterThan("age", 10); CloudQuery query = CloudQuery.Or(query1, query2); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.OrderByAsc( columnName )

It adds a contriant for arranging the subset of the data in ascending order.

Argument
columnName
string The attribute on which the contraint is to be applied
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Student"); query.OrderByAsc("age"); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.OrderByDesc( columnName )

It adds a contriant for arranging the subset of the data in descending order.

Argument
columnName
string The attribute on which the contraint is to be applied
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Student"); query.OrderByDesc("age"); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.Limit

It adds a contriant to limit no. of the data to be fetched from the database.

If it is not set explicitly, database returns 20 results by default.

var query = new CB.CloudQuery("Student"); query.Limit = 5; var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.Skip

It adds a constraint to skip data no. of data matching satisfying the query contraints and fetching from the database.

It requires a sort contriant and if none of it is provided by the user then the documents are sorted according to the createdAt attribute associated with the data.

var query = new CloudQuery("Student"); query.Skip = 5; var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.SelectColumn( columnNames )

It adds a contriant limiting the columns that are to fetched for each of the data from the database.

id, createdAt, updatedAt and ACL are always returned unless explicitly provided by the user to discard it using doNotSelectColumn()

Argument
columnNames
string/Object/Array The name of the column(s) that are to be returned
Returns

Same query object, which can be helpful in chaining query functions.

CloudQuery query = new CloudQuery("Student"); var list = new ArrayList(); list.Add("name"); list.Add("age"); query.SelectColumn(list); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.DoNotSelectColumn( columnNames )

It adds a contriant restricting the columns given in columnNames to be fetched for each of the data from the database.

Argument
columnNames
string/Object/Array The name of the column(s) that are not to be returned
Returns

Same query object, which can be helpful in chaining query functions.

CloudQuery query = new CloudQuery("Student");query.greaterThan("age", 18); query.DoNotSelectColumn("address"); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.Exists( columnName )

It adds a contriant for finding the subset of the data in which columnName exists irrespective of what its value is.

Argument
columnName
string The column name which is to be checked for existence
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Student"); query.Exists("address"); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.DoesNotExists( columnName )

It adds a contriant for finding the subset of the data in which columnName does not exists.

Argument
columnName
string The column name which is to be checked for non-existence
Returns

Same query object, which can be helpful in chaining query functions.

var query = new CB.CloudQuery("Student"); query.DoesNotExists("address"); var response = (List<CB.CloudObject>) await query.FindAsync();
 

CloudQuery.FindAsync()

Queries the database on the constraints provided by the CloudQuery object and gets the result as an array of CloudObject objects.

If no. of documents to be returned is not specified using limit() then at max 20 documents are returned in each query by default.

If no. of documents to be skipped is specified using skip() without sorting parameter then the documents matching the query provided in CloudQuery object are sorted in ascending order of createdAt field.

Returns

It returns an array of CloudObject objects.

Error Handling
It throws CB.Exception.CloudBoostException
var list = (List<CB.CloudObject>) await query.FindAsync(); string name; int age; for(int i=0; i < list.Count; i++ ){ name = (string)list[i].Get("name"); age = (int)list[i].Get("age"); }
 

CloudQuery.FindOneAsync( )

Queries the database on the constraints provided by the CloudQuery object and gets a single CloudObject object satisfying the constraint.

If no. of documents to be skipped is specified using skip() without sorting parameter then the documents matching the query provided in CloudQuery object are sorted in ascending order of createdAt field.

Returns

It returns a CloudObject object or an error object if the opertion is successful.It throws an error too if sufficient data is not available to query the database.

Error Handling
It throws CB.Exception.CloudBoostException
string name; int age; var obj = (CB.CloudObject) await query.FindOneAsync(); name = (string)obj.get("name"); age = (int)obj.get("age");
 

CloudQuery.GetAsync( id )

Queries the database gets a CloudObject object whose id field matches id.

Arguments
id
string The ID of the data which is to be matched with _id field in the database.
Returns

It returns a CloudObject object or an error object if the opertion is successful. It throws an error too if sufficient data is not available to query the database.

//retrieve a Student detail by his unique ID var obj = (CB.CloudObject) await query.GetAsync("54e837d6d51a5ea011aa79ea");
 

CloudQuery.CountAsync( )

It adds a contriant to find the data in which value of columnName of each data is at least equal to all of the value(s) provided in data.

Returns

It returns an Integer which is the number of documents matching the constraints given in the CloudQuery.

//fetch how many Students are there who age>18 var count = await (int)query.CountAsync();
 

CloudQuery.DistinctAsync( columnName )

It returns distinct objects which have columnName

Sort parameter is required and if not provided by the user ascending order sorting on createdAt field is applied by default.

Argument
columnName
String The column name which should have distinct values in the returned data set.
Returns

It returns an array of CloudObject objects which are documents matching the given query in the CloudQuery object having distinct values of ColumnName.

var list = (List<CB.CloudObject>) await query.DistinctAsync("address");
 

CloudQuery.Include( columnName )

It gives the join on columnName for the table being queried upon.

Argument
columnName
String The column name on which join is to be performed.
Returns

Same query object, which can be helpful in chaining query functions.

//joins table student with hostel var query = new CB.CloudQuery("Student"); query.Include("hostel");
 

CloudQuery.Near(columnName,geoPoint, range)

Queries for CloudObject objects which are within range.It gives result in the order of nearest to farthest.

Argument
ColumnName
String Name of column which has the CloudGeoPoint
CloudGeoPoint
Object It is the point close to which the points are to be found respective response.
Range
Number It the range within which are CloudObjects are to be sought. It is given in Meters
Returns

Same query object, which can be helpful in chaining query functions.

var loc = new CB.CloudGeoPoint(17.7,80.3); var query = new CB.CloudQuery("Custom5""); query.Near("location", loc, 100000); var response = await query.Find();
 

CloudQuery.Geowithin("ColumnName",CloudGeoPoint,Radius)

Queries for CloudObject objects which are within range.

Argument
ColumnName
Object Name of column which has the CloudGeoPoint
CloudGeoPoints
Array Array of CloudGeopoints within which we want to search CloudObjects or Center of Circle in case the shape is circle
Radius
decimal [Optional] Radius of Circle. Radius is taken in Meters
Returns

Same query object, which can be helpful in chaining query functions.

var loc1 = new CB.CloudGeoPoint(18.4,78.9); var loc2 = new CB.CloudGeoPoint(17.4,78.4); var loc3 = new CB.CloudGeoPoint(17.7,80.4); var query = new CB.CloudQuery("Custom"); var list = new ArrayList(); list.Add(loc1); list.Add(loc2); list.Add(loc3); query.GeoWithin("location", list); var response = await query.Find();
 

CloudNotifcations

In Cloudboost, you can create realtime notification channels, publish messages to those channels and have other clients listen to those messages which are being published in real time.

 

CloudNotification.On( channelName, Callback )

Listens to notification channels.

Arguments
channelName
Stringchannel to listen to.
Callback
function function to fire when data on this channel is published.
Returns

void

Error Handling

It throws CB.Exception.CloudBoostException

CB.CloudNotification.On("sample", new Callback(action)); void action(Object result) { //function to fire }
 

CloudNotification.publish( channelName, data )

Publishes data to notification channels.

Arguments
channelName
Stringchannel to publish to.
data
Anything data you want to publish to this channel
Returns

void

Error Handling

It throws CB.Exception.CloudBoostException

CB.CloudNotification.Publsh("sample", "data");
 

CloudNotification.Off( channelName )

Stops listening to notification channels.

Arguments
channelName
Stringchannel to stop listening to.
Returns

void

Error Handling

It throws CB.Exception.CloudBoostException

CB.CloudNotification.Off("sample");
 

CloudSearch

It encapsulates a set of methods and attributes required to perform search on your data in CloudApp to retrieve desired set of relevant results.

 

Constructor

CB.CloudSearch(tableName)

Argument
tableNames
Array/string The name of the table(s) you want to search on.
CloudSearch cs = new CloudSearch("Student");
 

CloudSearch.SearchOn( columnName, query )

Used to perform a search query.

Arguments
columnName
string / Array The column on which the contraint is to be applied
data
queryA text query
Returns

Same CloudSearch object, which can be helpful in chaining search functions.

var list = new ArrayList(); list.Add("C++"); list.Add("Java"); list.Add("C#"); var cs = new CB.CloudSearch("Student"); cs.SearchOn("resume", list); var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

SearchQuery.phrase( columns, queryText, [fuzziness], [priority] )

Used to find the Phrase in search. For example, If you want to match a search text "Brown Fox" in your records as is, then you use Phrase Query.

Arguments
columnName
string / Array The column on which the contraint is to be applied
queryText
stringA text query
fuzziness
[Optional] integerCan be set to 0, 1, 2. Default is 0. This parameter sets the fuzziness on search.
priority
[Optional] integerIf set this query will have a higer priority over all other queries.
Returns

Same SearchQuery object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student"); cs.searchQuery = new CB.SearchQuery(); cs.searchQuery.Phrase("resume", "Java"); List<CB.CloudObject> response = await CS.Search();;
 

SearchQuery.BestColumns( columns, queryText, [fuzziness], [all_words], [match_percent], [priority] )

This function is most useful when you are searching for multiple words best found in the same field. For instance “brown fox” in a single field is more meaningful than “brown” in one field and “fox” in the other. For example : If you have two records,

ID Sample 1 Sample 2 1 Brown Fox Up the hill 2 Brown Fox up the hill
In this case, If you search for brown fox then Record with ID 1 will be more relevant than record with ID 2

Arguments
columnNames
Array The column on which the contraint is to be applied
queryText
stringA text query
fuzziness
[Optional] integerCan be set to 0, 1, 2. Default is 0. This parameter sets the fuzziness on search.
all_words
[Optional] stringCan take only value - true. If set the search will contain all the words in query. For example, If your search query is "Brown Fox". Results will contain both the words "Brown" AND "Fox".
match_percent
[Optional] stringCan take only value - %. For ex : "75%". If set the search will return all the results which matches 75%.
priority
[Optional] integerIf set this query will have a higer priority over all other queries.
Returns

Same SearchQuery object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch('Student'); cs.searchQuery = new CB.SearchQuery(); var list = new ArrayList(); list.Add("Sample1"); list.Add("Sample2"); cs.searchQuery.BestColumns(list, "Brown Fox", null, null, null, null); List<CB.CloudObject> response = await CS.Search();
 

SearchQuery.MostColumns( columns, queryText, [fuzziness], [all_words], [match_percent], [priority] )

This fucntion is most useful when querying multiple fields that contain the same text should be given higher relevance than others. For example : If you have two records,

ID Sample 1 Sample 2 1 Brown Up the hill 2 Brown Fox up the hill
In this case, If you search for brown fox then Record with ID 2 will be more relevant than record with ID 1

Arguments
columnNames
Array The column on which the contraint is to be applied
queryText
stringA text query
fuzziness
[Optional] integerCan be set to 0, 1, 2. Default is 0. This parameter sets the fuzziness on search.
all_words
[Optional] stringCan take only value - true. If set the search will contain all the words in query. For example, If your search query is "Brown Fox". Results will contain both the words "Brown" AND "Fox".
match_percent
[Optional] stringCan take only value - %. For ex : "75%". If set the search will return all the results which matches 75%.
priority
[Optional] integerIf set this query will have a higer priority over all other queries.
Returns

Same SearchQuery object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student"); cs.searchQuery = new CB.SearchQuery(); var list = new ArrayList(); list.Add("Sample1"); list.Add("Sample2"); cs.searchQuery.MostColumns(list, "Brown Fox", null, null, null, null); List<CB.CloudObject> response = await CS.Search();
 

SearchQuery.StartsWith( column, value, [priority] )

Starts with query.

Arguments
columnName
String The column on which the contraint is to be applied
value
stringA text query
priority
[Optional] integerIf set this query will have a higer priority over all other queries.
Returns

Same SearchQuery object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student"); cs.searchQuery = new CB.SearchQuery(); cs.searchQuery.StartsWith("Sample1", "Brown"); List<CB.CloudObject> response = await CS.Search();
 

SearchQuery.WildCard( column, value, [priority] )

Wildcard Query.

Arguments
columnName
String The column on which the contraint is to be applied
value
stringA wildcard value
priority
[Optional] integerIf set this query will have a higer priority over all other queries.
Returns

Same SearchQuery object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student""); cs.searchQuery = new CB.SearchQuery(); cs.searchQuery.WildCard("Sample1", "B*"); List<CB.CloudObject> response = await CS.Search();
 

SearchQuery.RegExp( column, value, [priority] )

A Regular Expression Query

Arguments
columnName
String The column on which the contraint is to be applied
value
stringA text query
priority
[Optional] integerIf set this query will have a higer priority over all other queries.
Returns

Same SearchQuery object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student"); cs.searchQuery = new CB.SearchQuery(); cs.searchQuery.RegExp("Sample", "B[a-z]*"); List<CB.CloudObject> response = await CS.Search();
 

SearchQuery.Or( searchQuery )

OR a SearchQuery

Arguments
searchQuery
CB.SearchQuery SearchQuery object to be OR'ed
Returns

Same SearchQuery object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student""); cs.searchQuery = new CB.SearchQuery(); var obj1 = new CB.SearchQuery(); obj1.SearchOn("name", "Dan", null, null, null, null); var obj2 = new CB.SearchQuery(); obj2.SearchOn("name", "Sam", null, null, null, null); cs.searchQuery.Or(obj1); cs.searchQuery.Or(obj2); List<CB.CloudObject> response = await CS.Search();
 

SearchQuery.And( searchQuery )

AND a SearchQuery

Arguments
searchQuery
CB.SearchQuery SearchQuery object to be AND'ed
Returns

Same SearchQuery object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student""); cs.searchQuery = new CB.SearchQuery(); var obj1 = new CB.SearchQuery(); obj1.SearchOn("name", "Dan", null, null, null, null); var obj2 = new CB.SearchQuery(); obj2.SearchOn("name", "Sam", null, null, null, null); cs.searchQuery.And(obj1); cs.searchQuery.And(obj2); List<CB.CloudObject> response = await CS.Search();
 

SearchQuery.Not( searchQuery )

NOT a SearchQuery

Arguments
searchQuery
CB.SearchQuery SearchQuery object to be NOT
Returns

Same SearchQuery object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student""); cs.searchQuery = new CB.SearchQuery(); var obj1 = new CB.SearchQuery(); obj1.SearchOn("name", "Dan", null, null, null, null); var obj2 = new CB.SearchQuery(); obj2.SearchOn("name", "Sam", null, null, null, null); cs.searchQuery.Not(obj1); cs.searchQuery.Not(obj2); List<CB.CloudObject> response = await CS.Search();
 

CloudSearch.EqualTo( columnName, data )

It adds a contriant for finding the subset of the data in which columnName is equal to data.

Arguments
columnName
string The column on which the contraint is to be applied
data
AnythingThe value of the equals contraint
Returns

Same CloudSearch object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student"); cs.EqualTo("age", 21); //find all Students who age is 21 var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CloudSearch.NotEqualTo( columnName, data )

It adds a contriant for finding the subset of the data in which columnName does not has the value data.

Arguments
columnName
string The attribute on which the contraint is to be applied
data
AnythingThe value of the equals contraint
Returns

Same CloudSearch object, which can be helpful in chaining query functions.

var cs = new CB.CloudSearch("Student"); //find all Students info except of Smith cs.NotEqualTo("name", "Smith"); var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CloudSearch.GreaterThan( columnName, data )

It adds a contriant for finding the subset of the data in which columnName has the value greater than data.

Arguments
columnName
string The attribute on which the contraint is to be applied
data
string / numberThe value of the equals contraint
Returns

Same CloudSearch object, which can be helpful in chaining search functions.

var cs = new CloudSearch("Teacher"); //find all the teachers who are old. cs.GreaterThan("age", 60); var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CloudSearch.GreaterThanEqualTo( columnName, data )

It adds a contriant for finding the subset of the data in which columnName has the value greater than or equals to data.

Arguments
columnName
string The attribute on which the contraint is to be applied
data
string / numberThe value of the equals contraint
Returns

Same CloudSearch object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Teacher"); cs.GreaterThanEqualTo("age", 60); var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CloudSearch.LessThan( columnName, data )

It adds a contriant for finding the subset of the data in which columnName has the value less than data.

Arguments
columnName
string The attribute on which the contraint is to be applied
data
string/numberThe value of the equals contraint
Returns

Same CloudSearch object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student"); cs.LessThan("age", 18); var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CloudSearch.LessThanEqualTo( columnName, data )

It adds a contriant for finding the subset of the data in which columnName has the value less than or equals to data.

Arguments
columnName
string The attribute on which the contraint is to be applied
data
string/numberThe value of the equals contraint
Returns

Same CloudSearch object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student"); cs.LessThanEqualTo("age", 17); var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CloudSearch.Or( cloudSearch1, cloudSearch2 )

It adds a logical OR contriant between 2 CloudSearch objects for finding the set of the data satisfying conditions of both cloudSearch1 and cloudSearch2.

Arguments
cloudSearch1
CloudSearch object
cloudSearch2
CloudSearch object
Returns

It returns a CloudSearch object which contains OR'ed query of both of the CloudSearch objects.

//find all Student such that 10<age<18 var cs1 = new CloudSearch("Student"); cs1.LessThan("age", 18); cs1.SearchOn("name", "Sam"); var cs2 = new CloudSearch("Student"); cs2.GreaterThan("age", 10); cs1.SearchOn("name", "Dan"); var cs = CloudSearch.or(cs1, cs2); var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

SearchFilter.Or( searchFilter )

It adds a logical OR contriant to SearchFilter object for finding the set of the data satisfying conditions of SearchFilter

Arguments
SearchFilter
SearchFilter Object
Returns

It returns a SearchFilter object which contains OR'ed query of SearchFilter object.

//find all Student such that 10<age<18 //create first searchFilter. var searchFilter1 = new CB.SearchFilter(); searchFilter1.LessThan("age", 10); //create second search Filter. var searchFilter2 = new CB.SearchFilter(); searchFilter2.GreaterThan("age", 18); //and both of these. var searchFilter = new CB.SearchFilter(); searchFilter.Or(searchFilter1); searchFilter.Or(searchFilter2); //attach NOT'ed searchFilter to CloudSearch. var cs = new CB.CloudSearch("Student""); cs.searchFilter = searchFilter; //search term cs.searchQuery = new CB.SearchQuery(); cs.searchQuery.SearchOn("name","Dan"); List<CB.CloudObject> list = await cs.Search();
 

SearchFilter.And( searchFilter )

It adds a logical AND contriant to SearchFilter object for finding the set of the data satisfying conditions of SearchFilter

Arguments
SearchFilter
SearchFilter Object
Returns

It returns a SearchFilter object which contains OR'ed query of SearchFilter object.

//find all students of age less than 10 AND greater than 18. //create first searchFilter. var searchFilter1 = new CB.SearchFilter(); searchFilter1.LessThan("age", 10); //create second search Filter. var searchFilter2 = new CB.SearchFilter(); searchFilter2.GreaterThan("age", 18); //and both of these. var searchFilter = new CB.SearchFilter(); searchFilter.And(searchFilter1); searchFilter.And(searchFilter2); //attach NOT'ed searchFilter to CloudSearch. var cs = new CB.CloudSearch("Student""); cs.searchFilter = searchFilter; //search term cs.searchQuery = new CB.SearchQuery(); cs.searchQuery.SearchOn("name","Dan"); List<CB.CloudObject> list = await cs.Search();
 

SearchFilter.Not( searchFilter )

It adds a logical NOT contriant to SearchFilter object for finding the set of the data satisfying conditions of SearchFilter

Arguments
SearchFilter
SearchFilter Object
Returns

It returns a SearchFilter object which contains OR'ed query of SearchFilter object.

//find all students of age less than 10 AND greater than 18. //create first searchFilter. var searchFilter1 = new CB.SearchFilter(); searchFilter1.LessThan("age", 10); //create second search Filter. var searchFilter2 = new CB.SearchFilter(); searchFilter2.GreaterThan("age", 18); //and both of these. var searchFilter = new CB.SearchFilter(); searchFilter.Not(searchFilter1); searchFilter.Not(searchFilter2); //attach NOT'ed searchFilter to CloudSearch. var cs = new CB.CloudSearch("Student""); cs.searchFilter = searchFilter; //search term cs.searchQuery = new CB.SearchQuery(); cs.searchQuery.SearchOn("name","Dan"); List<CB.CloudObject> list = await cs.Search();
 

CloudSearch.OrderByAsc( columnName )

It adds a contriant for arranging the subset of the data in ascending order.

Argument
columnName
string The attribute on which the contraint is to be applied
Returns

Same CloudSearch object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student"); cs.OrderByAsc("age"); var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CloudSearch.OrderByDesc( columnName )

It adds a contriant for arranging the subset of the data in descending order.

Argument
columnName
string The attribute on which the contraint is to be applied
Returns

Same search object, which can be helpful in chaining search functions.

var cs = new CloudSearch("Student"); cs.OrderByDesc('age'); var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CloudSearch.Limit

It adds a contriant to limit no. of the data to be fetched from the database.

If it is not set explicitly, database returns 20 results by default.

var cs = new CB.CloudSearch("Student"); cs.Limit = 5; var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CloudSearch.Skip

It adds a constraint to skip data no. of data matching satisfying the query contraints and fetching from the database.

var cs = new CB.CloudSearch("Student"); cs.Skip = 5; var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CloudSearch.Exists( columnName )

It adds a contriant for finding the subset of the data in which columnName exists irrespective of what its value is.

Argument
columnName
string The column name which is to be checked for existence
Returns

Same CloudSearch object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student"); cs.Exists("address"); var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CloudSearch.DoesNotExists( columnName )

It adds a contriant for finding the subset of the data in which columnName does not exists.

Argument
columnName
string The column name which is to be checked for non-existence
Returns

Same CloudSearch object, which can be helpful in chaining search functions.

var cs = new CB.CloudSearch("Student"); cs.DoesNotExists("address"); var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CloudSearch.Search( )

Searches the database on the constraints provided by the CloudSearch object and gets the result as an array of CloudObject objects.

If no. of documents to be returned is not specified using limit() then at max 20 documents are returned in each query by default.

Returns

It returns an array of CloudObject objects.

Error Handling
It throws CB.Exception.CloudBoostException
var searchResultList = (List<CB.CloudObject>)await cs.Search();
 

CB.CloudGeoPoint

CloudGeoPoint is used to store GeoPoints and perform GeoPoint operation like finding points near and bounding box.

A CloudGeoPoint object has to be saved in CloudObject in a column.

All the modifications in the GeoPoint can be reflected only after the object is saved after the changes.

 

Constructor

Init's a CloudGeoPoint object.

Argument

It takes latitude and longitude of a GeoPoint. Points are double data type.

Returns

It returns a CloudGeoPoint object.

var point = new CB.CloudGeoPoint(17.4,78.5);
 

CloudGeoPoint.DistanceInKms(CloudGeoPoint)

Finds distance between CloudGeoPoints in kilometers.

Argument
CloudGeoPoint
Object It is the point from which the distance to be found.
Returns

Distance in Kilometers.

var loc = new CB.CloudGeoPoint(17.7,80.3); var loc2 = new CB.CloudGeoPoint(10.7,70.3); var distance = loc.DistanceInKMs(loc2);
 

CloudGeoPoint.DistanceInMiles(CloudGeoPoint)

Finds distance between CloudGeoPoints in Miles.

Argument
CloudGeoPoint
Object It is the point from which the distance to be found.
Returns

Distance in Miles.

var loc = new CB.CloudGeoPoint(17.7,80.3); var loc2 = new CB.CloudGeoPoint(10.7,70.3); var distance = loc.DistanceInMiles(loc2);
 

CloudGeoPoint.DistanceInRadians(CloudGeoPoint)

Finds distance between CloudGeoPoints in kilometers.

Argument
CloudGeoPoint
Object It is the point from which the distance to be found.
Returns

Distance in Radians.

var loc = new CB.CloudGeoPoint(17.7,80.3); var loc2 = new CB.CloudGeoPoint(10.7,70.3); var distance = loc.DistanceInRadians(loc2);
 

CloudUser

There is a notion of user accounts that lets users access their information in a secure manner. We provide a specialized user class called CloudUser that automatically handles much of the functionality required for user account management.

CloudUser is a subclass of CloudObject, and has all the same features, such as flexible schema, automatic persistence, and a key value interface. All the methods that are on CloudObject also exist in CloudUser. The difference is that CloudUser has some special additions specific to user accounts. With this class, you'll be able to add user account functionality in your app.

There is a special object CloudUser.current which holds the information of the current user logged in.

 

Constructor

Instantiates a CloudUser object.

Argument

It takes no argument.

CloudUser obj = new CloudUser();
 

CloudUser.SignUp( )

It registers new user given its username, email and password. Registration is successful if the given email is not already registered to an existing user.

It sets the attributes of CloudUser.current object with the CloudUser object recieved.

Returns

It returns a CloudUser object which has the user information if registration is successful.

Error Handling
It throws CloudBoostException
CloudUser user = new CloudUser(); user.Set("username", "my_username"); user.Set("password", "my_solid_password"); user.Set("email", "[email protected]"); await user.SignUp();
 

CloudUser.LogIn( )

It logs in user given its username and password. Login is successful if the given username and password pair is already present in the database.

It sets the attributes of CloudUser.current object with the CloudUser object recieved.

Returns

It returns a CloudUser object which has the user information if registration is successful.

Error Handling
It throws CB.Exception.CloudBoostException
var user = new CB.CloudUser(); user.Set("username", "my_username"); user.Set("password", "my_solid_password"); user.LogIn();
 

CloudUser.LogOut( )

It logs the user out.

It sets the CloudUser.Current object to null.

Returns

It returns a CloudUser object having the user information of the user who was logged in.

Error Handling
It throws CB.Exception.CloudBoostException
CloudUser.Current.LogOut();
 

CloudUser.Current

Get the current logged in user.

//gets the current user if user is loggedIn, null otherwise. var currentUser = CloudUser.Current;
 

CloudUser.AddToRole( role )

A user can be a part of many roles, like in real world. For this functionality user should get added to a Role.

For this purpose AddToRole() of CloudUser comes in handy.

Arguments
role
CloudRole Object The CloudRole object of the role you want to add the user to.
Returns

It returns a CloudUser object having the user information of the user who was logged in.

Error Handling
It throws CB.Exception.CloudBoostExceptionn
//role is an instance of CloudRole Object. CloudUser.Current.AddToRole(role);

Given GetRole() is discussed later

 

CloudUser.IsInRole( role )

To check if the current user is in the role provided by the role object.

Argument
role
CloudRole Object The CloudRole object of the role you want to check the user to.
Returns

It returns a true/false based on whether the user is in the given role or not respectively.

Error Handling
It throws CB.Exception.CloudBoostException
//role is the instance of the CloudRole object. if(CloudUser.Current.IsInRole(role)) { //The current user is in the given role. } else { //The user is not in the given role. } }

Given GetRole() is discussed later

 

CloudUser.RemoveFromRole( role )

Removes the user from the given role provided in role object.

Argument
role
CloudRole Object The CloudRole object of the role you want to remove the user from.
Returns

It returns a CloudUser object having the user information of the user who was logged in.

Error Handling
It throws CB.Exception.CloudBoostException
CloudUser.Current.RemoveFromRole(role);

Given GetRole() is discussed later

 

CloudRole

As your app grows in scope and user-base, you may find yourself needing more coarse-grained control over access to pieces of your data than user-linked ACLs can provide. To address this requirement, CloudBoost supports a form of Role-based Access Control. Roles provide a logical way of grouping users with common access privileges to your CB data. Roles are named objects that contain users and other roles. Any permission granted to a role is implicitly granted to its users as well as to the users of any roles that it contains.

We provide a specialized class called CloudRole that represents these role objects in your client code. CloudRole is a subclass of CloudObject, and has all of the same features, such as a flexible schema, automatic persistence, and a key value interface. All the methods that are on CloudObject also exist on CloudRole. The difference is that CB.CloudRole has some additions specific to management of roles.

 

Constructor

Instantiates a CloudRole object.

Argument
roleName
string The name of the role you want to deal with
CloudRole role = new CB.CloudRole("Student");
 

CloudRole.GetRole( role )

Gets a CloudRole object for a given role object with name field only.

Argument
role
CloudRole object The name of the role you want to deal with
Returns
It returns a CloudRole object having the role information of the role whose name was provided in the object of role argument.
var role = new CB.CloudRole("my-collaborator"); CloudRole.GetRole(role);
 

CloudFile

CloudFile lets you store application files in the cloud that would otherwise be too large or cumbersome to fit into a regular CloudObject. The most common use case is storing images, but you can also use it for documents, videos, music, and any other binary data.

 

Constructor

Instantiates a CloudFile object.

Argument
file
byte[] objectThe file/BLOB that you want to save
Error Handling
It throws CB.Exception.CloudBoostException
byte[] data = System.Text.Encoding.UTF8.GetBytes(".net cloudfile testing!"); string name = "sample.txt"; string type = "txt"; var file = new CB.CloudFile(data, name, type); var rsponse = file.SaveAsync();
 

CloudFile.SaveAsync( )

Saves the CloudFile object.

Returns

It returns a CloudFile object having url attribute set to the URL of the blob uploaded to the server if the operation is successful.

Error Handling
It throws CB.Exception.CloudBoostException
byte[] data = System.Text.Encoding.UTF8.GetBytes(".net cloudfile testing!"); string name = "sample.txt"; string type = "txt"; var file = new CB.CloudFile(data, name, type); var rsponse = file.SaveAsync();
 

CloudFile.Delete( )

Saves the CloudFile object.

Returns

It returns a CloudFile object having url attribute set to null if the operation is successful.

Error Handling
It throws CB.Exception.CloudBoostException
byte[] data = System.Text.Encoding.UTF8.GetBytes(".net cloudfile testing!"); string name = "sample.txt"; string type = "txt"; var file = new CB.CloudFile(data, name, type); var rsponse = file.DeleteAsync();
 

CB.Column

This API allow to create a column object.

 

CB.Column(columnName, [dataType], [required], [unique])

Initialize a column.
List of valid Data Type is given below.
Reqiure is a boolean that indicate whether the field can be null or not.
Unique field is a boolean type, indicates whether should contains unique value or not.

Arguments
columnName
String Column Name should not start with a number and should not contain any spaces and special characters.
dataType
Cloud Data TypesDefault data type is Text
required
Boolean Default value is False.
unique
Boolean Default value is False.
Returns

A cloudcolumn object

var column1 = new CB.Column("name", "Text", true, false); var column2 = new CB.Column("uniqueId"); column2.dataType = "Number"; column2.unique = true; column2.required = true; var table = new CB.CloudTable("Employee"); table.AddColumn(column1); table.AddColumn(column2); await table.SaveAsync();
 

Data Types

List of Valid Data Types

  • Text
  • Number
  • Email
  • URL
  • Boolean
  • DateTime
  • GeoPoint
  • File
  • List
  • Relation
  • Object

data types are case sensitive

If you are using Relation as a data type then you need to set relatedTo property to column object.
Valid relatedTo data types for Relation is CloudTable Object i.e. just set the table name in relatedTo property.

If you are using List as a data type then you need to set relatedTo property to column object.
Valid relatedTo data types for List are:
['CloudTable Objects', 'Text', 'Email', 'URL', 'Number', 'Boolean', 'DateTime', 'Boolean', 'GeoPoint', 'File', 'Object']

var column3 = new CB.Column("department", "Relation", false, false); column3.relatedTo = "DepartmentTable"; var column4 = new CB.Column("skills", "List", false, false); column4.relatedTo = "Text"; var table = new CB.CloudTable("Employee"); table.AddColumn(column3); table.AddColumn(column4); await table.SaveAsync();
 

Required

Used to set a column as required.

var column3 = new CB.Column("department""); column3.required = true;
 

Unique

Used to set a column as unique.

var column3 = new CB.Column("department"); column3.unique = true;
 

CB.CloudTable

This API allows to create, delete, get details of a table from an App by using master-key.

 

CB.CloudTable(tableName)

All the tables are in CloudBoost is a type of CloudTable. Pass the table name as a parameter to initialize a CloudTable.

Arguments
tableName
String Table should not start with a number and should not contain any spaces and special characters.
Returns

A CloudTable object

var table = new CB.CloudTable("TableName");
 

CloudTable.GetAsync(CloudTable, [callback])

To get a table's detail of an App use get method.

Arguments
cloudtable
CloudTable Object Pass a CloudTable Object
or
CloudTable Pass a Name of CloudTable
callback
Object [optional] if provided must have success and error functions to handle respective response.
Returns

A CloudTable Object

var obj = new CB.CloudTable("Address"); CB.CloudTable table = await CB.CloudTable.GetAsync("Address");
 

CloudTable.GetAllAsync([callback])

It fetch all tables of an App.

Arguments
callback
Object [optional] if provided must have success and error functions to handle respective response.
Returns

Array of CloudTable object

List <CB.CloudTable> list = await CB.CloudTable.GetAllAsync();
 

CloudTable.AddColumn(columnObj)

Add a column to a table. go through Column to get more detail about how to initialize a column object.

Arguments
Column
Column ObjectCreate a Column object using Column Class and put this object as an Argument
or
Column NamePass the Column Name as the Argument
Returns

Void

var table = new CB.CloudTable("Student"); var column = new CB.Column("Name", "Text", false, false); table.addColumn(column); await table.SaveAsync();
 

CloudTable.DeleteColumn(columnObj)

Delete a column of a Table. go through Column to get more detail about how to initialize a Column Object.

Arguments
Column
Column ObjectCreate a column object using Column Class and put this object as an argument
or
Column NamePass the Column Name as the Argument
Returns

Void

var column = new CB.Column("Name", "Text", false, false); table.DeleteColumn(column); await table.SaveAsync();
 

CloudTable.SaveAsync([callback])

Save a CloudTable Object. It will automatically create all default columns for a table. If you want to create a user table or role table then just pass 'User' or 'Role' as an argument while creating cloudtable object.

Arguments
callback
Object [optional] if provided must have success and error functions to handle respective response.
Returns

CloudTable Object

var table = new CB.CloudTable("NewTable"); awair table.SaveAsync();
 

CloudTable.DeleteAsync([callback])

Delete a CloudTable object i.e. delete a table of an App.

Arguments
callback
Object [optional] if provided must have success and error functions to handle respective response.
Returns

Success or Error Status

var table = new CB.CloudTable("Student"); await table.DeleteAsync();
 

CloudTable.Columns

Get's all columns list.

Returns

List of Cloud Column Object

table.Columns
 

CB.ACL

Each CloudObject namespace has security option by default. By default every object can be read and modified by anyone so for each object change the security option as desidred. For any object, you can specify which users/roles are allowed to read the object, and which users/roles are allowed to modify an object. To support this type of security, each object has an access control list, implemented by the ACL class.

For each object ACL object is a property in CloudObject.ACL class.

All the modifications in the ACL can be reflected only after the object is saved after the changes.

 

Constructor

Instantiates an ACL object.

Argument

It takes no argument

Returns

It returns nothing. It is called using a variable of which various parameters are set.

var obj = new CB.CloudObject("Student"); obj.acl = new ACL();
 

ACL.SetPublicWriteAccess( value )

To allow/disallow public to write on a particular CloudObject

Argument
value
boolean
Returns

void

var obj = new CB.CloudObject("Student"); obj.acl = new ACL(); obj.acl.SetPublicWriteAccess(false); await obj.SaveAsync();
 

ACL.SetPublicReadAccess( value )

To allow/disallow public to read a particular object

Argument
value
boolean
Returns

void

var obj = new CB.CloudObject("Student"); obj.acl = new ACL(); obj.acl.SetPublicReadAccess(false); await obj.SaveAsync();
 

ACL.SetUserWriteAccess( userId, value )

To allow/disallow user having to write on a particular object.

Argument
userId
string The User ID of the user you want to set the access for
value
boolean
Returns

void

var obj = new CB.CloudObject("Student"); obj.acl = new ACL(); obj.acl.s=SetUserWriteAccess("idOfTheUser",true); await obj.SaveAsync();
 

ACL.SetUserReadAccess( userId, value )

To allow/disallow user having _id userId to read a particular object.

Argument
userId
string The user ID of the user you want to set the access for
value
boolean
Returns

It returns nothing.

var obj = new CB.CloudObject("Student"); obj.acl = new ACL(); obj.acl.SetUserReadAccess("idOfTheUser",true); await obj.SaveAsync();
 

ACL.SetRoleWriteAccess( roleId, value )

To allow/disallow users of roles roleId to write on a particular object

Argument
roleId
string The role ID of the Role you want to set the access for
value
boolean
Returns

void

var obj = new CB.CloudObject("Student"); obj.acl = new ACL(); obj.acl.SetRoleWriteAccess("roleId", true); await obj.SaveAsync();
 

ACL.SetRoleReadAccess( roleId, value )

To allow/disallow users of roles roleId to read a particular object

Argument
roleId
string The role ID of the Role you want to set the access for
value
boolean
Returns

void

var obj = new CB.CloudObject("Student"); obj.acl = new ACL(); obj.acl.SetWriteAccess("roleId", true); await obj.SaveAsync();
 

Contribute

We heart contributors. Love what we do and want to contribute?
JavaScript SDK : GitHub Repository

Our documentation is open source too!

Documentation : GitHub Repository

01001101 01100001 01100100 01100101 01110111 01101001 01110100 01101000 00111100 00110011