Liste de tous les membres
Fonctions membres publiques |
| create ($files, $public=false, $description=null) |
| createComment ($gistId, $body) |
| delete ($gistId) |
| deleteComment ($commentId) |
| edit ($gistId, $files=null, $public=null, $description=null) |
| editComment ($commentId, $body) |
| fork ($gistId) |
| get ($gistId) |
| getComment ($commentId) |
| getComments ($gistId, $page=0, $limit=0) |
| getList ($page=0, $limit=0) |
| getListByUser ($user, $page=0, $limit=0) |
| getListPublic ($page=0, $limit=0) |
| getListStarred ($page=0, $limit=0) |
| isStarred ($gistId) |
| star ($gistId) |
| unstar ($gistId) |
| __construct (JRegistry $options=null, JGithubHttp $client=null) |
Description détaillée
Définition à la ligne 19 du fichier gists.php.
Documentation des fonctions membres
JGithubGists::buildFileData |
( |
array |
$files | ) |
|
|
protected |
Method to fetch a data array for transmitting to the GitHub API for a list of files based on an input array of file paths or filename and content pairs.
- Paramètres:
-
array | $files | The list of file paths or filenames and content. |
- Renvoie:
- array
- Depuis:
- 11.3
Définition à la ligne 568 du fichier gists.php.
{
$data = array();
foreach ($files as $key => $file)
{
if (!is_numeric($key))
{
$data[$key] = array('content' => $file);
}
elseif (!file_exists($file))
{
throw new InvalidArgumentException('The file ' . $file . ' does not exist.');
}
else
{
$data[basename($file)] = array('content' => file_get_contents($file));
}
}
return $data;
}
JGithubGists::create |
( |
|
$files, |
|
|
|
$public = false , |
|
|
|
$description = null |
|
) |
| |
Method to create a gist.
- Paramètres:
-
mixed | $files | Either an array of file paths or a single file path as a string. |
boolean | $public | True if the gist should be public. |
string | $description | The optional description of the gist. |
- Renvoie:
- object
- Depuis:
- 11.3
Définition à la ligne 32 du fichier gists.php.
{
$path = '/gists';
$data = json_encode(
array(
'public' => (bool) $public,
'description' => $description
)
);
$response = $this->client->post($this->
fetchUrl($path), $data);
if ($response->code != 201)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
JGithubGists::createComment |
( |
|
$gistId, |
|
|
|
$body |
|
) |
| |
Method to create a comment on a gist.
- Paramètres:
-
integer | $gistId | The gist number. |
string | $body | The comment body text. |
- Renvoie:
- object
- Depuis:
- 11.3
Définition à la ligne 70 du fichier gists.php.
{
$path = '/gists/' . (int) $gistId . '/comments';
$data = json_encode(
array(
'body' => $body,
)
);
$response = $this->client->post($this->
fetchUrl($path), $data);
if ($response->code != 201)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
JGithubGists::delete |
( |
|
$gistId | ) |
|
Method to delete a gist.
- Paramètres:
-
integer | $gistId | The gist number. |
- Renvoie:
- void
- Depuis:
- 11.3
Définition à la ligne 105 du fichier gists.php.
{
$path = '/gists/' . (int) $gistId;
$response = $this->client->delete($this->
fetchUrl($path));
if ($response->code != 204)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
}
JGithubGists::deleteComment |
( |
|
$commentId | ) |
|
Method to delete a comment on a gist.
- Paramètres:
-
integer | $commentId | The id of the comment to delete. |
- Renvoie:
- void
- Depuis:
- 11.3
Définition à la ligne 131 du fichier gists.php.
{
$path = '/gists/comments/' . (int) $commentId;
$response = $this->client->delete($this->
fetchUrl($path));
if ($response->code != 204)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
}
JGithubGists::edit |
( |
|
$gistId, |
|
|
|
$files = null , |
|
|
|
$public = null , |
|
|
|
$description = null |
|
) |
| |
Method to update a gist.
- Paramètres:
-
integer | $gistId | The gist number. |
mixed | $files | Either an array of file paths or a single file path as a string. |
boolean | $public | True if the gist should be public. |
string | $description | The description of the gist. |
- Renvoie:
- object
- Depuis:
- 11.3
Définition à la ligne 160 du fichier gists.php.
{
$path = '/gists/' . (int) $gistId;
$data = new stdClass;
if (isset($description))
{
$data->description = $description;
}
if (isset($public))
{
$data->public = $public;
}
if (isset($files))
{
}
$data = json_encode($data);
$response = $this->client->patch($this->
fetchUrl($path), $data);
if ($response->code != 200)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
JGithubGists::editComment |
( |
|
$commentId, |
|
|
|
$body |
|
) |
| |
Method to update a comment on a gist.
- Paramètres:
-
integer | $commentId | The id of the comment to update. |
string | $body | The new body text for the comment. |
- Renvoie:
- object
- Depuis:
- 11.3
Définition à la ligne 213 du fichier gists.php.
{
$path = '/gists/comments/' . (int) $commentId;
$data = json_encode(
array(
'body' => $body
)
);
$response = $this->client->patch($this->
fetchUrl($path), $data);
if ($response->code != 200)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
JGithubGists::fork |
( |
|
$gistId | ) |
|
Method to fork a gist.
- Paramètres:
-
integer | $gistId | The gist number. |
- Renvoie:
- object
- Depuis:
- 11.3
Définition à la ligne 248 du fichier gists.php.
{
$path = '/gists/' . (int) $gistId . '/fork';
$response = $this->client->post($this->
fetchUrl($path),
'');
if ($response->code != 201)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
JGithubGists::get |
( |
|
$gistId | ) |
|
Method to get a single gist.
- Paramètres:
-
integer | $gistId | The gist number. |
- Renvoie:
- object
- Depuis:
- 11.3
Définition à la ligne 277 du fichier gists.php.
{
$path = '/gists/' . (int) $gistId;
$response = $this->client->get($this->
fetchUrl($path));
if ($response->code != 200)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
JGithubGists::getComment |
( |
|
$commentId | ) |
|
Method to get a specific comment on a gist.
- Paramètres:
-
integer | $commentId | The comment id to get. |
- Renvoie:
- object
- Depuis:
- 11.3
Définition à la ligne 305 du fichier gists.php.
{
$path = '/gists/comments/' . (int) $commentId;
$response = $this->client->get($this->
fetchUrl($path));
if ($response->code != 200)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
JGithubGists::getComments |
( |
|
$gistId, |
|
|
|
$page = 0 , |
|
|
|
$limit = 0 |
|
) |
| |
Method to get the list of comments on a gist.
- Paramètres:
-
integer | $gistId | The gist number. |
integer | $page | The page number from which to get items. |
integer | $limit | The number of items on a page. |
- Renvoie:
- array
- Depuis:
- 11.3
Définition à la ligne 335 du fichier gists.php.
{
$path = '/gists/' . (int) $gistId . '/comments';
$response = $this->client->get($this->
fetchUrl($path, $page, $limit));
if ($response->code != 200)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
JGithubGists::getList |
( |
|
$page = 0 , |
|
|
|
$limit = 0 |
|
) |
| |
Method to list gists. If a user is authenticated it will return the user's gists, otherwise it will return all public gists.
- Paramètres:
-
integer | $page | The page number from which to get items. |
integer | $limit | The number of items on a page. |
- Renvoie:
- array
- Depuis:
- 11.3
Définition à la ligne 365 du fichier gists.php.
{
$path = '/gists';
$response = $this->client->get($this->
fetchUrl($path, $page, $limit));
if ($response->code != 200)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
JGithubGists::getListByUser |
( |
|
$user, |
|
|
|
$page = 0 , |
|
|
|
$limit = 0 |
|
) |
| |
Method to get a list of gists belonging to a given user.
- Paramètres:
-
string | $user | The name of the GitHub user from which to list gists. |
integer | $page | The page number from which to get items. |
integer | $limit | The number of items on a page. |
- Renvoie:
- array
- Depuis:
- 11.3
Définition à la ligne 395 du fichier gists.php.
{
$path = '/users/' . $user . '/gists';
$response = $this->client->get($this->
fetchUrl($path, $page, $limit));
if ($response->code != 200)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
JGithubGists::getListPublic |
( |
|
$page = 0 , |
|
|
|
$limit = 0 |
|
) |
| |
Method to get a list of all public gists.
- Paramètres:
-
integer | $page | The page number from which to get items. |
integer | $limit | The number of items on a page. |
- Renvoie:
- array
- Depuis:
- 11.3
Définition à la ligne 424 du fichier gists.php.
{
$path = '/gists/public';
$response = $this->client->get($this->
fetchUrl($path, $page, $limit));
if ($response->code != 200)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
JGithubGists::getListStarred |
( |
|
$page = 0 , |
|
|
|
$limit = 0 |
|
) |
| |
Method to get a list of the authenticated users' starred gists.
- Paramètres:
-
integer | $page | The page number from which to get items. |
integer | $limit | The number of items on a page. |
- Renvoie:
- array
- Depuis:
- 11.3
Définition à la ligne 453 du fichier gists.php.
{
$path = '/gists/starred';
$response = $this->client->get($this->
fetchUrl($path, $page, $limit));
if ($response->code != 200)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
return json_decode($response->body);
}
JGithubGists::isStarred |
( |
|
$gistId | ) |
|
Method to check if a gist has been starred.
- Paramètres:
-
integer | $gistId | The gist number. |
- Renvoie:
- boolean True if the gist is starred.
- Depuis:
- 11.3
Définition à la ligne 481 du fichier gists.php.
{
$path = '/gists/' . (int) $gistId . '/star';
$response = $this->client->get($this->
fetchUrl($path));
if ($response->code == 204)
{
return true;
}
elseif ($response->code == 404)
{
return false;
}
else
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
}
JGithubGists::star |
( |
|
$gistId | ) |
|
Method to star a gist.
- Paramètres:
-
integer | $gistId | The gist number. |
- Renvoie:
- void
- Depuis:
- 11.3
Définition à la ligne 515 du fichier gists.php.
{
$path = '/gists/' . (int) $gistId . '/star';
$response = $this->client->put($this->
fetchUrl($path),
'');
if ($response->code != 204)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
}
JGithubGists::unstar |
( |
|
$gistId | ) |
|
Method to star a gist.
- Paramètres:
-
integer | $gistId | The gist number. |
- Renvoie:
- void
- Depuis:
- 11.3
Définition à la ligne 541 du fichier gists.php.
{
$path = '/gists/' . (int) $gistId . '/star';
$response = $this->client->delete($this->
fetchUrl($path));
if ($response->code != 204)
{
$error = json_decode($response->body);
throw new DomainException($error->message, $response->code);
}
}
La documentation de cette classe a été générée à partir du fichier suivant :