# Path: flask_github/client/messages.py
# class User(msgs.Message):
#   name = msgs.StringField(1)
#   email = msgs.StringField(2)
#   id = msgs.IntegerField(3, default=0)
#   login = msgs.StringField(4)
#   url = msgs.StringField(5)
#   blog = msgs.StringField(6)
#   company = msgs.StringField(7)
#   location = msgs.StringField(8)
#   hireable = msgs.BooleanField(9, default=False)
#   bio = msgs.StringField(10)
#   avatar_url = msgs.StringField(11)
#   gravatar_id = msgs.StringField(12)
#   _links = msgs.MessageField('Link', 13, repeated=True)
#   date = msgs.StringField(14)
#   created_at = msgs.StringField(15)
#   type = msgs.StringField(16)
#   following = msgs.IntegerField(17, default=0)
#   followers = msgs.IntegerField(18, default=0)
#   public_repos = msgs.IntegerField(19, default=0)
#   public_gists = msgs.IntegerField(20, default=0)
#   total_private_repos = msgs.IntegerField(21, default=0)
#   owned_private_repos = msgs.IntegerField(22, default=0)
#   private_gists = msgs.IntegerField(23, default=0)
#   disk_usage = msgs.IntegerField(24, default=0)
#   collaborators = msgs.IntegerField(25, default=0)
#   html_url = msgs.StringField(26)
#   repos_url = msgs.StringField(27)
#   events_url = msgs.StringField(28)
#   members_url = msgs.StringField(29)
#   public_members_url = msgs.StringField(30)
# 
# Path: flask_github/client/messages.py
# class Tag(msgs.Message):
#   tag = msgs.StringField(1)
#   message = msgs.StringField(2)
#   tagger = msgs.MessageField('User', 4)
#   # fields for tag objects..
#   object = msgs.MessageField('Tag', 5)
#   type = msgs.StringField(6)
#   sha = msgs.StringField(7)
#   url = msgs.StringField(8)
#   name = msgs.StringField(9)
#   commit = msgs.MessageField('Commit', 10)
#   zipball_url = msgs.StringField(11)
#   tarball_url = msgs.StringField(12)
# 
# Path: flask_github/client/requests.py
# class TagResponse(msgs.Message):
#   response = msgs.MessageField('Tag', 1)


from ..messages import User
from ..messages import Tag
from ..requests import TagResponse

from __future__ import unicode_literals

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

  def get(self, repo, sha, user=None):
    return self.client.get(
      'repos/%s/%s/git/tags/%s' % (
        self.client.user(user), repo, sha), msg_type=TagResponse)

  def create(self, repo, tag, message, object, type, tagger_name,
      tagger_email, tagger_date, user=None):
    msg = Tag(
      tag=tag,
      message=message,
      object=object,
      type=type)
    msg.tagger = User(
      name=tagger_name,
      email=tagger_email,
      date=tagger_date)
    return self._create(repo=repo, user=user, msg=msg)

  def _create(self, repo, msg, user=None):
    return self.github.post(
      'repos/%s/%s/git/tags' % (

# Path: flask_github/client/messages.py
# class User(msgs.Message):
#   name = msgs.StringField(1)
#   email = msgs.StringField(2)
#   id = msgs.IntegerField(3, default=0)
#   login = msgs.StringField(4)
#   url = msgs.StringField(5)
#   blog = msgs.StringField(6)
#   company = msgs.StringField(7)
#   location = msgs.StringField(8)
#   hireable = msgs.BooleanField(9, default=False)
#   bio = msgs.StringField(10)
#   avatar_url = msgs.StringField(11)
#   gravatar_id = msgs.StringField(12)
#   _links = msgs.MessageField('Link', 13, repeated=True)
#   date = msgs.StringField(14)
#   created_at = msgs.StringField(15)
#   type = msgs.StringField(16)
#   following = msgs.IntegerField(17, default=0)
#   followers = msgs.IntegerField(18, default=0)
#   public_repos = msgs.IntegerField(19, default=0)
#   public_gists = msgs.IntegerField(20, default=0)
#   total_private_repos = msgs.IntegerField(21, default=0)
#   owned_private_repos = msgs.IntegerField(22, default=0)
#   private_gists = msgs.IntegerField(23, default=0)
#   disk_usage = msgs.IntegerField(24, default=0)
#   collaborators = msgs.IntegerField(25, default=0)
#   html_url = msgs.StringField(26)
#   repos_url = msgs.StringField(27)
#   events_url = msgs.StringField(28)
#   members_url = msgs.StringField(29)
#   public_members_url = msgs.StringField(30)
# 
# Path: flask_github/client/messages.py
# class Tag(msgs.Message):
#   tag = msgs.StringField(1)
#   message = msgs.StringField(2)
#   tagger = msgs.MessageField('User', 4)
#   # fields for tag objects..
#   object = msgs.MessageField('Tag', 5)
#   type = msgs.StringField(6)
#   sha = msgs.StringField(7)
#   url = msgs.StringField(8)
#   name = msgs.StringField(9)
#   commit = msgs.MessageField('Commit', 10)
#   zipball_url = msgs.StringField(11)
#   tarball_url = msgs.StringField(12)
# 
# Path: flask_github/client/requests.py
# class TagResponse(msgs.Message):
#   response = msgs.MessageField('Tag', 1)


# Path: flask_github/client/gitdata/gitdatatags.py
from ..messages import User
from ..messages import Tag
from ..requests import TagResponse

from __future__ import unicode_literals

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

  def get(self, repo, sha, user=None):
    return self.client.get(
      'repos/%s/%s/git/tags/%s' % (
        self.client.user(user), repo, sha), msg_type=TagResponse)

  def create(self, repo, tag, message, object, type, tagger_name,
      tagger_email, tagger_date, user=None):
    msg = Tag(
      tag=tag,
      message=message,
      object=object,
      type=type)
    msg.tagger = User(
      name=tagger_name,
      email=tagger_email,
      date=tagger_date)
    return self._create(repo=repo, user=user, msg=msg)

  def _create(self, repo, msg, user=None):
    return self.github.post(
      'repos/%s/%s/git/tags' % (

        self.client.user(user), repo), data=msg, msg_type=TagResponse)
