.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Pithub::Gists 3pm" .TH Pithub::Gists 3pm "2021-02-15" "perl v5.32.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Pithub::Gists \- Github v3 Gists API .SH "VERSION" .IX Header "VERSION" version 0.01036 .SH "METHODS" .IX Header "METHODS" .SS "comments" .IX Subsection "comments" Provides access to Pithub::Gists::Comments. .SS "create" .IX Subsection "create" .IP "\(bu" 4 Create a gist .Sp .Vb 1 \& POST /gists .Ve .Sp Parameters: .RS 4 .IP "\(bu" 4 \&\fBdata\fR: mandatory hashref, having following keys: .RS 4 .IP "\(bu" 4 \&\fBdescription\fR: optional string .IP "\(bu" 4 \&\fBpublic\fR: mandatory boolean .IP "\(bu" 4 \&\fBfiles\fR: mandatory hashref, please see examples section below .RE .RS 4 .RE .RE .RS 4 .Sp Examples: .Sp .Vb 11 \& my $g = Pithub::Gists\->new; \& my $result = $g\->create( \& data => { \& description => \*(Aqthe description for this gist\*(Aq, \& public => 1, \& files => { \*(Aqfile1.txt\*(Aq => { content => \*(AqString file content\*(Aq } } \& } \& ); \& if ( $result\->success ) { \& printf "The new gist is available at %s\en", $result\->content\->{html_url}; \& } .Ve .Sp Response: \fBStatus: 201 Created\fR .Sp .Vb 10 \& { \& "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" \& } \& ] \& } .Ve .RE .SS "delete" .IX Subsection "delete" .IP "\(bu" 4 Delete a gist .Sp .Vb 1 \& DELETE /gists/:id .Ve .Sp Parameters: .RS 4 .IP "\(bu" 4 \&\fBgist_id\fR: mandatory integer .RE .RS 4 .Sp Examples: .Sp .Vb 5 \& my $g = Pithub::Gists\->new; \& my $result = $g\->delete( gist_id => 784612 ); \& if ( $result\->success ) { \& print "The gist 784612 has been deleted\en"; \& } .Ve .Sp Response: \fBStatus: 204 No Content\fR .RE .SS "fork" .IX Subsection "fork" .IP "\(bu" 4 Fork a gist .Sp .Vb 1 \& POST /gists/:id/forks .Ve .Sp Parameters: .RS 4 .IP "\(bu" 4 \&\fBgist_id\fR: mandatory integer .RE .RS 4 .Sp Examples: .Sp .Vb 5 \& my $g = Pithub::Gists\->new; \& my $result = $g\->fork( gist_id => 784612 ); \& if ( $result\->success ) { \& printf "The gist 784612 has been forked: %s\en", $result\->content\->{html_url}; \& } .Ve .Sp Response: \fBStatus: 201 Created\fR .Sp .Vb 10 \& { \& "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" \& } .Ve .RE .SS "get" .IX Subsection "get" .IP "\(bu" 4 Get a single gist .Sp .Vb 1 \& GET /gists/:id .Ve .Sp Parameters: .RS 4 .IP "\(bu" 4 \&\fBgist_id\fR: mandatory integer .RE .RS 4 .Sp Examples: .Sp .Vb 5 \& my $g = Pithub::Gists\->new; \& my $result = $g\->get( gist_id => 784612 ); \& if ( $result\->success ) { \& print $result\->content\->{html_url}; \& } .Ve .Sp Response: \fBStatus: 200 \s-1OK\s0\fR .Sp .Vb 10 \& { \& "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" \& } \& ] \& } .Ve .RE .SS "is_starred" .IX Subsection "is_starred" .IP "\(bu" 4 Check if a gist is starred .Sp .Vb 1 \& GET /gists/:id/star .Ve .Sp Parameters: .RS 4 .IP "\(bu" 4 \&\fBgist_id\fR: mandatory integer .RE .RS 4 .Sp Examples: .Sp .Vb 2 \& my $g = Pithub::Gists\->new; \& my $result = $g\->is_starred( gist_id => 784612 ); .Ve .Sp Response: \fBStatus: 204 No Content\fR / \f(CW\*(C`Status: 404 Not Found\*(C'\fR .RE .SS "list" .IX Subsection "list" .IP "\(bu" 4 List a user's gists: .Sp .Vb 1 \& GET /users/:user/gists .Ve .Sp Parameters: .RS 4 .IP "\(bu" 4 \&\fBuser\fR: string .RE .RS 4 .Sp Examples: .Sp .Vb 7 \& my $g = Pithub::Gists\->new; \& my $result = $g\->list( user => \*(Aqmiyagawa\*(Aq ); \& if ( $result\->success ) { \& while ( my $row = $result\->next ) { \& printf "%s => %s\en", $row\->{html_url}, $row\->{description} || \*(Aqno description\*(Aq; \& } \& } .Ve .RE .IP "\(bu" 4 List the authenticated user's gists or if called anonymously, this will returns all public gists: .Sp .Vb 1 \& GET /gists .Ve .Sp Examples: .Sp .Vb 2 \& my $g = Pithub::Gists\->new; \& my $result = $g\->list; .Ve .IP "\(bu" 4 List all public gists: .Sp .Vb 1 \& GET /gists/public .Ve .Sp Parameters: .RS 4 .IP "\(bu" 4 \&\fBpublic\fR: boolean .RE .RS 4 .Sp Examples: .Sp .Vb 2 \& my $g = Pithub::Gists\->new; \& my $result = $g\->list( public => 1 ); .Ve .RE .IP "\(bu" 4 List the authenticated user's starred gists: .Sp .Vb 1 \& GET /gists/starred .Ve .Sp Parameters: .RS 4 .IP "\(bu" 4 \&\fBstarred\fR: boolean .RE .RS 4 .Sp Examples: .Sp .Vb 2 \& my $g = Pithub::Gists\->new; \& my $result = $g\->list( starred => 1 ); .Ve .Sp Response: \fBStatus: 200 \s-1OK\s0\fR .Sp .Vb 10 \& [ \& { \& "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" \& } \& ] .Ve .RE .SS "star" .IX Subsection "star" .IP "\(bu" 4 Star a gist .Sp .Vb 1 \& PUT /gists/:id/star .Ve .Sp Parameters: .RS 4 .IP "\(bu" 4 \&\fBgist_id\fR: mandatory integer .RE .RS 4 .Sp Examples: .Sp .Vb 2 \& my $g = Pithub::Gists\->new; \& my $result = $g\->star( gist_id => 784612 ); .Ve .Sp Response: \fBStatus: 204 No Content\fR .RE .SS "unstar" .IX Subsection "unstar" .IP "\(bu" 4 Unstar a gist .Sp .Vb 1 \& DELETE /gists/:id/star .Ve .Sp Parameters: .RS 4 .IP "\(bu" 4 \&\fBgist_id\fR: mandatory integer .RE .RS 4 .Sp Examples: .Sp .Vb 2 \& my $g = Pithub::Gists\->new; \& my $result = $g\->unstar( gist_id => 784612 ); .Ve .Sp Response: \fBStatus: 204 No Content\fR .RE .SS "update" .IX Subsection "update" .IP "\(bu" 4 Edit a gist .Sp .Vb 1 \& PATCH /gists/:id .Ve .Sp Parameters: .RS 4 .IP "\(bu" 4 \&\fBgist_id\fR: mandatory integer .IP "\(bu" 4 \&\fBdata\fR: mandatory hashref, having following keys: .RS 4 .IP "\(bu" 4 \&\fBdescription\fR: optional string .IP "\(bu" 4 \&\fBpublic\fR: mandatory boolean .IP "\(bu" 4 \&\fBfiles\fR: mandatory hashref, please see examples section below .Sp \&\s-1NOTE:\s0 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. .RE .RS 4 .RE .RE .RS 4 .Sp Examples: .Sp .Vb 10 \& my $g = Pithub::Gists\->new; \& my $result = $g\->update( \& gist_id => 784612, \& data => { \& description => \*(Aqthe description for this gist\*(Aq, \& files => { \& \*(Aqfile1.txt\*(Aq => { content => \*(Aqupdated file contents\*(Aq }, \& \*(Aqold_name.txt\*(Aq => { \& filename => \*(Aqnew_name.txt\*(Aq, \& content => \*(Aqmodified contents\*(Aq \& }, \& \*(Aqnew_file.txt\*(Aq => { content => \*(Aqa new file\*(Aq }, \& \*(Aqdelete_this_file.txt\*(Aq => undef \& } \& } \& ); .Ve .Sp Response: \fBStatus: 200 \s-1OK\s0\fR .Sp .Vb 10 \& { \& "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" \& } \& ] \& } .Ve .RE .SH "AUTHOR" .IX Header "AUTHOR" Johannes Plunien .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2011\-2019 by Johannes Plunien. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.