API documentation for new authorities methods
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Tue, 4 Oct 2011 20:28:33 +0000 (16:28 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 6 Oct 2011 15:34:36 +0000 (11:34 -0400)
in open-ils.supercat and open-ils.storage.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/authority.pm
Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm

index f5f940a..b0cdfe4 100644 (file)
@@ -263,7 +263,29 @@ __PACKAGE__->register_method(
     api_name   => "open-ils.storage.authority.in_db.browse_or_search",
     method             => "authority_in_db_browse_or_search",
     api_level  => 1,
-    argc        => 5
+    argc        => 5,
+    signature   => {
+        desc => q/Use stored procedures to perform authorities-based
+        browses or searches/,
+        params => [
+            {name => "method", type => "string", desc => q/
+                The name of a method within the authority schema to call.  This
+                is an API call on a private service for a reason.  Do not pass
+                unfiltered user input into this API call, especially in this
+                parameter./},
+            {name => "what", type => "string", desc => q/
+                What to search. Could be an axis name, an authority tag
+                number, or a bib tag number/},
+            {name => "term", type => "string", desc => "Search term"},
+            {name => "page", type => "number", desc => "Zero-based page number"},
+            {name => "page_size", type => "number",
+                desc => "Number of records per page"}
+        ],
+        return => {
+            desc => "A list of authority record IDs",
+            type => "array"
+        }
+    }
 );
 
 sub authority_in_db_browse_or_search {
index 7d04fe2..879ba77 100644 (file)
@@ -235,6 +235,23 @@ sub register_new_authorities_methods {
         argc      => 1,
         signature => {
             desc => q/Generated method/,
+            params => [
+                {name => "what",
+                    desc => "An axis, an authority tag number, or a bibliographic tag number, depending on invocation",
+                    type => "string"},
+                {name => "term",
+                    desc => "A search term",
+                    type => "string"},
+                {name => "page",
+                    desc => "zero-based page number of results",
+                    type => "number"},
+                {name => "page size",
+                    desc => "number of results per page",
+                    type => "number"}
+            ],
+            return => {
+                desc => "A list of authority record IDs", type => "array"
+            }
         }
     );
 
@@ -260,8 +277,8 @@ sub generic_new_authorities_method {
 
     # We want to be extra careful with these arguments, since the next
     # thing we're doing with them is passing them to a DB procedure.
+    my $what = ''.shift;
     my $term = ''.shift;
-    my $value = ''.shift;
     my $page = int(shift || 0);
     my $page_size = shift;
 
@@ -281,12 +298,12 @@ sub generic_new_authorities_method {
 
     # Match authority.full_rec normalization
     # XXX don't know whether we need second arg 'subfield'?
-    $value = naco_normalize($value);
+    $term = naco_normalize($term);
 
     my $storage = create OpenSRF::AppSession("open-ils.storage");
     my $list = $storage->request(
         "open-ils.storage.authority.in_db.browse_or_search",
-        $method, $term, $value, $page, $page_size
+        $method, $what, $term, $page, $page_size
     )->gather(1);
 
     $storage->kill_me;