<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    Wikibase::API - Class for API to Wikibase (Wikibase) system.

SYNOPSIS
     use Wikibase::API;

     my $obj = Wikibase::API-&gt;new(%params);
     my $res = $obj-&gt;create_item($item_obj);
     my $item_obj = $obj-&gt;get_item($id);

METHODS
  "new"
     my $obj = Wikibase::API-&gt;new(%params);

    Constructor.

    Returns instance of object.

    *       "mediawiki_api"

            MediaWiki::API object.

            Default value is MediaWiki::API-&gt;new.

    *       "mediawiki_site"

            MediaWiki site.

            Default value is 'test.wikidata.org'.

    *       "login_name"

            Login name.

            Default value is undef.

    *       "login_password"

            Login password.

            Default value is undef.

  "create_item"
     my $res = $obj-&gt;create_item($item_obj)

    Create item in system. $item_obj is Wikibase::Datatype::Item instance.

    Returns reference to hash like this:

     {
             'entity' =&gt; {
                     ...
             },
             'success' =&gt; __STATUS_CODE__,
     }

  "get_item"
     my $item_obj = $obj-&gt;get_item($id);

    Get item from system.

    Returns Wikibase::Datatype::Item instance.

ERRORS
     new():
             From Class::Utils::set_params():
                     Unknown parameter '%s'.
             Cannot login.
                     Error code: %s
                     Error details: %s
             Cannot get token.
                     Error code: %s
                     Error details: %s

     create_item():
             Bad data. Must be 'Wikibase::Datatype::Item' object.

EXAMPLE1
     use strict;
     use warnings;

     use Data::Printer;
     use Wikibase::API;
     use Wikibase::Datatype::Item;

     # API object.
     my $api = Wikibase::API-&gt;new;

     # Wikibase::Datatype::Item blank object.
     my $item_obj = Wikibase::Datatype::Item-&gt;new;

     # Create item.
     my $res = $api-&gt;create_item($item_obj);

     # Dump response structure.
     p $res;

     # Output like:
     # \ {
     #     entity    {
     #         aliases        {},
     #         claims         {},
     #         descriptions   {},
     #         id             "Q213698",
     #         labels         {},
     #         lastrevid      535146,
     #         sitelinks      {},
     #         type           "item"
     #     },
     #     success   1
     # }

EXAMPLE2
     use strict;
     use warnings;

     use Data::Printer;
     use Wikibase::API;

     if (@ARGV &lt; 1) {
             print STDERR "Usage: $0 id\n";
             exit 1;
     }
     my $id = $ARGV[0];

     # API object.
     my $api = Wikibase::API-&gt;new;

     # Get item.
     my $item_obj = $api-&gt;get_item($id);

     # Dump response structure.
     p $item_obj;

     # Output for Q213698 argument like:
     # Wikibase::Datatype::Item  {
     #     Parents       Mo::Object
     #     public methods (9) : BUILD, can (UNIVERSAL), DOES (UNIVERSAL), err (Error::Pure), check_array_object (Mo::utils), check_number (Mo::utils), check_number_of_items (Mo::utils), isa (UNIVERSAL), VERSION (UNIVERSAL)
     #     private methods (1) : __ANON__ (Mo::is)
     #     internals: {
     #         aliases        [],
     #         descriptions   [],
     #         id             "Q213698",
     #         labels         [],
     #         lastrevid      535146,
     #         modified       "2020-12-11T22:26:06Z",
     #         ns             0,
     #         page_id        304259,
     #         sitelinks      [],
     #         statements     [],
     #         title          "Q213698"
     #     }
     # }

DEPENDENCIES
    Class::Utils, Error::Pure, JSON::XS, MediaWiki::API, Unicode::UTF8,
    Wikibase::Datatype::Item.

SEE ALSO
    Wikibase::Datatype
        Wikibase datatypes.

    Wikibase::Datatype::Struct
        Wikibase structure serialization.

REPOSITORY
    &lt;https://github.com/michal-josef-spacek/Wikibase-API&gt;

AUTHOR
    Michal Josef Ĺ&nbsp;paÄŤek &lt;mailto:skim@cpan.org&gt;

    &lt;http://skim.cz&gt;

LICENSE AND COPYRIGHT
    Â© 2020-2022 Michal Josef Ĺ&nbsp;paÄŤek

    BSD 2-Clause License

VERSION
    0.01

</pre></body></html>