GitHub-EmptyRepository

 view release on metacpan or  search on metacpan

lib/GitHub/EmptyRepository/Repository.pm  view on Meta::CPAN

            user          => $self->user,
            sha           => $row->{sha}
        );

        push @commits, $commit;
    }
    return \@commits;
}

sub _get_branches {
    my $self = shift;

    my $result = $self->github_client->repos->branches(
        user   => $self->user,
        repo   => $self->name,
        params => { per_page => 2, state => 'all' },
    );

    $result->auto_pagination(0);

    my @branches;

    return \@branches unless $result->response->is_success;

    while ( my $row = $result->next ) {
        my $branch = $row->{name};
        push @branches, $branch;
    }
    return \@branches;
}

sub _get_pullrequests {
    my $self = shift;

    my $result = $self->github_client->pull_requests->list(
        user   => $self->user,
        repo   => $self->name,
        params => { per_page => 2, state => 'all' },
    );

    $result->auto_pagination(0);

    my @pullrequests;

    return \@pullrequests unless $result->response->is_success;

    while ( my $row = $result->next ) {
        my $pullrequest = $row->{number};
        push @pullrequests, $pullrequest;
    }
    return \@pullrequests;
}

#
## use critic

sub _parse_github_url {
    my $self = shift;
    my $uri  = URI->new(shift);

    my @parts = split m{/}, $uri->path;

    # paths may or may not have a leading slash (absolute vs relative)
    my $user = shift @parts || shift @parts;
    my $name = shift @parts;
    $name =~ s{\.git}{};

    return ( $user, $name );
}

1;

=pod

=encoding UTF-8

=head1 NAME

GitHub::EmptyRepository::Repository - Encapsulate repository data for a repository

=head1 VERSION

version 0.00002

=head1 AUTHORS

=over 4

=item *

Thibault Duponchelle <thibault.duponchelle@gmail.com>

=item *

Olaf Alders <olaf@wundercounter.com>

=back

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2022 by Thibault Duponchelle.

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

=cut

__END__

# ABSTRACT: Encapsulate repository data for a repository



( run in 1.413 second using v1.01-cache-2.11-cpan-71847e10f99 )