Skip to content
Browse files

method to get labels

  • Loading branch information...
1 parent c20e6e4 commit 5d854710c0c17f8805076eb7842a7622be021e54 @nprasath002 committed
Showing with 57 additions and 0 deletions.
  1. +57 −0 libraries/joomla/github/issues.php
View
57 libraries/joomla/github/issues.php
@@ -459,6 +459,63 @@ public function getComments($user, $repo, $issueId, $page = 0, $limit = 0)
}
/**
+ * Method to get a specific label on a repo.
+ *
+ * @param string $user The name of the owner of the GitHub repository.
+ * @param string $repo The name of the GitHub repository.
+ * @param string $name The label name to get.
+ *
+ * @return object
+ *
+ * @since 12.3
+ */
+ public function getLabel($user, $repo, $name)
+ {
+ // Build the request path.
+ $path = '/repos/' . $user . '/' . $repo . '/labels/' . $name;
+
+ // Send the request.
+ $response = $this->client->get($this->fetchUrl($path));
+
+ // Validate the response code.
+ if ($response->code != 200)
+ {
+ // Decode the error response and throw an exception.
+ $error = json_decode($response->body);
+ throw new DomainException($error->message, $response->code);
+ }
+
+ return json_decode($response->body);
+ }
+
+ /**
+ * Method to get the list of labels on a repo.
+ *
+ * @param string $user The name of the owner of the GitHub repository.
+ * @param string $repo The name of the GitHub repository.
+ *
+ * @return array
+ *
+ * @since 12.3
+ */
+ public function getLabels($user, $repo)
+ {
+ // Build the request path.
+ $path = '/repos/' . $user . '/' . $repo . '/labels';
+
+ // Send the request.
+ $response = $this->client->get($this->fetchUrl($path));
+
+ // Validate the response code.
+ if ($response->code != 200)
+ {
+ // Decode the error response and throw an exception.
+ $error = json_decode($response->body);
+ throw new DomainException($error->message, $response->code);
+ }
+ }
+
+ /**
* Method to list an authenticated user's issues.
*
* @param string $filter The filter type: assigned, created, mentioned, subscribed.

0 comments on commit 5d85471

Please sign in to comment.
Something went wrong with that request. Please try again.