The Perl Toolchain Summit 2025 Needs You: You can help 🙏 Learn more

NAME

Pithub::Gists - Github v3 Gists API

VERSION

version 0.01041

METHODS

comments

Provides access to Pithub::Gists::Comments.

create

delete

  • Delete a gist

    DELETE /gists/:id

    Parameters:

    • gist_id: mandatory integer

    Examples:

    my $g = Pithub::Gists->new;
    my $result = $g->delete( gist_id => 784612 );
    if ( $result->success ) {
    print "The gist 784612 has been deleted\n";
    }

    Response: Status: 204 No Content

fork

get

is_starred

  • Check if a gist is starred

    GET /gists/:id/star

    Parameters:

    • gist_id: mandatory integer

    Examples:

    my $g = Pithub::Gists->new;
    my $result = $g->is_starred( gist_id => 784612 );

    Response: Status: 204 No Content / Status: 404 Not Found

list

  • List a user's gists:

    GET /users/:user/gists

    Parameters:

    • user: string

    Examples:

    my $g = Pithub::Gists->new;
    my $result = $g->list( user => 'miyagawa' );
    if ( $result->success ) {
    while ( my $row = $result->next ) {
    printf "%s => %s\n", $row->{html_url}, $row->{description} || 'no description';
    }
    }
  • List the authenticated user's gists or if called anonymously, this will returns all public gists:

    GET /gists

    Examples:

    my $g = Pithub::Gists->new;
    my $result = $g->list;
  • List all public gists:

    GET /gists/public

    Parameters:

    • public: boolean

    Examples:

    my $g = Pithub::Gists->new;
    my $result = $g->list( public => 1 );
  • List the authenticated user's starred gists:

    GET /gists/starred

    Parameters:

    • starred: boolean

    Examples:

    my $g = Pithub::Gists->new;
    my $result = $g->list( starred => 1 );

    Response: Status: 200 OK

    [
    {
    "id": "1",
    "description": "description of gist",
    "public": true,
    "user": {
    "login": "octocat",
    "id": 1,
    },
    "files": {
    "ring.erl": {
    "size": 932,
    "filename": "ring.erl",
    "content": "contents of gist"
    }
    },
    "comments": 0,
    "git_pull_url": "git://gist.github.com/1.git",
    "git_push_url": "git@gist.github.com:1.git",
    "created_at": "2010-04-14T02:15:15Z"
    }
    ]

star

  • Star a gist

    PUT /gists/:id/star

    Parameters:

    • gist_id: mandatory integer

    Examples:

    my $g = Pithub::Gists->new;
    my $result = $g->star( gist_id => 784612 );

    Response: Status: 204 No Content

unstar

  • Unstar a gist

    DELETE /gists/:id/star

    Parameters:

    • gist_id: mandatory integer

    Examples:

    my $g = Pithub::Gists->new;
    my $result = $g->unstar( gist_id => 784612 );

    Response: Status: 204 No Content

update

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.