WWW-Zotero-0.04000755000765000024 013107333417 13502 5ustar00hochstenstaff000000000000README100644000765000024 2231213107333417 14463 0ustar00hochstenstaff000000000000WWW-Zotero-0.04NAME WWW::Zotero - Perl interface to the Zotero API SYNOPSIS use WWW::Zotero; my $client = WWW::Zotero->new; my $client = WWW::Zotero->new(key => 'API-KEY'); my $data = $client->itemTypes(); for my $item (@$data) { print "%s\n" , $item->itemType; } my $data = $client->itemFields(); my $data = $client->itemTypeFields('book'); my $data = $client->itemTypeCreatorTypes('book'); my $data = $client->creatorFields(); my $data = $client->itemTemplate('book'); my $key = $client->keyPermissions(); my $groups = $client->userGroups($userID); my $data = $client->listItems(user => '475425', limit => 5); my $data = $client->listItems(user => '475425', format => 'atom'); my $generator = $client->listItems(user => '475425', generator => 1); while (my $item = $generator->()) { print "%s\n" , $item->{title}; } my $data = $client->listItemsTop(user => '475425', limit => 5); my $data = $client->listItemsTrash(user => '475425'); my $data = $client->getItem(user => '475425', itemKey => 'TTJFTW87'); my $data = $client->getItemTags(user => '475425', itemKey => 'X42A7DEE'); my $data = $client->listTags(user => '475425'); my $data = $client->listTags(user => '475425', tag => 'Biography'); my $data = $client->listCollections(user => '475425'); my $data = $client->listCollectionsTop(user => '475425'); my $data = $client->getCollection(user => '475425', collectionKey => 'A5G9W6AX'); my $data = $client->listSubCollections(user => '475425', collectionKey => 'QM6T3KHX'); my $data = $client->listCollectionItems(user => '475425', collectionKey => 'QM6T3KHX'); my $data = $client->listCollectionItemsTop(user => '475425', collectionKey => 'QM6T3KHX'); my $data = $client->listCollectionItemsTags(user => '475425', collectionKey => 'QM6T3KHX'); my $data = $client->listSearches(user => '475425'); CONFIGURATION baseurl The base URL for all API requests. Default 'https://api.zotero.org'. version The API version. Default '3'. key The API key which can be requested via https://api.zotero.org. modified_since Include a UNIX time to be used in a If-Modified-Since header to allow for caching of results by your application. METHODS username2userID Find the userID based on a username itemTypes() Get all item types. Returns a Perl array. itemTypes() Get all item fields. Returns a Perl array. itemTypes($type) Get all valid fields for an item type. Returns a Perl array. itemTypeCreatorTypes($type) Get valid creator types for an item type. Returns a Perl array. creatorFields() Get localized creator fields. Returns a Perl array. itemTemplate($type) Get a template for a new item. Returns a Perl hash. keyPermissions($key) Return the userID and premissions for the given API key. userGroups($userID) Return an array of the set of groups the current API key as access to. listItems(user => $userID, %options) listItems(group => $groupID, %options) List all items for a user or ar group. Optionally provide a list of options: sort - dateAdded, dateModified, title, creator, type, date, publisher, publicationTitle, journalAbbreviation, language, accessDate, libraryCatalog, callNumber, rights, addedBy, numItems (default dateModified) direction - asc, desc limit - integer 1-100* (default 25) start - integer format - perl, atom, bib, json, keys, versions , bibtex , bookmarks, coins, csljson, mods, refer, rdf_bibliontology , rdf_dc , rdf_zotero, ris , tei , wikipedia (default perl) when format => 'json' include - bib, data when format => 'atom' content - bib, html, json when format => 'bib' or content => 'bib' style - chicago-note-bibliography, apa, ... (see: https://www.zotero.org/styles/) itemKey - A comma-separated list of item keys. Valid only for item requests. Up to 50 items can be specified in a single request. itemType - Item type search q - quick search qmode - titleCreatorYear, everything since - integer tag - Tag search See: https://www.zotero.org/support/dev/web_api/v3/basics#user_and_group_library_urls for the search syntax. Returns a Perl HASH containing the total number of hits plus the results: { total => '132', results => } listItems(user => $userID | group => $groupID, generator => 1 , %options) Same as listItems but this return a generator for every record found. Use this method to sequentially read the complete resultset. E.g. my $generator = $self->listItems(user => '231231', generator); while (my $record = $generator->()) { printf "%s\n" , $record->{title}; } The format is implicit 'perl' in this case. listItemsTop(user => $userID | group => $groupID, %options) The set of all top-level items in the library, excluding trashed items. See 'listItems(...)' functions above for all the execution options. listItemsTrash(user => $userID | group => $groupID, %options) The set of items in the trash. See 'listItems(...)' functions above for all the execution options. getItem(itemKey => ... , user => $userID | group => $groupID, %options) A specific item in the library. See 'listItems(...)' functions above for all the execution options. Returns the item if found. getItemChildren(itemKey => ... , user => $userID | group => $groupID, %options) The set of all child items under a specific item. See 'listItems(...)' functions above for all the execution options. Returns the children if found. getItemTags(itemKey => ... , user => $userID | group => $groupID, %options) The set of all tags associated with a specific item. See 'listItems(...)' functions above for all the execution options. Returns the tags if found. listTags(user => $userID | group => $groupID, [tag => $name] , %options) The set of tags (i.e., of all types) matching a specific name. See 'listItems(...)' functions above for all the execution options. Returns the list of tags. listCollections(user => $userID | group => $groupID , %options) The set of all collections in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of collections. listCollectionsTop(user => $userID | group => $groupID , %options) The set of all top-level collections in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of collections. getCollection(collectionKey => ... , user => $userID | group => $groupID, %options) A specific item in the library. See 'listItems(...)' functions above for all the execution options. Returns the collection if found. listSubCollections(collectionKey => ...., user => $userID | group => $groupID , %options) The set of subcollections within a specific collection in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of (sub)collections. listCollectionItems(collectionKey => ...., user => $userID | group => $groupID , %options) The set of all items within a specific collection in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of items. listCollectionItemsTop(collectionKey => ...., user => $userID | group => $groupID , %options) The set of top-level items within a specific collection in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of items. listCollectionItemsTags(collectionKey => ...., user => $userID | group => $groupID , %options) The set of tags within a specific collection in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of items. listSearches(user => $userID | group => $groupID , %options) The set of all saved searches in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of saved searches. getSearch(searchKey => ... , user => $userID | group => $groupID, %options) A specific saved search in the library. See 'listItems(...)' functions above for all the execution options. Returns the saved search if found. AUTHOR Patrick Hochstenbach, CONTRIBUTORS François Rappaz LICENSE AND COPYRIGHT Copyright 2015 Patrick Hochstenbach This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. Changes100644000765000024 54413107333417 15041 0ustar00hochstenstaff000000000000WWW-Zotero-0.04Revision history for WWW-Zotero 0.04 2017-05-18 17:00:29 CEST - Adding support to find the userID from a username - Fixing last item bug (thanks François Rappaz) 0.03 2015-09-24 21:23:43 CEST - Fixed tests - Fixed undef responses 0.02 2015-09-24 20:59:19 CEST - Fix test dependencies 0.01 2015-09-24 14:55:28 CEST - Initial version LICENSE100644000765000024 4370513107333417 14621 0ustar00hochstenstaff000000000000WWW-Zotero-0.04This software is copyright (c) 2017 by Patrick Hochstenbach. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2017 by Patrick Hochstenbach. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2017 by Patrick Hochstenbach. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End cpanfile100644000765000024 66713107333417 15260 0ustar00hochstenstaff000000000000WWW-Zotero-0.04requires 'perl', 'v5.10.1'; on 'test', sub { requires 'Test::Simple', '1.001003'; requires 'Test::More', '1.001003'; requires 'Test::Exception','0.32'; requires 'Test::Pod','0'; }; requires 'Moo', '>=1.0'; requires 'REST::Client', '0'; requires 'JSON', '0'; requires 'URI::Escape', '0'; requires 'Log::Any', '0'; requires 'Carp', '0'; # Need recent SSL to talk to https endpoint correctly requires 'IO::Socket::SSL', '>=1.993'; dist.ini100644000765000024 3413107333417 15164 0ustar00hochstenstaff000000000000WWW-Zotero-0.04name = WWW-Zotero [@Milla] Build.PL100644000765000024 25713107333417 15043 0ustar00hochstenstaff000000000000WWW-Zotero-0.04# This Build.PL for WWW-Zotero was generated by Dist::Zilla::Plugin::ModuleBuildTiny 0.015. use strict; use warnings; use v5.10.1; use Module::Build::Tiny 0.034; Build_PL(); META.yml100644000765000024 210413107333417 15031 0ustar00hochstenstaff000000000000WWW-Zotero-0.04--- abstract: 'Perl interface to the Zotero API' author: - 'Patrick Hochstenbach, C<< >>' build_requires: Test::Exception: '0.32' Test::More: '1.001003' Test::Pod: '0' Test::Simple: '1.001003' configure_requires: Module::Build::Tiny: '0.034' dynamic_config: 0 generated_by: 'Dist::Milla version v1.0.17, Dist::Zilla version 6.008, CPAN::Meta::Converter version 2.150005' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: WWW-Zotero no_index: directory: - eg - examples - inc - share - t - xt requires: Carp: '0' IO::Socket::SSL: '1.993' JSON: '0' Log::Any: '0' Moo: '1.0' REST::Client: '0' URI::Escape: '0' perl: v5.10.1 resources: bugtracker: https://github.com/phochste/WWW-Zotero/issues homepage: https://github.com/phochste/WWW-Zotero repository: https://github.com/phochste/WWW-Zotero.git version: '0.04' x_contributors: - 'Patrick Hochstenbach ' x_serialization_backend: 'YAML::Tiny version 1.69' MANIFEST100644000765000024 32613107333417 14675 0ustar00hochstenstaff000000000000WWW-Zotero-0.04# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.008. Build.PL Changes LICENSE MANIFEST META.json META.yml README cpanfile dist.ini lib/WWW/Zotero.pm t/WWW-Zotero.t t/author-pod-syntax.t META.json100644000765000024 367613107333417 15220 0ustar00hochstenstaff000000000000WWW-Zotero-0.04{ "abstract" : "Perl interface to the Zotero API", "author" : [ "Patrick Hochstenbach, C<< >>" ], "dynamic_config" : 0, "generated_by" : "Dist::Milla version v1.0.17, Dist::Zilla version 6.008, CPAN::Meta::Converter version 2.150005", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "WWW-Zotero", "no_index" : { "directory" : [ "eg", "examples", "inc", "share", "t", "xt" ] }, "prereqs" : { "configure" : { "requires" : { "Module::Build::Tiny" : "0.034" } }, "develop" : { "requires" : { "Dist::Milla" : "v1.0.17", "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "Carp" : "0", "IO::Socket::SSL" : "1.993", "JSON" : "0", "Log::Any" : "0", "Moo" : "1.0", "REST::Client" : "0", "URI::Escape" : "0", "perl" : "v5.10.1" } }, "test" : { "requires" : { "Test::Exception" : "0.32", "Test::More" : "1.001003", "Test::Pod" : "0", "Test::Simple" : "1.001003" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/phochste/WWW-Zotero/issues" }, "homepage" : "https://github.com/phochste/WWW-Zotero", "repository" : { "type" : "git", "url" : "https://github.com/phochste/WWW-Zotero.git", "web" : "https://github.com/phochste/WWW-Zotero" } }, "version" : "0.04", "x_contributors" : [ "Patrick Hochstenbach " ], "x_serialization_backend" : "Cpanel::JSON::XS version 3.0225" } t000755000765000024 013107333417 13666 5ustar00hochstenstaff000000000000WWW-Zotero-0.04WWW-Zotero.t100644000765000024 1413713107333417 16205 0ustar00hochstenstaff000000000000WWW-Zotero-0.04/t#!perl use strict; use warnings; use Test::More; my $key = $ENV{ZOTERO_API_KEY}; # use Log::Any::Adapter; # use Log::Log4perl; # Log::Any::Adapter->set('Log4perl'); # Log::Log4perl::init('./log4perl.conf'); BEGIN { use_ok 'WWW::Zotero'; } require_ok 'WWW::Zotero'; my $client = WWW::Zotero->new(modified_since => time, key => $key); ok $client , 'got a client'; if ($ENV{RELEASE_TESTING}) { { my $userID = $client->username2userID('hochstenbach'); is $userID , '686898', 'username2userID - got an ID'; } { my $data = $client->itemTypes(); is ref($data), 'ARRAY' , 'itemTypes - got an array'; ok @$data > 0 , 'itemTypes - got an array > 0'; } sleep 1; { my $data = $client->itemFields(); is ref($data), 'ARRAY' , 'itemFields - got an array'; ok @$data > 0 , 'itemFields - got an array > 0'; } sleep 1; { my $data = $client->itemTypeFields('book'); is ref($data), 'ARRAY' , 'itemTypeFields - got an array'; ok @$data > 0 , 'itemTypeFields - got an array > 0'; } sleep 1; { my $data = $client->itemTypeCreatorTypes('book'); is ref($data), 'ARRAY' , 'itemTypeCreatorTypes - got an array'; ok @$data > 0 , 'itemTypeCreatorTypes - got an array > 0'; } sleep 1; { my $data = $client->creatorFields(); is ref($data), 'ARRAY' , 'creatorFields - got an array'; ok @$data > 0 , 'creatorFields - got an array > 0'; } sleep 1; { my $data = $client->itemTemplate('book'); is ref($data), 'HASH' , 'itemTemplate - got a hash'; ok keys %$data > 0 , 'itemTemplate - got a hash with content'; } sleep 1; if ($ENV{ZOTERO_API_KEY}) { my $key = $client->keyPermissions(); is ref($key), 'HASH' , 'keyPermissions - got a hash'; ok keys %$key > 0 , 'keyPermissions - got a hash with content'; my $userID = $key->{userID}; ok $userID , 'got a userid'; my $groups = $client->userGroups($userID); is ref($groups), 'ARRAY' , 'userGroups - got an array'; ok @$groups > 0 , 'userGroups - got a array with content'; } sleep 1; { my $data = $client->listItems(user => '475425', limit => 5); is ref($data) , 'HASH' , 'listItems - got a hash'; ok $data->{total} , 'listItems - got a total'; ok @{$data->{results}} > 0 , 'listItems - got a result'; } sleep 1; { my $data = $client->listItems(user => '475425', format => 'atom'); is ref($data) , 'HASH' , 'listItems - got a hash'; ok $data->{total} , 'listItems - got a total'; like $data->{results} , qr/.*<\?xml version="1.0" encoding="UTF-8"\?>.*/ , 'atom reponse'; } sleep 1; { my $generator = $client->listItems(user => '475425', generator => 1); is ref($generator) , 'CODE' , 'listItems - got a generator'; my $result = $generator->(); is ref($result) , 'HASH' , 'listItems - read one from the generator'; ok $result->{_id} , 'result has an _id'; } sleep 1; { my $data = $client->listItemsTop(user => '475425', limit => 5); is ref($data) , 'HASH' , 'listItems - got a hash'; ok $data->{total} , 'listItems - got a total'; ok @{$data->{results}} > 0 , 'listItems - got a result'; } sleep 1; { my $data = $client->listItemsTrash(user => '475425'); is ref($data) , 'HASH' , 'listItems - got a hash'; ok $data->{total} >= 0 , 'listItems - got a total'; } sleep 1; { my $data = $client->getItem(user => '475425', itemKey => 'TTJFTW87'); is ref($data) , 'HASH' , 'getItem - got a hash'; } sleep 1; { my $data = $client->getItemTags(user => '475425', itemKey => 'X42A7DEE'); is ref($data) , 'ARRAY' , 'getItemTags - got an array'; } sleep 1; { my $data = $client->listTags(user => '475425'); is ref($data) , 'HASH' , 'listTags - got a hash'; ok $data->{total} , 'listTags - got a total'; ok @{$data->{results}} > 0 , 'listTags - got a result'; } sleep 1; { my $data = $client->listTags(user => '475425', tag => 'Biography'); is ref($data) , 'HASH' , 'listTags(Biography) - got a hash'; ok $data->{total} , 'listTags(Biography) - got a total'; ok @{$data->{results}} > 0 , 'listTags(Biography) - got a result'; } sleep 1; { my $data = $client->listCollections(user => '475425'); is ref($data) , 'HASH' , 'listCollections - got a hash'; ok $data->{total} , 'listCollections - got a total'; ok @{$data->{results}} > 0 , 'listCollections - got a result'; } sleep 1; { my $data = $client->listCollectionsTop(user => '475425'); is ref($data) , 'HASH' , 'listCollectionsTop - got a hash'; ok $data->{total} , 'listCollectionsTop - got a total'; ok @{$data->{results}} > 0 , 'listCollectionsTop - got a result'; } sleep 1; { my $data = $client->getCollection(user => '475425', collectionKey => 'A5G9W6AX'); is ref($data) , 'HASH' , 'getCollection - got a hash'; } sleep 1; { my $data = $client->listSubCollections(user => '475425', collectionKey => 'QM6T3KHX'); is ref($data) , 'HASH' , 'listSubCollections - got a hash'; ok $data->{total} , 'listCollectionsTop - got a total'; ok @{$data->{results}} > 0 , 'listCollectionsTop - got a result'; } sleep 1; { my $data = $client->listCollectionItems(user => '475425', collectionKey => 'QM6T3KHX'); is ref($data) , 'HASH' , 'listCollectionItems - got a hash'; ok $data->{total} , 'listCollectionItems - got a total'; ok @{$data->{results}} > 0 , 'listCollectionItems - got a result'; } sleep 1; { my $data = $client->listCollectionItemsTop(user => '475425', collectionKey => 'QM6T3KHX'); is ref($data) , 'HASH' , 'listCollectionItemsTop - got a hash'; ok $data->{total} , 'listCollectionItemsTop - got a total'; ok @{$data->{results}} > 0 , 'listCollectionItemsTop - got a result'; } sleep 1; { my $data = $client->listCollectionItemsTags(user => '475425', collectionKey => 'QM6T3KHX'); is ref($data) , 'HASH' , 'listCollectionItemsTags - got a hash'; ok $data->{total} , 'listCollectionItemsTags - got a total'; ok @{$data->{results}} > 0 , 'listCollectionItemsTags - got a result'; } sleep 1; { my $data = $client->listSearches(user => '475425'); is ref($data) , 'HASH' , 'listSearches - got a hash'; ok $data->{total} , 'listSearches - got a total'; ok @{$data->{results}} > 0 , 'listSearches - got a result'; } sleep 1; } done_testing;WWW000755000765000024 013107333417 14655 5ustar00hochstenstaff000000000000WWW-Zotero-0.04/libZotero.pm100644000765000024 4733513107333417 16671 0ustar00hochstenstaff000000000000WWW-Zotero-0.04/lib/WWWpackage WWW::Zotero; =pod =encoding utf-8 =head1 NAME WWW::Zotero - Perl interface to the Zotero API =head1 SYNOPSIS use WWW::Zotero; my $client = WWW::Zotero->new; my $client = WWW::Zotero->new(key => 'API-KEY'); my $data = $client->itemTypes(); for my $item (@$data) { print "%s\n" , $item->itemType; } my $data = $client->itemFields(); my $data = $client->itemTypeFields('book'); my $data = $client->itemTypeCreatorTypes('book'); my $data = $client->creatorFields(); my $data = $client->itemTemplate('book'); my $key = $client->keyPermissions(); my $groups = $client->userGroups($userID); my $data = $client->listItems(user => '475425', limit => 5); my $data = $client->listItems(user => '475425', format => 'atom'); my $generator = $client->listItems(user => '475425', generator => 1); while (my $item = $generator->()) { print "%s\n" , $item->{title}; } my $data = $client->listItemsTop(user => '475425', limit => 5); my $data = $client->listItemsTrash(user => '475425'); my $data = $client->getItem(user => '475425', itemKey => 'TTJFTW87'); my $data = $client->getItemTags(user => '475425', itemKey => 'X42A7DEE'); my $data = $client->listTags(user => '475425'); my $data = $client->listTags(user => '475425', tag => 'Biography'); my $data = $client->listCollections(user => '475425'); my $data = $client->listCollectionsTop(user => '475425'); my $data = $client->getCollection(user => '475425', collectionKey => 'A5G9W6AX'); my $data = $client->listSubCollections(user => '475425', collectionKey => 'QM6T3KHX'); my $data = $client->listCollectionItems(user => '475425', collectionKey => 'QM6T3KHX'); my $data = $client->listCollectionItemsTop(user => '475425', collectionKey => 'QM6T3KHX'); my $data = $client->listCollectionItemsTags(user => '475425', collectionKey => 'QM6T3KHX'); my $data = $client->listSearches(user => '475425'); =cut use Moo; use JSON; use URI::Escape; use REST::Client; use Data::Dumper; use POSIX qw(strftime); use Carp; use Log::Any (); use feature 'state'; our $VERSION = '0.04'; =head1 CONFIGURATION =over 4 =item baseurl The base URL for all API requests. Default 'https://api.zotero.org'. =item version The API version. Default '3'. =item key The API key which can be requested via https://api.zotero.org. =item modified_since Include a UNIX time to be used in a If-Modified-Since header to allow for caching of results by your application. =back =cut has baseurl => (is => 'ro' , default => sub { 'https://api.zotero.org' }); has modified_since => (is => 'ro'); has version => (is => 'ro' , default => sub { '3'}); has key => (is => 'ro'); has code => (is => 'rw'); has sleep => (is => 'rw' , default => sub { 0 }); has log => (is => 'lazy'); has client => (is => 'lazy'); sub _build_client { my ($self) = @_; my $client = REST::Client->new(); $self->log->debug("< Zotero-API-Version: " . $self->version); $client->addHeader('Zotero-API-Version', $self->version); if (defined $self->key) { my $authorization = 'Bearer ' . $self->key; $self->log->debug("< Authorization: " . $authorization); $client->addHeader('Authorization', $authorization); } if (defined $self->modified_since) { my $date = strftime "%a, %d %b %Y %H:%M:%S GMT" , gmtime($self->modified_since); $self->log->debug("< If-Modified-Since: " . $date); $client->addHeader('If-Modified-Since',$date); } $client; } sub _build_log { my ($self) = @_; Log::Any->get_logger(category => ref($self)); } sub _zotero_get_request { my ($self,$path,%param) = @_; my $url = sprintf "%s%s" , $self->baseurl, $path; my @params = (); for my $name (keys %param) { my $value = $param{$name}; push @params , uri_escape($name) . "=" . uri_escape($value); } $url .= '?' . join("&",@params) if @params > 0; # The server asked us to sleep.. if ($self->sleep > 0) { $self->log->debug("sleeping: " . $self->sleep . " seconds"); sleep $self->sleep; $self->sleep(0) } $self->log->debug("requesting: $url"); my $response = $self->client->GET($url); my $backoff = $response->responseHeader('Backoff') // 0; my $retryAfter = $response->responseHeader('Retry-After') // 0; my $code = $response->responseCode(); $self->log->debug("> Code: $code"); $self->log->debug("> Backoff: $backoff"); $self->log->debug("> Retry-After: $retryAfter"); if ($backoff > 0) { $self->sleep($backoff); } elsif ($code eq '429' || $code eq '503') { $self->sleep($retryAfter // 60); return undef; } $self->log->debug("> Content: " . $response->responseContent); $self->code($code); return undef unless $code eq '200'; $response; } =head1 METHODS =cut =head2 username2userID Find the userID based on a username =cut sub username2userID { my ($self,$username) = @_; croak "username2userID: need username" unless defined $username; my $url = sprintf "https://www.zotero.org/%s" , uri_escape($username); my $response = $self->client->GET($url); return undef unless $response->responseCode() eq '200'; my $content = $response->responseContent; if ($content =~ /profileUserID:\s*(\d+)/) { return $1; } else { return undef; } } =head2 itemTypes() Get all item types. Returns a Perl array. =cut sub itemTypes { my ($self) = @_; my $response = $self->_zotero_get_request('/itemTypes'); return undef unless $response; decode_json $response->responseContent; } =head2 itemTypes() Get all item fields. Returns a Perl array. =cut sub itemFields { my ($self) = @_; my $response = $self->_zotero_get_request('/itemFields'); return undef unless $response; decode_json $response->responseContent; } =head2 itemTypes($type) Get all valid fields for an item type. Returns a Perl array. =cut sub itemTypeFields { my ($self,$itemType) = @_; croak "itemTypeFields: need itemType" unless defined $itemType; my $response = $self->_zotero_get_request('/itemTypeFields', itemType => $itemType); return undef unless $response; decode_json $response->responseContent; } =head2 itemTypeCreatorTypes($type) Get valid creator types for an item type. Returns a Perl array. =cut sub itemTypeCreatorTypes { my ($self,$itemType) = @_; croak "itemTypeCreatorTypes: need itemType" unless defined $itemType; my $response = $self->_zotero_get_request('/itemTypeCreatorTypes', itemType => $itemType); return undef unless $response; decode_json $response->responseContent; } =head2 creatorFields() Get localized creator fields. Returns a Perl array. =cut sub creatorFields { my ($self) = @_; my $response = $self->_zotero_get_request('/creatorFields'); return undef unless $response; decode_json $response->responseContent; } =head2 itemTemplate($type) Get a template for a new item. Returns a Perl hash. =cut sub itemTemplate { my ($self,$itemType) = @_; croak "itemTemplate: need itemType" unless defined $itemType; my $response = $self->_zotero_get_request('/items/new', itemType => $itemType); return undef unless $response; decode_json $response->responseContent; } =head2 keyPermissions($key) Return the userID and premissions for the given API key. =cut sub keyPermissions { my ($self,$key) = @_; $key = $self->key unless defined $key; croak "keyPermissions: need key" unless defined $key; my $response = $self->_zotero_get_request("/keys/$key"); return undef unless $response; decode_json $response->responseContent; } =head2 userGroups($userID) Return an array of the set of groups the current API key as access to. =cut sub userGroups { my ($self,$userID) = @_; croak "userGroups: need userID" unless defined $userID; my $response = $self->_zotero_get_request("/users/$userID/groups"); return undef unless $response; decode_json $response->responseContent; } =head2 listItems(user => $userID, %options) =head2 listItems(group => $groupID, %options) List all items for a user or ar group. Optionally provide a list of options: sort - dateAdded, dateModified, title, creator, type, date, publisher, publicationTitle, journalAbbreviation, language, accessDate, libraryCatalog, callNumber, rights, addedBy, numItems (default dateModified) direction - asc, desc limit - integer 1-100* (default 25) start - integer format - perl, atom, bib, json, keys, versions , bibtex , bookmarks, coins, csljson, mods, refer, rdf_bibliontology , rdf_dc , rdf_zotero, ris , tei , wikipedia (default perl) when format => 'json' include - bib, data when format => 'atom' content - bib, html, json when format => 'bib' or content => 'bib' style - chicago-note-bibliography, apa, ... (see: https://www.zotero.org/styles/) itemKey - A comma-separated list of item keys. Valid only for item requests. Up to 50 items can be specified in a single request. itemType - Item type search q - quick search qmode - titleCreatorYear, everything since - integer tag - Tag search See: https://www.zotero.org/support/dev/web_api/v3/basics#user_and_group_library_urls for the search syntax. Returns a Perl HASH containing the total number of hits plus the results: { total => '132', results => } =head2 listItems(user => $userID | group => $groupID, generator => 1 , %options) Same as listItems but this return a generator for every record found. Use this method to sequentially read the complete resultset. E.g. my $generator = $self->listItems(user => '231231', generator); while (my $record = $generator->()) { printf "%s\n" , $record->{title}; } The format is implicit 'perl' in this case. =cut sub listItems { my ($self,%options) = @_; $self->_listItems(%options, path => 'items'); } sub _listItems { my ($self,%options) = @_; my $userID = $options{user}; my $groupID = $options{group}; croak "listItems: need user or group" unless defined $userID || defined $groupID; my $id = defined $userID ? $userID : $groupID; my $type = defined $userID ? 'users' : 'groups'; my $generator = $options{generator}; my $path = $options{path}; delete $options{generator}; delete $options{path}; delete $options{user}; delete $options{group}; delete $options{format} if exists $options{format} && $options{format} eq 'perl'; $options{limit} = 25 unless defined $options{limit}; if ($generator) { delete $options{format}; $options{start} = 0 unless defined $options{start}; return sub { state $response = $self->_listItems_request("/$type/$id/$path", %options); state $idx = 0; return undef unless defined $response; return undef if $response->{total} == 0; return undef if $options{start} + $idx + 1 > $response->{total}; unless (defined $response->{results}->[$idx]) { $options{start} += $options{limit}; $response = $self->_listItems_request("/$type/$id/$path", %options); $idx = 0; } return undef unless defined $response; my $doc = $response->{results}->[$idx]; my $id = $doc->{key}; $idx++; { _id => $id , %$doc }; }; } else { return $self->_listItems_request("/$type/$id/$path", %options); } } sub _listItems_request { my ($self,$path,%options) = @_; my $response = $self->_zotero_get_request($path, %options); return undef unless defined $response; my $total = $response->responseHeader('Total-Results'); my $link = $response->responseHeader('Link'); $self->log->debug("> Total-Results: $total") if defined $total; $self->log->debug("> Link: $link") if defined $link; my $results = $response->responseContent; return undef unless $results; if (! defined $options{format} || $options{format} eq 'perl') { $results = decode_json $results; } return { total => $total, results => $results }; } =head2 listItemsTop(user => $userID | group => $groupID, %options) The set of all top-level items in the library, excluding trashed items. See 'listItems(...)' functions above for all the execution options. =cut sub listItemsTop { my ($self,%options) = @_; $self->_listItems(%options, path => 'items/top'); } =head2 listItemsTrash(user => $userID | group => $groupID, %options) The set of items in the trash. See 'listItems(...)' functions above for all the execution options. =cut sub listItemsTrash { my ($self,%options) = @_; $self->_listItems(%options, path => 'items/trash'); } =head2 getItem(itemKey => ... , user => $userID | group => $groupID, %options) A specific item in the library. See 'listItems(...)' functions above for all the execution options. Returns the item if found. =cut sub getItem { my ($self,%options) = @_; my $key = $options{itemKey}; croak "getItem: need itemKey" unless defined $key; delete $options{itemKey}; my $result = $self->_listItems(%options, path => "items/$key"); return undef unless defined $result; $result->{results}; } =head2 getItemChildren(itemKey => ... , user => $userID | group => $groupID, %options) The set of all child items under a specific item. See 'listItems(...)' functions above for all the execution options. Returns the children if found. =cut sub getItemChildren { my ($self,%options) = @_; my $key = $options{itemKey}; croak "getItem: need itemKey" unless defined $key; delete $options{itemKey}; my $result = $self->_listItems(%options, path => "items/$key/children"); return undef unless defined $result; $result->{results}; } =head2 getItemTags(itemKey => ... , user => $userID | group => $groupID, %options) The set of all tags associated with a specific item. See 'listItems(...)' functions above for all the execution options. Returns the tags if found. =cut sub getItemTags { my ($self,%options) = @_; my $key = $options{itemKey}; croak "getItem: need itemKey" unless defined $key; delete $options{itemKey}; my $result = $self->_listItems(%options, path => "items/$key/tags"); return undef unless defined $result; $result->{results}; } =head2 listTags(user => $userID | group => $groupID, [tag => $name] , %options) The set of tags (i.e., of all types) matching a specific name. See 'listItems(...)' functions above for all the execution options. Returns the list of tags. =cut sub listTags { my ($self,%options) = @_; my $tag = $options{tag}; delete $options{tag}; my $path = defined $tag ? "tags/" . uri_escape($tag) : "tags"; $self->_listItems(%options, path => $path); } =head2 listCollections(user => $userID | group => $groupID , %options) The set of all collections in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of collections. =cut sub listCollections { my ($self,%options) = @_; $self->_listItems(%options, path => "/collections"); } =head2 listCollectionsTop(user => $userID | group => $groupID , %options) The set of all top-level collections in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of collections. =cut sub listCollectionsTop { my ($self,%options) = @_; $self->_listItems(%options, path => "collections/top"); } =head2 getCollection(collectionKey => ... , user => $userID | group => $groupID, %options) A specific item in the library. See 'listItems(...)' functions above for all the execution options. Returns the collection if found. =cut sub getCollection { my ($self,%options) = @_; my $key = $options{collectionKey}; croak "getCollection: need collectionKey" unless defined $key; delete $options{collectionKey}; my $result = $self->_listItems(%options, path => "collections/$key"); return undef unless defined $result; $result->{results}; } =head2 listSubCollections(collectionKey => ...., user => $userID | group => $groupID , %options) The set of subcollections within a specific collection in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of (sub)collections. =cut sub listSubCollections { my ($self,%options) = @_; my $key = $options{collectionKey}; croak "listSubCollections: need collectionKey" unless defined $key; delete $options{collectionKey}; $self->_listItems(%options, path => "collections/$key/collections"); } =head2 listCollectionItems(collectionKey => ...., user => $userID | group => $groupID , %options) The set of all items within a specific collection in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of items. =cut sub listCollectionItems { my ($self,%options) = @_; my $key = $options{collectionKey}; croak "listCollectionItems: need collectionKey" unless defined $key; delete $options{collectionKey}; $self->_listItems(%options, path => "collections/$key/items"); } =head2 listCollectionItemsTop(collectionKey => ...., user => $userID | group => $groupID , %options) The set of top-level items within a specific collection in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of items. =cut sub listCollectionItemsTop { my ($self,%options) = @_; my $key = $options{collectionKey}; croak "listCollectionItemsTop: need collectionKey" unless defined $key; delete $options{collectionKey}; $self->_listItems(%options, path => "collections/$key/items/top"); } =head2 listCollectionItemsTags(collectionKey => ...., user => $userID | group => $groupID , %options) The set of tags within a specific collection in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of items. =cut sub listCollectionItemsTags { my ($self,%options) = @_; my $key = $options{collectionKey}; croak "listCollectionItemsTop: need collectionKey" unless defined $key; delete $options{collectionKey}; $self->_listItems(%options, path => "collections/$key/tags"); } =head2 listSearches(user => $userID | group => $groupID , %options) The set of all saved searches in the library. See 'listItems(...)' functions above for all the execution options. Returns the list of saved searches. =cut sub listSearches { my ($self,%options) = @_; $self->_listItems(%options, path => "searches"); } =head2 getSearch(searchKey => ... , user => $userID | group => $groupID, %options) A specific saved search in the library. See 'listItems(...)' functions above for all the execution options. Returns the saved search if found. =cut sub getSearch { my ($self,%options) = @_; my $key = $options{searchKey}; croak "getSearch: need searchKey" unless defined $key; delete $options{searchKey}; my $result = $self->_listItems(%options, path => "search/$key"); return undef unless defined $result; $result->{results}; } =head1 AUTHOR Patrick Hochstenbach, C<< >> =head1 CONTRIBUTORS François Rappaz =head1 LICENSE AND COPYRIGHT Copyright 2015 Patrick Hochstenbach This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information. =cut 1; author-pod-syntax.t100644000765000024 45413107333417 17604 0ustar00hochstenstaff000000000000WWW-Zotero-0.04/t#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { print qq{1..0 # SKIP these tests are for testing by the author\n}; exit } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok();