NAME

Pithub::GitData::Trees - Github v3 Git Data Trees API

VERSION

version 0.01001

METHODS

create

  • Create a Tree

    POST /repos/:user/:repo/git/trees

Examples:

$result = $p->git_data->trees->create(
    user => 'plu',
    repo => 'Pithub',
    data => {
        tree => [
            {
                path => 'file.pl',
                mode => '100644',
                type => 'blob',
                sha  => '44b4fc6d56897b048c772eb4087f854f46256132',
            }
        ]
    }
);

Parameters in data hashref:

  • base_tree: optional String of the SHA1 of the tree you want to update with new data

  • tree: Array of Hash objects (of path, mode, type and sha) specifying a tree structure

  • tree.path: String of the file referenced in the tree

  • tree.mode: String of the file mode - one of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit) or 120000 for a blob that specifies the path of a symlink

  • tree.type: String of blob, tree, commit

  • tree.sha: String of SHA1 checksum ID of the object in the tree

  • tree.content: String of content you want this file to have - GitHub will write this blob out and use that SHA for this entry. Use either this or tree.sha

get

  • Get a Tree

    GET /repos/:user/:repo/git/trees/:sha

    Examples:

    $result = $p->git_data->trees->get(
        user => 'plu',
        repo => 'Pithub',
        sha  => 'df21b2660fb6'
    );
  • Get a Tree Recursively

    GET /repos/:user/:repo/git/trees/:sha?recursive=1
$result = $p->git_data->trees->get(
    user      => 'plu',
    repo      => 'Pithub',
    sha       => 'df21b2660fb6',
    recursive => 1,
);

AUTHOR

Johannes Plunien <plu@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Johannes Plunien.

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