# Path: flask_github/client/messages.py
# class Team(msgs.Message):
#   name = msgs.StringField(1)
#   repo_names = msgs.StringField(2, repeated=True)
#   permission = msgs.StringField(3)
# 
# Path: flask_github/client/requests.py
# class TeamResponse(msgs.Message):
#   response = msgs.MessageField('Team', 1)
# 
# Path: flask_github/client/requests.py
# class TeamListResponse(msgs.Message):
#   response = msgs.MessageField('Team', 1, repeated=True)
# 
# Path: flask_github/client/requests.py
# class RepoResponse(msgs.Message):
#   response = msgs.MessageField('Repo', 1)
# 
# Path: flask_github/client/requests.py
# class RepoListResponse(msgs.Message):
#   response = msgs.MessageField('Repo', 1, repeated=True)
# 
# 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 ..messages import Team
from ..requests import TeamResponse
from ..requests import TeamListResponse
from ..requests import RepoResponse
from ..requests import RepoListResponse
from ..requests import UserResponse
from ..requests import UserListResponse

  def get(self, id):
    return self.client.get('teams/%s' % id, msg_type=TeamResponse)

  def create(self, org, name, repo_names=None, permission=None):
    msg = Team(
      name=name,
      repo_names=repo_names,
      permission=permission)
    return self._create(org=org, msg=msg)

  def _create(self, org, msg):
    return self.client.post('orgs/%s/teams' % org, data=msg)

  def edit(self, id, name, permission=None):
    msg = Team(
      name=name,
      permission=permission)
    return self._edit(id=id, msg=msg)

  def _edit(self, id, msg):
    return self.client.patch('teams/%s' % id, data=msg)

  def delete(self, id):
    return self.client.delete(
      'teams/%s' % id)

  # members..

  def list_members(self, id):
    return self.client.get(

# Path: flask_github/client/messages.py
# class Team(msgs.Message):
#   name = msgs.StringField(1)
#   repo_names = msgs.StringField(2, repeated=True)
#   permission = msgs.StringField(3)
# 
# Path: flask_github/client/requests.py
# class TeamResponse(msgs.Message):
#   response = msgs.MessageField('Team', 1)
# 
# Path: flask_github/client/requests.py
# class TeamListResponse(msgs.Message):
#   response = msgs.MessageField('Team', 1, repeated=True)
# 
# Path: flask_github/client/requests.py
# class RepoResponse(msgs.Message):
#   response = msgs.MessageField('Repo', 1)
# 
# Path: flask_github/client/requests.py
# class RepoListResponse(msgs.Message):
#   response = msgs.MessageField('Repo', 1, repeated=True)
# 
# 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/orgteams.py
from ..messages import Team
from ..requests import TeamResponse
from ..requests import TeamListResponse
from ..requests import RepoResponse
from ..requests import RepoListResponse
from ..requests import UserResponse
from ..requests import UserListResponse

  def get(self, id):
    return self.client.get('teams/%s' % id, msg_type=TeamResponse)

  def create(self, org, name, repo_names=None, permission=None):
    msg = Team(
      name=name,
      repo_names=repo_names,
      permission=permission)
    return self._create(org=org, msg=msg)

  def _create(self, org, msg):
    return self.client.post('orgs/%s/teams' % org, data=msg)

  def edit(self, id, name, permission=None):
    msg = Team(
      name=name,
      permission=permission)
    return self._edit(id=id, msg=msg)

  def _edit(self, id, msg):
    return self.client.patch('teams/%s' % id, data=msg)

  def delete(self, id):
    return self.client.delete(
      'teams/%s' % id)

  # members..

  def list_members(self, id):
    return self.client.get(

      'teams/%s/members' % id, msg_type=UserListResponse)
