Pithub::Gists(3pm)
β¨ Pithub::Gists β¨
okay bestie, welcome to the Pithub::Gists era π
this is the Github v3 Gists API wrapper and it's literally about to be your new obsession. part of the Pithub family, manual page Pithub::Gists(3pm), let's GO π¦
πΈ VERSION πΈ
version 0.01043 β yes she's got a version, respect her π
π METHODS π
π¬ comments
gives you the keys to Pithub::Gists::Comments β like, the whole comment situation lives over there. go say hi π
π create
okay so we're making a brand new gist, main character energy fr:
POST /gists
Parameters:
dataβ mandatory hashref, and it's giving structured. it needs these keys:descriptionβ optional string (yes optional, she's chill)publicβ mandatory boolean (no skipping this one, bestie)filesβ mandatory hashref, and pls check the examples section below for the deets π
Examples:
my $g = Pithub::Gists->new;
my $result = $g->create(
data => {
description => 'the description for this gist',
public => 1,
files => { 'file1.txt' => { content => 'String file content' } }
}
);
if ( $result->success ) {
printf "The new gist is available at %s\n", $result->content->{html_url};
}
Response: Status: 201 Created π₯
{
"url": "https://api.github.com/gists/1",
"id": "1",
"description": "description of gist",
"public": true,
"user": {
"login": "octocat",
"id": 1,
"gravatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"files": {
"ring.erl": {
"size": 932,
"filename": "ring.erl",
"raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/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",
"forks": [
{
"user": {
"login": "octocat",
"id": 1,
"gravatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"url": "https://api.github.com/gists/5",
"created_at": "2011-04-14T16:00:49Z"
}
],
"history": [
{
"url": "https://api.github.com/gists/1/57a7f021a713b1c5a6a199b54cc514735d2d462f",
"version": "57a7f021a713b1c5a6a199b54cc514735d2d462f",
"user": {
"login": "octocat",
"id": 1,
"gravatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"change_status": {
"deletions": 0,
"additions": 180,
"total": 180
},
"committed_at": "2010-04-14T02:15:15Z"
}
]
}
ποΈ delete
bye bye gist, we hardly knew ye π
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
steal it (affectionately), make it your own β¨
POST /gists/:id/forks
Parameters:
gist_idβ mandatory integer
Examples:
my $g = Pithub::Gists->new;
my $result = $g->fork( gist_id => 784612 );
if ( $result->success ) {
printf "The gist 784612 has been forked: %s\n", $result->content->{html_url};
}
Response: Status: 201 Created π₯
{
"url": "https://api.github.com/gists/1",
"id": "1",
"description": "description of gist",
"public": true,
"user": {
"login": "octocat",
"id": 1,
"gravatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"files": {
"ring.erl": {
"size": 932,
"filename": "ring.erl",
"raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/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"
}
π get
just one gist, singular, focused, it's giving main character π
GET /gists/:id
Parameters:
gist_idβ mandatory integer
Examples:
my $g = Pithub::Gists->new;
my $result = $g->get( gist_id => 784612 );
if ( $result->success ) {
print $result->content->{html_url};
}
Response: Status: 200 OK β¨
{
"url": "https://api.github.com/gists/1",
"id": "1",
"description": "description of gist",
"public": true,
"user": {
"login": "octocat",
"id": 1,
"gravatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"files": {
"ring.erl": {
"size": 932,
"filename": "ring.erl",
"raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/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",
"forks": [
{
"user": {
"login": "octocat",
"id": 1,
"gravatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"url": "https://api.github.com/gists/5",
"created_at": "2011-04-14T16:00:49Z"
}
],
"history": [
{
"url": "https://api.github.com/gists/1/57a7f021a713b1c5a6a199b54cc514735d2d462f",
"version": "57a7f021a713b1c5a6a199b54cc514735d2d462f",
"user": {
"login": "octocat",
"id": 1,
"gravatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"change_status": {
"deletions": 0,
"additions": 180,
"total": 180
},
"committed_at": "2010-04-14T02:15:15Z"
}
]
}
β is_starred
the vibe check: has this gist been starred or not π
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
so this one's got RANGE, bestie, she does multiple things depending on what you ask for π
- 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 β¨
[
{
"url": "https://api.github.com/gists/1",
"id": "1",
"description": "description of gist",
"public": true,
"user": {
"login": "octocat",
"id": 1,
"gravatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"files": {
"ring.erl": {
"size": 932,
"filename": "ring.erl",
"raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/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
giving it the star it deserves, iconic behavior π
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
actually, no, taking that star back, we're unstanning π
DELETE /gists/:id/star
Parameters:
gist_idβ mandatory integer
Examples:
And the response for unstar? She's serving pure confirmation:
Response: Status: 204 No Content
update π (the edit-a-gist method)
Okay bestie, this one edits a gist. The endpoint is:
PATCH /gists/:id
Parameters:
gist_idβ mandatory integer, the gist's ID, no cap.dataβ mandatory hashref, and it's gotta have these keys inside:descriptionβ optional string, the lil description.publicβ mandatory boolean, is it public or not?filesβ mandatory hashref, please see the examples section below for the tea.
NOTE: All files from the previous version of the gist are carried over by default if not included in the hash. Deletes can be performed by including the filename with a null hash.
Examples:
my $g = Pithub::Gists->new;
my $result = $g->update(
gist_id => 784612,
data => {
description => 'the description for this gist',
files => {
'file1.txt' => { content => 'updated file contents' },
'old_name.txt' => {
filename => 'new_name.txt',
content => 'modified contents'
},
'new_file.txt' => { content => 'a new file' },
'delete_this_file.txt' => undef
}
}
);
Response: Status: 200 OK
{
"url": "https://api.github.com/gists/1",
"id": "1",
"description": "description of gist",
"public": true,
"user": {
"login": "octocat",
"id": 1,
"gravatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"files": {
"ring.erl": {
"size": 932,
"filename": "ring.erl",
"raw_url": "https://gist.github.com/raw/365370/8c4d2d43d178df44f4c03a7f2ac0ff512853564e/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",
"forks": [
{
"user": {
"login": "octocat",
"id": 1,
"gravatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"url": "https://api.github.com/gists/5",
"created_at": "2011-04-14T16:00:49Z"
}
],
"history": [
{
"url": "https://api.github.com/gists/1/57a7f021a713b1c5a6a199b54cc514735d2d462f",
"version": "57a7f021a713b1c5a6a199b54cc514735d2d462f",
"user": {
"login": "octocat",
"id": 1,
"gravatar_url": "https://github.com/images/error/octocat_happy.gif",
"url": "https://api.github.com/users/octocat"
},
"change_status": {
"deletions": 0,
"additions": 180,
"total": 180
},
"committed_at": "2010-04-14T02:15:15Z"
}
]
}
β¨ AUTHOR β¨
This masterpiece was authored by Johannes Plunien <plu@cpan.org> β absolute icon behavior, we stan. π
π COPYRIGHT AND LICENSE π
Okay so legal tea, no cap:
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.
And that's the whole vibe, bestie. This page is serving perl v5.40.1, dated 2025-06-08, and it's Pithub::Gists(3pm) β periodt. π
β¨
π¦ where this page comes from
- debian trixie: libpithub-perl 0.01043-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libpithub-perl 0.01043-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libpithub-perl 0.01043-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms