package Catmandu::Store::Adlib;

use strict;
use warnings;

use Moo;
use Catmandu::Sane;

use Catmandu::Store::Adlib::Bag;

with 'Catmandu::Store';

has endpoint => (is => 'ro', required => 1);
has username => (is => 'ro', required => 1);
has password => (is => 'ro', required => 1);
has database => (is => 'ro', required => 1);


=encoding utf-8

=head1 NAME

Catmandu::Store::Adlib -Retrieve items from a L<Adlib|> instance


    # From the command line
    catmandu export Adlib to YAML --id 1234 --endpoint --username foo --password bar --database collect.inf

    # From a Catmandu Fix
      username: foo,
      password: bar,
      database: collect.inf

    # From Perl code
    use Catmandu;

    my $store = Catmandu->store('Adlib',
        username => 'foo',
        password => 'bar',
        endpoint => '',
        database => 'collect.inf'

    my $item = $store->get('1234');


Catmandu::Store::Adlib allows the use of L<Adlib|> as a store in Catmandu.


=head2 endpoint

C<url> of the Adlib API. Do not include the C<api/wwwopac> part; the query builder will append it automatically.

=head2 database

Name of the database (as configured in L<adlibweb.xml|>) you want to query.

=head2 username

Name of a user that can be used to query the API. Only L<Basic Authentication|> is currently supported.

=head2 password

Password for the user.

=head1 METHODS

=head2 new(%configuration)

Create a new Catmandu::Store::CA

=head2 get($id)

Retrieve a record identified by C<$id>. Note that C<$id> is the I<priref>, not the I<object_number>.

=head2 add($data)

Not supported.

=head2 update($id, $data)

Not supported.

=head2 delete($id)

Not supported.

=head2 each()

List all items in the instance and iterate over them one at the time. Returns a single object.

=head1 AUTHOR

Pieter De Praetere E<lt>pieter@packed.beE<gt>


Copyright 2017- PACKED vzw, VKC vzw

=head1 LICENSE

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=head1 SEE ALSO