Pithub::Repos::Contents(3pm)

Pithub::Repos::Contents3pm

Github v3 repo contents api

Version

version 0.01043

Methods

archive

•

This method will return a 302 to a URL to download a tarball or zipball archive for a repository.

Note: For private repositories, these links are temporary and expire quickly.

    GET /repos/:user/:repo/:archive_format/:ref

The "ref" parameter is optional and will default to "master".

Examples:

    use Path::Tiny;
    my $c = Pithub::Repos::Contents->new(
        repo => 'Pithub',
        user => 'plu'
    );
    my $result = $c->archive( archive_format => 'tarball' );
    if ( $result->success ) {
        path('Pithub-master.tgz')->spew($result->raw_content);
    }
    $result = $c->archive( archive_format => 'tarball', ref => 'other_branch' );
    if ( $result->success ) {
        path('Pithub-other_branch.tgz')->spew($result->raw_content);
    }

get

•

This method returns the contents of any file or directory in a repository.

    GET /repos/:user/:repo/contents/:path

Optional Parameters:

•

ref: Optional string - The String name of the Commit/Branch/Tag. Defaults to "master".

Examples:

    my $c = Pithub::Repos::Contents->new(
        repo => 'Pithub',
        user => 'plu'
    );
    # List all files/directories in the repo root
    my $result = $c->get;
    if ( $result->success ) {
        say $_->{name} for @{ $result->content };
    }
    # Get the Pithub.pm file
    $result = $c->get( path => 'lib/Pithub.pm' );
    print Dumper $result->content if $result->success;

readme

•

This method returns the preferred README for a repository.

    GET /repos/:user/:repo/readme

Optional Parameters:

•

ref: Optional string - The String name of the Commit/Branch/Tag. Defaults to "master".

Examples:

    my $c = Pithub::Repos::Contents->new(
        repo => 'dotfiles',
        user => 'plu'
    );
    my $result = $c->readme;
    if ( $result->success ) {
        print Dumper $result->content;
    }
    # Get the readme of branch 'other_branch'
    $result = $c->readme( params => { ref => 'other_branch' } );
    print Dumper $result->content if $result->success;

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

Author

Johannes Plunien <[email protected]>

From libpithub-perl 0.01043-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.