Jon Allen > CPAN-Mini-Inject-REST-0.03 > CPAN::Mini::Inject::REST::Controller::API::Version1_0

Download:
CPAN-Mini-Inject-REST-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

CPAN::Mini::Inject::REST::Controller::API::Version1_0

DESCRIPTION ^

Catalyst Controller.

METHODS ^

repository

/api/1.0/repository/File-Name-1.00.tar.gz

GET

Downloads a file from the repository. Returns status 404 if the file could not be found.

POST

Adds a file to the repository and injects it into the mirror. If the file can be added, status 201 (Created) is returned with details of which modules the file provides.

    {
        "provides": [
            {
                "version": "0.04",
                "module": "hello"
            }
        ],
        "file": "hello-0.04.tar.gz"
    }

If the file cannot be added to the repository, status 400 is returned with an appropriate error message:

    {
        "error": "File hello-0.03.tar.gz is already in the repository"
    }

Note that if a file already exists in the repository, it cannot be added again.

mirror

/api/1.0/mirror/File-Name-1.0.tar.gz

GET

Returns a list of modules provided by the file, and the CPAN-style path to download the file from the mirror (e.g. L/LO/LOCAL/File-Name-1.0.tar.gz).

    {
        "provides": {
            "CPAN::Mini::Inject::Config": {
                "version":"0.28"
            },
            "CPAN::Mini::Inject": {
                "version":"0.28"
            }
        },
        "file": "CPAN-Mini-Inject-0.28.tar.gz",
        "path": "L/LO/LOCAL/CPAN-Mini-Inject-0.28.tar.gz"
    }

If the file has not been added to the mirror, status 404 is returned with an appropriate error message:

    {
        "error": "File My-Module-1.04.tar.gz does not exist"
    }

all_files

GET

Returns a list of all files that have been added to the mirror.

    {
        "files": [
            "CPAN-Mini-Inject-0.28.tar.gz",
            "My-Private-Module-0.02.tar.gz"
        ]
    }

If no files have been added, status 204 (No Content) is returned.

dist

/api/1.0/dist/Distribution-Name

GET

Returns a list of files, from both the repository and the mirror, which match the specified distibution name.

    {
        "repository": [
            "hello-0.01.tar.gz",
            "hello-0.02.tar.gz",
            "hello-0.03.tar.gz"
        ],
        "mirror": [
            "hello-0.02.tar.gz"
        ]
    }

If the distribution cannot be found, status 404 is returned with an appropriate error message:

    {
        "error": "Cannot find dist My-Private-Module"
    }

all_dists

/api/1.0/all_dists

GET

Returns a list of all distributions that have been added to the mirror.

    {
        "dists": [
            "CPAN-Mini-Inject",
            "My-Private-Module"
        ]
    }

If no distributions have been added, status 204 (No Content) is returned.

AUTHOR ^

Jon Allen (JJ) <jj@jonallen.info>

LICENSE ^

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

syntax highlighting: