-
-
Notifications
You must be signed in to change notification settings - Fork 598
Implemented notifications from github API #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
7e5e260
c7cd41a
300a091
aca95fc
55df423
985755b
be24330
49488d8
8246468
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
namespace Github\Api; | ||
|
||
use DateTime; | ||
use DateTimeInterface; | ||
|
||
/** | ||
* API for accessing Notifications from your Git/Github repositories. | ||
* | ||
* Important! You have to be authenticated to perform these methods | ||
* | ||
* @link https://developer.github.com/v3/activity/notifications/ | ||
* @author Dennis de Greef <[email protected]> | ||
*/ | ||
class Notification extends AbstractApi | ||
{ | ||
/** | ||
* Get a listing of a notifications | ||
* @link https://developer.github.com/v3/activity/notifications/ | ||
* | ||
* @param bool $includingRead | ||
* @param bool $participating | ||
* @param null $since | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, in |
||
* | ||
* @return array array of notifications | ||
*/ | ||
public function all($includingRead = false, $participating = false, $since = null) | ||
{ | ||
$parameters = array( | ||
'all' => $includingRead, | ||
'participating' => $participating | ||
); | ||
|
||
if($since !== null) { | ||
$parameters['since'] = $since; | ||
} | ||
|
||
return $this->get('notifications', $parameters); | ||
} | ||
|
||
/** | ||
* Marks all notifications as read from the current date | ||
* Optionally give DateTimeInterface to mark as read before that date | ||
* | ||
* @link https://developer.github.com/v3/activity/notifications/#mark-as-read | ||
* | ||
* @param DateTimeInterface $since | ||
* | ||
*/ | ||
public function markRead(DateTimeInterface $since = null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typehinting the interface means that it is not compatible with PHP 5.3 or 5.4 |
||
{ | ||
$parameters = array(); | ||
|
||
if($since !== null) { | ||
$parameters['last_read_at'] = $since->format(DateTime::ISO8601); | ||
} | ||
|
||
$this->put('notifications', $parameters); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
a
should be removed here.