# Path: flask_github/client/messages.py
# class Org(msgs.Message):
#   id = msgs.IntegerField(1, default=0)
#   login = msgs.StringField(2)
#   company = msgs.StringField(3)
#   billing_email = msgs.StringField(4)
#   email = msgs.StringField(5)
#   location = msgs.StringField(6)
#   name = msgs.StringField(7)
#   members = msgs.MessageField('User', 8, repeated=True)
#   url = msgs.StringField(9)
#   repos_url = msgs.StringField(10)
#   events_url = msgs.StringField(11)
#   avatar_url = msgs.StringField(12)
#   members_url = msgs.StringField(13)
#   public_members_url = msgs.StringField(14)
# 
# Path: flask_github/client/requests.py
# class UserResponse(msgs.Message):
#   response = msgs.MessageField('User', 1)
# 
# Path: flask_github/client/requests.py
# class OrgListResponse(msgs.Message):
#   response = msgs.MessageField('Org', 1, repeated=True)


from orgteams import OrgTeams
from orgmembers import OrgMembers
from ..messages import Org
from ..requests import UserResponse
from ..requests import OrgListResponse

from __future__ import unicode_literals

class Orgs:
  def __init__(self, client):
    self.client = client
    self.teams = OrgTeams(self.client)
    self.members = OrgMembers(self.client)

  def list(self, user=None):
    url = 'user/orgs'
    if user and user != self.client._username:
      url = 'users/%s/orgs' % self.client.user(user)
    return self.client.get(url, msg_type=OrgListResponse)

  def get(self, org):
    return self.client.get('orgs/%s' % org, msg_type=UserResponse)

  def edit(self, org, billing_email=None, company=None, email=None,
      location=None, name=None):

# Path: flask_github/client/messages.py
# class Org(msgs.Message):
#   id = msgs.IntegerField(1, default=0)
#   login = msgs.StringField(2)
#   company = msgs.StringField(3)
#   billing_email = msgs.StringField(4)
#   email = msgs.StringField(5)
#   location = msgs.StringField(6)
#   name = msgs.StringField(7)
#   members = msgs.MessageField('User', 8, repeated=True)
#   url = msgs.StringField(9)
#   repos_url = msgs.StringField(10)
#   events_url = msgs.StringField(11)
#   avatar_url = msgs.StringField(12)
#   members_url = msgs.StringField(13)
#   public_members_url = msgs.StringField(14)
# 
# Path: flask_github/client/requests.py
# class UserResponse(msgs.Message):
#   response = msgs.MessageField('User', 1)
# 
# Path: flask_github/client/requests.py
# class OrgListResponse(msgs.Message):
#   response = msgs.MessageField('Org', 1, repeated=True)


# Path: flask_github/client/orgs/orgs.py
from orgteams import OrgTeams
from orgmembers import OrgMembers
from ..messages import Org
from ..requests import UserResponse
from ..requests import OrgListResponse

from __future__ import unicode_literals

class Orgs:
  def __init__(self, client):
    self.client = client
    self.teams = OrgTeams(self.client)
    self.members = OrgMembers(self.client)

  def list(self, user=None):
    url = 'user/orgs'
    if user and user != self.client._username:
      url = 'users/%s/orgs' % self.client.user(user)
    return self.client.get(url, msg_type=OrgListResponse)

  def get(self, org):
    return self.client.get('orgs/%s' % org, msg_type=UserResponse)

  def edit(self, org, billing_email=None, company=None, email=None,
      location=None, name=None):

    msg = Org(
