From 97a1bde16f01537ab930b43f1fbb9fabd4825487 Mon Sep 17 00:00:00 2001 From: Marco Villegas Date: Fri, 29 Sep 2017 05:35:08 -0400 Subject: [PATCH 1/3] Adds a helper to get repository information. --- github_api.module | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/github_api.module b/github_api.module index 5f4c0f1..905fcf2 100644 --- a/github_api.module +++ b/github_api.module @@ -325,3 +325,22 @@ function github_api_delete_branch($username = NULL, $repository = NULL, $source_ watchdog('github_api', '@exception', array('@exception' => $exception->getMessage()), WATCHDOG_ERROR); } } + +/** + * Retrieves repository information. + */ +function github_api_get_repository_info($repository_owner = NULL, $repository_name = NULL) { + if (!$repository_owner) { + $repository_owner = variable_get('github_api_default_owner'); + } + + $client = github_api_client(); + + try { + $repository_info = $client->api('repo')->show($repository_owner, $repository_name); + return $repository_info; + } + catch (Exception $exception) { + watchdog('github_api', '@exception', array('@exception' => $exception->getMessage()), WATCHDOG_ERROR); + } +} From 6d5912e9f02ead7a5435cc67d543b22e193cec56 Mon Sep 17 00:00:00 2001 From: Marco Villegas Date: Fri, 29 Sep 2017 06:37:30 -0400 Subject: [PATCH 2/3] Adds a helper to get repository branches. --- github_api.module | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/github_api.module b/github_api.module index 905fcf2..66da8a9 100644 --- a/github_api.module +++ b/github_api.module @@ -344,3 +344,22 @@ function github_api_get_repository_info($repository_owner = NULL, $repository_na watchdog('github_api', '@exception', array('@exception' => $exception->getMessage()), WATCHDOG_ERROR); } } + +/** + * Retrieves repository branches. + */ +function github_api_get_branches_info($repository_owner = NULL, $repository_name = NULL) { + if (!$repository_owner) { + $repository_owner = variable_get('github_api_default_owner'); + } + + $client = github_api_client(); + + try { + $branches_info = $client->api('repo')->branches($repository_owner, $repository_name); + return $branches_info; + } + catch (Exception $exception) { + watchdog('github_api', '@exception', array('@exception' => $exception->getMessage()), WATCHDOG_ERROR); + } +} From b2f2e8d32360448a4b4a1779d20f40f1b51451aa Mon Sep 17 00:00:00 2001 From: Marco Villegas Date: Fri, 29 Sep 2017 12:18:05 -0400 Subject: [PATCH 3/3] Adds a helper to get repository tags. --- github_api.module | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/github_api.module b/github_api.module index 66da8a9..f8a3dd5 100644 --- a/github_api.module +++ b/github_api.module @@ -363,3 +363,22 @@ function github_api_get_branches_info($repository_owner = NULL, $repository_name watchdog('github_api', '@exception', array('@exception' => $exception->getMessage()), WATCHDOG_ERROR); } } + +/** + * Retrieves repository tags. + */ +function github_api_get_tags_info($repository_owner = NULL, $repository_name = NULL) { + if (!$repository_owner) { + $repository_owner = variable_get('github_api_default_owner'); + } + + $client = github_api_client(); + + try { + $tags_info = $client->api('repo')->tags($repository_owner, $repository_name); + return $tags_info; + } + catch (Exception $exception) { + watchdog('github_api', '@exception', array('@exception' => $exception->getMessage()), WATCHDOG_ERROR); + } +}