Footprintless::Plugin::Atlassian::Confluence::RequestBuilder

- NAME
- VERSION
- SYNOPSIS
- DESCRIPTION
- CONSTRUCTORS
  - new($base_url)
- METHODS
  - create_content($content, %options)
  - delete_content($id)
  - get_content(%options)
  - get_content_children($id, %options)
  - update_content($id, $content, %options)
- AUTHOR
- COPYRIGHT AND LICENSE
- SEE ALSO

# NAME

Footprintless::Plugin::Atlassian::Confluence::RequestBuilder - A request builder for the Atlassian Confluence REST API

# VERSION

version 1.02

# SYNOPSIS

        my $request_builder =
            Footprintless::Plugin::Atlassian::Confluence::RequestBuilder
                ->new($base_url);

        # A request to create content
        my $http_request = $request_builder->create_content(
            [
                {
                    type => 'page',
                    title => 'Foobar',
                    space => 'CPA',
                    body => {
                        storage => {
                            value => '<p>Foobar paragraph</p>',
                            representation => 'storage',
                        }
                    }
                }
            ]);

        # A request to get the content in space CPA with title Foobar
        my $http_request = $request_builder->get_content(
            spaceKey => 'CPA', title => 'Foobar');

        # A request to get the content with id 123
        my $http_request = $request_builder->get_content(id => 123);

        # A request to update the content
        my $http_request = $request_builder->update_content(123,
            [
                {
                    type => 'page',
                    title => 'Foobars new title',
                    body => {
                        storage => {
                            value => '<p>Foobars new paragraph</p>',
                            representation => 'storage',
                        }
                    },
                    version => {
                        number => $current_version + 1
                    }
                }
            ]);

        # A request to delete the content with id 123
        my $http_request = $request_builder->delete_content(123);

# DESCRIPTION

This is the default implementation of a request builder. It provides a simple perl interface to the Atlassian Confluence REST API.

# CONSTRUCTORS

## new($base_url)

Constructs a new request builder with the provided `base_url`. This url will be used to compose the url for each REST endpoint.

# METHODS

## create_content($content, %options)

A request to create a new piece of Content or publish a draft if the content id is present. All `%options` will be transformed into query parameters.

## delete_content($id)

A request to trash or purge a piece of Content.

## get_content(%options)

A request to obtain a paginated list of Content, or if `$option{id}` is present, the piece of Content identified by it. All other `%options` will be transformed into query parameters.

## get_content_children($id, %options)

A request to return a map of direct children of a piece of Content. If `$options{type}` is present, only children of the specified type will be returned. All other `%options` will be transformed into query parameters.

## update_content($id, $content, %options)

A request to update a piece of Content. All `%options` will be transformed into 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
- Footprintless::Plugin::Atlassian::Confluence::ResponseParser
- https://docs.atlassian.com/atlassian-confluence/REST/latest-server