putkind example

{
  "id"      :  "com.forbes.articlelist:1",
  "owner"   :  "com.palm.contacts",
  "extends" :  ["PimObject:1"],
  "indexes" :  [{"name":"dname", "props":[{"name":"displayName"}]}]
}


{
  "select"  : string array,
  "from"    : string,
  "where"   : [ {
      "prop"    : string,
      "op"      : string,
      "val"     : any
  } ]
  "orderBy" : string,
  "desc"    : boolean,
  "incDel"  : boolean,
  "limit"   : integer,
  "page"    : string
}

PimObject, 2 versions


{
  "displayName"  : "John Doe",
  "name"         : {"familyName":"Doe", "givenName":"John"},
  "nickname"     : "Skippy",
  "emails"       : [ "jdoe@gmail.com", "john.doe@palm.com", "jdoe99@gmail.com" ]
}

This documentation uses a simplified form of defining JSON objects that, for the above object, would look like this:

 {
  "displayName" : string,
  "name"        : {
      "familyName" : string,
      "givenName"  : string
  },
  "nickname"    : string,
  "emails"      : string array
}


Create a kind with a schema:

     this.controller.serviceRequest("palm://com.palm.db/", {
        method: "putKind",
        parameters: { "id":"com.palm.schema.test:1",
                      "schema": {"id":"com.palm.schema.test:1", 
                                 "type": "object", 
                                 "properties" : { "_kind" : {"type": "string",
                                                             "value":"com.palm.schema.test:1"}, 
                                                    "foo": {"type": "string",
                                                            "description": "foo string"}, 
                                                    "bar": {"type": "string", 
                                                            "description": "bar string"},
                                                    "isMember": {"type": "boolean", 
                                                                 "description" : "Is member flag" }
                                                }
                                },
                    "owner":"com.palm.dbtest",
                    "indexes": [ {"name":"foo",
                                  "props":[{"name":"foo"}]},
                                {"name":"barfoo",
                                  "props":[{"name":"bar"},{"name":"foo"}] }]
        },
        onSuccess: function() { Mojo.Log.info("Schema test, putKind success!");},
        onFailure: function(e) { Mojo.Log.info("Schema test, putKind failure! Err = " + JSON.stringify(e));}
 });
 
 
 /* guid
pubDate
link
title
description 








   this.controller.serviceRequest("palm://com.palm.db/", {
        method: "put",
        parameters: {"objects": objs },
        onSuccess: function(e) { Mojo.Log.info("Schema test, put success! e=" + JSON.stringify(e));},
        onFailure: function(e) { Mojo.Log.info("Schema test, put failure! Err = " + JSON.stringify(e));}
        
        



    });
        
        