2013-01-30 11:38:30 -08:00

120 lines
3.7 KiB
PHP
Executable File

<?php
namespace Github\Api\CurrentUser;
use Github\Api\AbstractApi;
/**
* @link http://developer.github.com/v3/activity/notifications/
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Notifications extends AbstractApi
{
/**
* List all notifications for the authenticated user
* @link http://developer.github.com/v3/activity/notifications/#list-your-notifications
*
* @param array $params
* @return array
*/
public function all(array $params = array())
{
return $this->get('notifications', $params);
}
/**
* List all notifications for the authenticated user in selected repository
* @link http://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param array $params
* @return array
*/
public function allInRepository($username, $repository, array $params = array())
{
return $this->get('repos/'.urlencode($username).'/'.urlencode($repository).'/notifications', $params);
}
/**
* @link http://developer.github.com/v3/activity/notifications/#mark-as-read
*
* @param array $params
* @return array
*/
public function markAsReadAll(array $params = array())
{
return $this->put('notifications', $params);
}
/**
* @link http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param array $params
* @return array
*/
public function markAsReadInRepository($username, $repository, array $params = array())
{
return $this->put('repos/'.urlencode($username).'/'.urlencode($repository).'/notifications', $params);
}
/**
* @link http://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read
*
* @param string $id the notification number
* @param array $params
* @return array
*/
public function markAsRead($id, array $params)
{
return $this->patch('notifications/threads/'.urlencode($id), $params);
}
/**
* @link http://developer.github.com/v3/activity/notifications/#view-a-single-thread
*
* @param string $id the notification number
* @return array
*/
public function show($id)
{
return $this->get('notifications/threads/'.urlencode($id));
}
/**
* @link http://developer.github.com/v3/activity/notifications/#get-a-thread-subscription
*
* @param string $id the notification number
* @return array
*/
public function showSubscription($id)
{
return $this->get('notifications/threads/'.urlencode($id).'/subscription');
}
/**
* @link http://developer.github.com/v3/activity/notifications/#set-a-thread-subscription
*
* @param string $id the notification number
* @param array $params
* @return array
*/
public function createSubscription($id, array $params)
{
return $this->put('notifications/threads/'.urlencode($id).'/subscription', $params);
}
/**
* @link http://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription
*
* @param string $id the notification number
* @return array
*/
public function removeSubscription($id)
{
return $this->delete('notifications/threads/'.urlencode($id).'/subscription');
}
}