NAME

Footprintless::Plugin::Atlassian::Confluence::Client - A REST client for Atlassian Confluence

VERSION

version 1.00

SYNOPSIS

use Footprintless;
use Footprintless::Util qw(
    dumper
    factory
);
use Log::Any;

my $logger = Log::Any->get_logger();

# Obtain a client from footprintless as a plugin:
my $client = $footprintless->confluence_client('proj.env.confluence');

# Or create one as a standalone:
my $client = Footprintless::Plugin::Atlassian::Confluence::Client
    ->new(
        factory({
            foo => {
                prod => {
                    confluence => {
                        automation => {
                            password => 'pa$$w0rd',
                            username => 'automation',
                        },
                        web => {
                            https => 1,
                            hostname => 'wiki.pastdev.com',
                            context_path => 'confluence',
                        }
                    }
                }
            }
        }), 
        'foo.prod.confluence');

# Now make a request:
my $response = $client->request('get_content',
    [spaceKey => 'FPAC', title => 'API']);
die($logger->errorf('couldn\'t find page API: %s', dumper($response)))
    unless ($response->{success});
my $api_page_id = $response->{content}{results}[0]{id};

DESCRIPTION

This module provides a client for the Atlassian Confluence REST API in the form of a Footprintless plugin.

CONSTRUCTORS

new(%options)

Constructs a new confluence client. The availble options are:

agent

An LWP::UserAgent instance. Defaults to a new agent returned by $footprintless-agent()|Footprintless/agent(%options)>.

request_builder_module

A module that implements request building methods. Defaults to Fooptrintless::Plugin::Atlassian::Confluence::RequestBuilder.

response_parser_module

A module that implements response parsing methods. Defaults to Fooptrintless::Plugin::Atlassian::Confluence::ResponseParser.

METHODS

request($endpoint, \@args, %response_options)

Generates a request by calling a method named $endpoint on the request builder, supplying it with @args. The request is sent using the agent, and the response is parsed by calling a method named $endpoint on the response parser, supplying it with %response_options.

AUTHOR

Lucas Theisen <lucastheisen@pastdev.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Lucas Theisen.

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

SEE ALSO

Please see those modules/websites for more information related to this module.