# Path: flask_github/client/messages.py
# class Key(msgs.Message):
#   id = msgs.IntegerField(1, default=0)
#   key = msgs.StringField(2)
#   title = msgs.StringField(3)
# 
# Path: flask_github/client/requests.py
# class KeyResponse(msgs.Message):
#   response = msgs.MessageField('Key', 1)
# 
# Path: flask_github/client/requests.py
# class KeyListResponse(msgs.Message):
#   response = msgs.MessageField('Key', 1, repeated=True)


from ..messages import Key
from ..requests import KeyResponse
from ..requests import KeyListResponse

from __future__ import unicode_literals

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

  def list(self):
    return self.client.get(
      'user/keys', msg_type=KeyListResponse)

  def get(self, id):
    return self.client.get(
      'user/keys/%s' % id, msg_type=KeyResponse)

  def create(self, title, key):
    msg = Key(
      title=title,
      key=key)
    return self._create(msg=msg)

  def _create(self, msg):
    return self.client.post(

# Path: flask_github/client/messages.py
# class Key(msgs.Message):
#   id = msgs.IntegerField(1, default=0)
#   key = msgs.StringField(2)
#   title = msgs.StringField(3)
# 
# Path: flask_github/client/requests.py
# class KeyResponse(msgs.Message):
#   response = msgs.MessageField('Key', 1)
# 
# Path: flask_github/client/requests.py
# class KeyListResponse(msgs.Message):
#   response = msgs.MessageField('Key', 1, repeated=True)


# Path: flask_github/client/users/userskeys.py
from ..messages import Key
from ..requests import KeyResponse
from ..requests import KeyListResponse

from __future__ import unicode_literals

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

  def list(self):
    return self.client.get(
      'user/keys', msg_type=KeyListResponse)

  def get(self, id):
    return self.client.get(
      'user/keys/%s' % id, msg_type=KeyResponse)

  def create(self, title, key):
    msg = Key(
      title=title,
      key=key)
    return self._create(msg=msg)

  def _create(self, msg):
    return self.client.post(

      'user/keys', data=msg, msg_type=KeyResponse)
