Creating, editing, deleting and listing gists. Wraps GitHub Gists API.
Additional APIs:
$gists = $github->api('gists')->all('public');
Requires authentication.
$gists = $github->api('gists')->all('starred');
Requires authentication.
Requires authentication to list your gists.
$gists = $github->api('gists')->all();
$gist = $github->api('gists')->show(1);
$gist = $github->api('gists')->show(1, 'd189dbd4c5d96442db74ebcb62bb38e661a0c8ce');
$commits = $github->api('gists')->commits(1);
$data = array(
'files' => array(
'filename.txt' => array(
'content' => 'txt file content'
),
),
'public' => true,
'description' => 'This is an optional description'
);
$gist = $github->api('gists')->create($data);
Creates and returns a public gist.
You can update description
.
$data = array(
'description' => 'This is new description'
);
$gist = $github->api('gists')->update(1234, $data);
You can update content
of a previous file's version.
$data = array(
'files' => array(
'filename.txt' => array(
'content' => 'updated txt file content'
),
),
);
$gist = $github->api('gists')->update(1234, $data);
You can update the filename
of a previous file's version.
$data = array(
'files' => array(
'filename.txt' => array(
'filename' => 'new-filename.txt'
),
),
);
$gist = $github->api('gists')->update(1234, $data);
You can add a new file to the gist.
$data = array(
'files' => array(
'new-filename.php' => array(
'content' => 'a new file content'
),
),
);
$gist = $github->api('gists')->update(1234, $data);
You can remove a file from the gist.
$data = array(
'files' => array(
'filename.txt' => null,
),
);
$gist = $github->api('gists')->update(1234, $data);
$gist = $github->api('gists')->remove(1234);