From f546d50dbf94693c079385050b9f9a5affd02c8a Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Mon, 19 Dec 2016 20:15:58 +0100 Subject: [PATCH 1/9] Add support for retrieving a single notification info using his ID --- lib/Github/Api/Notification.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/Github/Api/Notification.php b/lib/Github/Api/Notification.php index d7a1be66555..1a692ef2207 100644 --- a/lib/Github/Api/Notification.php +++ b/lib/Github/Api/Notification.php @@ -57,4 +57,20 @@ public function markRead(DateTime $since = null) $this->put('/notifications', $parameters); } + /** + * [UNDOCUMENTED] Gets a single notification using his ID + * + * @link https://developer.github.com/v3/activity/notifications/#view-a-single-thread + * + * @param ID|integer $id + */ + public function id(integer $int) + { + + if (!is_numeric($int)) { + // Error + } + + return $this->get('/notifications/threads/.$id); + } } From 146316b2eec528e30da7b15e86fd36cbe2b91e42 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Mon, 19 Dec 2016 20:17:22 +0100 Subject: [PATCH 2/9] Syntax --- lib/Github/Api/Notification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Github/Api/Notification.php b/lib/Github/Api/Notification.php index 1a692ef2207..896513f79b3 100644 --- a/lib/Github/Api/Notification.php +++ b/lib/Github/Api/Notification.php @@ -71,6 +71,6 @@ public function id(integer $int) // Error } - return $this->get('/notifications/threads/.$id); + return $this->get('/notifications/threads/'.$id); } } From d1e6e3d3f40e261d59a67bfabcf2f4905f2bdc8c Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Mon, 19 Dec 2016 20:18:20 +0100 Subject: [PATCH 3/9] StyleCI --- lib/Github/Api/Notification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Github/Api/Notification.php b/lib/Github/Api/Notification.php index 896513f79b3..8c4eb6ff5de 100644 --- a/lib/Github/Api/Notification.php +++ b/lib/Github/Api/Notification.php @@ -68,7 +68,7 @@ public function id(integer $int) { if (!is_numeric($int)) { - // Error + // Error } return $this->get('/notifications/threads/'.$id); From 66f04ec66d4552d79590af75d9c3d300c90b167b Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Mon, 19 Dec 2016 19:19:20 +0000 Subject: [PATCH 4/9] Apply fixes from StyleCI --- lib/Github/Api/Notification.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Github/Api/Notification.php b/lib/Github/Api/Notification.php index 8c4eb6ff5de..6ef7464d2a4 100644 --- a/lib/Github/Api/Notification.php +++ b/lib/Github/Api/Notification.php @@ -66,7 +66,6 @@ public function markRead(DateTime $since = null) */ public function id(integer $int) { - if (!is_numeric($int)) { // Error } From 322a53ff7782cbbaa041c58201435a025b673cf3 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Mon, 19 Dec 2016 20:29:55 +0100 Subject: [PATCH 5/9] Fix input type --- lib/Github/Api/Notification.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Github/Api/Notification.php b/lib/Github/Api/Notification.php index 6ef7464d2a4..db8cedc73e9 100644 --- a/lib/Github/Api/Notification.php +++ b/lib/Github/Api/Notification.php @@ -64,9 +64,9 @@ public function markRead(DateTime $since = null) * * @param ID|integer $id */ - public function id(integer $int) + public function id($id) { - if (!is_numeric($int)) { + if (!is_numeric($id)) { // Error } From ef8794c1212bdb81c93f611cd4320fa19de27280 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Tue, 20 Dec 2016 09:21:12 +0100 Subject: [PATCH 6/9] Fix as said --- lib/Github/Api/Notification.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/Github/Api/Notification.php b/lib/Github/Api/Notification.php index db8cedc73e9..fcbb76bc6e5 100644 --- a/lib/Github/Api/Notification.php +++ b/lib/Github/Api/Notification.php @@ -62,14 +62,10 @@ public function markRead(DateTime $since = null) * * @link https://developer.github.com/v3/activity/notifications/#view-a-single-thread * - * @param ID|integer $id + * @param int $id */ public function id($id) { - if (!is_numeric($id)) { - // Error - } - - return $this->get('/notifications/threads/'.$id); + return $this->get('/notifications/threads/'.$id); } } From e7ca7b90e5a94083723921c509dd967073ccff46 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Tue, 20 Dec 2016 08:22:46 +0000 Subject: [PATCH 7/9] Apply fixes from StyleCI --- lib/Github/Api/Notification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Github/Api/Notification.php b/lib/Github/Api/Notification.php index fcbb76bc6e5..5e71904ca9a 100644 --- a/lib/Github/Api/Notification.php +++ b/lib/Github/Api/Notification.php @@ -66,6 +66,6 @@ public function markRead(DateTime $since = null) */ public function id($id) { - return $this->get('/notifications/threads/'.$id); + return $this->get('/notifications/threads/'.$id); } } From 68d4a4272f578aecb2a17467bc180ff0669de548 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Tue, 20 Dec 2016 09:24:28 +0100 Subject: [PATCH 8/9] Remove undocumented --- lib/Github/Api/Notification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Github/Api/Notification.php b/lib/Github/Api/Notification.php index 5e71904ca9a..e8d5d8f7810 100644 --- a/lib/Github/Api/Notification.php +++ b/lib/Github/Api/Notification.php @@ -58,7 +58,7 @@ public function markRead(DateTime $since = null) $this->put('/notifications', $parameters); } /** - * [UNDOCUMENTED] Gets a single notification using his ID + * Gets a single notification using his ID * * @link https://developer.github.com/v3/activity/notifications/#view-a-single-thread * From 7288434e69b78dd15264809b812564d4682cb005 Mon Sep 17 00:00:00 2001 From: Miguel Piedrafita Date: Tue, 20 Dec 2016 09:26:58 +0100 Subject: [PATCH 9/9] Add documentation --- doc/notification.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/notification.md b/doc/notification.md index d586b364c74..b47c1d5f7c3 100644 --- a/doc/notification.md +++ b/doc/notification.md @@ -36,3 +36,10 @@ $client->api('notification')->markRead(new DateTime('2015/01/01')); ``` Marks all notifications as read up until the current date, unless a date is given + +## Get a single notification using his ID + +```php +$client->api('notification')->id($id); +``` +Retrieves single notification data using his ID.