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


from ..requests import UserResponse
from ..requests import UserListResponse

from __future__ import unicode_literals

class OrgMembers:
  def __init__(self, client):
    self.client = client

  def list(self, org, public_only=False):
    url = 'orgs/%s/members' % org
    if public_only:
      url = 'orgs/%s/public_members' % org
    return self.client.get(url, msg_type=UserListResponse)

  def get(self, org, user=None, public_only=False):
    url = 'orgs/%s/members/%s' % (org, self.client.user(user))
    if public_only:
      url = 'orgs/%s/public_members/%s' % (
        org, self.client.user(user))

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


# Path: flask_github/client/orgs/orgmembers.py
from ..requests import UserResponse
from ..requests import UserListResponse

from __future__ import unicode_literals

class OrgMembers:
  def __init__(self, client):
    self.client = client

  def list(self, org, public_only=False):
    url = 'orgs/%s/members' % org
    if public_only:
      url = 'orgs/%s/public_members' % org
    return self.client.get(url, msg_type=UserListResponse)

  def get(self, org, user=None, public_only=False):
    url = 'orgs/%s/members/%s' % (org, self.client.user(user))
    if public_only:
      url = 'orgs/%s/public_members/%s' % (
        org, self.client.user(user))

    return self.client.get(url, msg_type=UserResponse)
