web api preso cont.
authorBill Erickson <berickxx@gmail.com>
Fri, 8 May 2015 20:30:57 +0000 (16:30 -0400)
committerBill Erickson <berickxx@gmail.com>
Fri, 8 May 2015 20:30:57 +0000 (16:30 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
api_presentation/web_apis.asciidoc

index fb04a3f..40cc261 100644 (file)
@@ -38,6 +38,31 @@ XML file which describes the structure of Evergreen classes.
    *** oils_persist:readonly="true"
    *** Effectively an inline database view
 
+== IDL Sample
+
+[source,xml]
+---------------------------------------------------------------------------
+<class
+  id="aou"
+  controller="open-ils.cstore open-ils.pcrud"
+  oils_obj:fieldmapper="actor::org_unit"
+  oils_persist:tablename="actor.org_unit"
+  reporter:label="Organizational Unit"
+  oils_persist:field_safe="true">
+                                                                           
+  <fields oils_persist:primary="id" oils_persist:sequence="actor.org_unit_id_seq">
+    <field reporter:label="ID" name="id" reporter:datatype="id"/>
+    <field reporter:label="Name" name="name" 
+      reporter:datatype="text" oils_persist:i18n="true"/>
+    <field reporter:label="Organizational Unit Type" 
+      name="ou_type" reporter:datatype="link"/>
+  </fields>
+  <links>
+    <link field="ou_type" reltype="has_a" key="id" map="" class="aout"/>
+  </links>
+</class>
+---------------------------------------------------------------------------
+
 == IDL Virtual SQL-driven Class 
 
 [source,xml]
@@ -60,6 +85,39 @@ XML file which describes the structure of Evergreen classes.
             name="transit" oils_persist:virtual="true" />
 ---------------------------------------------------------------------------
 
+== Scripting (pre-browser client)
+
+[source,js]
+---------------------------------------------------------------------------
+var org = new fieldmapper.aou();
+org.name('foo');
+
+var class_label = fieldmapper.IDL.fmclasses.aou.label;
+
+dojo.forEach(fieldmapper.IDL.classes.aou.fields, 
+    function(field) {
+        console.log(field.name + ' ' + field.type + ' ' + field.label);
+    }
+);
+---------------------------------------------------------------------------
+
+
+== Scripting (browser client)
+
+[source,js]
+---------------------------------------------------------------------------
+var org = new egCore.idl.aou();
+org.name('foo');
+
+var class_label = egCore.idl.classes.aou.label;
+
+angular.forEach(egCore.idl.classes.aou.fields, 
+    function(field) {
+        console.log(field.name + ' ' + field.type + ' ' + field.label);
+    }
+);
+---------------------------------------------------------------------------
+
 == Accessing the IDL
 
  * Source file /openils/conf/fm_IDL.xml