# Path: flask_github/client/requests.py
# class EventListResponse(msgs.Message):
#   response = msgs.MessageField('Event', 1, repeated=True)


from ..requests import EventListResponse

class Events:
  def __init__(self, client):
    # TODO: Research http://developer.github.com/v3/events/types/
    self.client = client

  def list_public_events(self):
    '''List public events.'''
    return self.client.get('events', msg_type=EventListResponse)

  def list_repo_events(self, repo, user=None):
    '''List repository events.'''
    return self.client.get(
      'repos/%s/%s/events' % (
        self.client.user(user), repo), msg_type=EventListResponse)

  def list_repo_issue_events(self, repo, user=None):
    '''List issue events for a repository.'''
    return self.client.get(
      'repos/%s/%s/issues/events' % (
        self.client.user(user), repo), msg_type=EventListResponse)

  def list_repo_network_public_events(self, repo, user=None):
    '''List public events for a network of repositories.'''
    return self.client.get(
      'network/%s/%s/events' % (
        self.client.user(user), repo), msg_type=EventListResponse)

  def list_org_public_events(self, org):
    '''List public events for an organization.'''
    return self.client.get(

# Path: flask_github/client/requests.py
# class EventListResponse(msgs.Message):
#   response = msgs.MessageField('Event', 1, repeated=True)


# Path: flask_github/client/events/events.py
from ..requests import EventListResponse

class Events:
  def __init__(self, client):
    # TODO: Research http://developer.github.com/v3/events/types/
    self.client = client

  def list_public_events(self):
    '''List public events.'''
    return self.client.get('events', msg_type=EventListResponse)

  def list_repo_events(self, repo, user=None):
    '''List repository events.'''
    return self.client.get(
      'repos/%s/%s/events' % (
        self.client.user(user), repo), msg_type=EventListResponse)

  def list_repo_issue_events(self, repo, user=None):
    '''List issue events for a repository.'''
    return self.client.get(
      'repos/%s/%s/issues/events' % (
        self.client.user(user), repo), msg_type=EventListResponse)

  def list_repo_network_public_events(self, repo, user=None):
    '''List public events for a network of repositories.'''
    return self.client.get(
      'network/%s/%s/events' % (
        self.client.user(user), repo), msg_type=EventListResponse)

  def list_org_public_events(self, org):
    '''List public events for an organization.'''
    return self.client.get(

      'orgs/%s/events' % org, msg_type=EventListResponse)
