-
-
Notifications
You must be signed in to change notification settings - Fork 596
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7e5e260
Implemented notifications from github API
dennisdegreef c7cd41a
Added method declarations to docblock to describe __call functionality
dennisdegreef 300a091
Moved the Notification API outside of Activity
dennisdegreef aca95fc
Compatability with PHP 5.3 and 5.4
dennisdegreef 55df423
Added test for Notification API
dennisdegreef 985755b
Forgot to remove old use statement
dennisdegreef be24330
Fixed weird sentence
dennisdegreef 49488d8
Made implementation more consistent with DateTime, altered comments a…
dennisdegreef 8246468
Added documentation for new notification API
dennisdegreef File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| <?php | ||
|
|
||
| namespace Github\Api\Activity; | ||
|
|
||
| use DateTime; | ||
| use DateTimeInterface; | ||
| use Github\Api\AbstractApi; | ||
|
|
||
| /** | ||
| * 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 | ||
| * | ||
| * @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) | ||
| { | ||
| $parameters = array(); | ||
|
|
||
| if($since !== null) { | ||
| $parameters['last_read_at'] = $since->format(DateTime::ISO8601); | ||
| } | ||
|
|
||
| $this->put('notifications', $parameters); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is wrong. If it is in the
Activitysubnamespace, it should be acess from anApi\ActivityAPI, not from the main client, to be consistent with the current architecture of the libraryThere 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.
Moved to namespace
Api\Notificationsee300a091