Footprintless::Plugin::Atlassian::Confluence::Client

- NAME
- VERSION
- SYNOPSIS
- DESCRIPTION
- CONSTRUCTORS
  - new(%options)
- METHODS
  - request($endpoint, \@args, %response_options)
  - request_all($endpoint, \@args, %response_options)
- AUTHOR
- COPYRIGHT AND LICENSE
- SEE ALSO

# NAME

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

# VERSION

version 1.02

# 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`.

## request_all($endpoint, \@args, %response_options)

Same as "request($endpoint, \@args, %response_options)" in request except that it will loop through all pages until all results have been returned. This method assumes that the last argument to request builder will be an options hash that will be used as query parameters.

# 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.

- Footprintless::Plugin::Atlassian::Confluence
- Footprintless::Plugin::Atlassian::Confluence
- Footprintless::Plugin::Atlassian::Confluence::Client
- https://docs.atlassian.com/atlassian-confluence/REST/latest-server