# 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 Commit(msgs.Message):
#   url = msgs.StringField(1)
#   sha = msgs.StringField(2)
#   committer = msgs.MessageField('User', 3)
#   author = msgs.MessageField('User', 4)
#   comment_count = msgs.IntegerField(5, default=0)
#   message = msgs.StringField(6)
#   # string reference allows for recursion..
#   tree = msgs.MessageField('Commit', 7)
#   parents = msgs.MessageField('Commit', 8, repeated=True)
#   # fields that live on the tree api responses..
#   path = msgs.StringField(9)
#   mode = msgs.StringField(10)
#   type = msgs.StringField(11)
#   size = msgs.IntegerField(12, default=0)
#   # fields for the hooks payload..
#   id = msgs.StringField(13)
#   timestamp = msgs.StringField(14)
#   added = msgs.StringField(15, repeated=True)
#   removed = msgs.StringField(16, repeated=True)
#   modified = msgs.StringField(17, repeated=True)
#   commit = msgs.MessageField('Commit', 18)
# 
# Path: flask_github/client/requests.py
# class GitDataCommitResponse(msgs.Message):
#   response = msgs.MessageField('Commit', 1)
# 
# Path: flask_github/client/requests.py
# class GitDataCommitListResponse(msgs.Message):
#   response = msgs.MessageField('Commit', 1, repeated=True)


from ..messages import User
from ..messages import Commit
from ..requests import GitDataCommitResponse
from ..requests import GitDataCommitListResponse

from __future__ import unicode_literals

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

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

  def create(self, repo, message, tree, parents, author_name=None,
      author_email=None, author_date=None, committer_name=None,
      committer_email=None, commiter_date=None, user=None):
    msg = Commit(
      message=message,
      parents=parents,
      tree=tree,
      author=User(
        name=author_name,
        email=author_email,
        date=author_date),

# 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 Commit(msgs.Message):
#   url = msgs.StringField(1)
#   sha = msgs.StringField(2)
#   committer = msgs.MessageField('User', 3)
#   author = msgs.MessageField('User', 4)
#   comment_count = msgs.IntegerField(5, default=0)
#   message = msgs.StringField(6)
#   # string reference allows for recursion..
#   tree = msgs.MessageField('Commit', 7)
#   parents = msgs.MessageField('Commit', 8, repeated=True)
#   # fields that live on the tree api responses..
#   path = msgs.StringField(9)
#   mode = msgs.StringField(10)
#   type = msgs.StringField(11)
#   size = msgs.IntegerField(12, default=0)
#   # fields for the hooks payload..
#   id = msgs.StringField(13)
#   timestamp = msgs.StringField(14)
#   added = msgs.StringField(15, repeated=True)
#   removed = msgs.StringField(16, repeated=True)
#   modified = msgs.StringField(17, repeated=True)
#   commit = msgs.MessageField('Commit', 18)
# 
# Path: flask_github/client/requests.py
# class GitDataCommitResponse(msgs.Message):
#   response = msgs.MessageField('Commit', 1)
# 
# Path: flask_github/client/requests.py
# class GitDataCommitListResponse(msgs.Message):
#   response = msgs.MessageField('Commit', 1, repeated=True)


# Path: flask_github/client/gitdata/gitdatacommits.py
from ..messages import User
from ..messages import Commit
from ..requests import GitDataCommitResponse
from ..requests import GitDataCommitListResponse

from __future__ import unicode_literals

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

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

  def create(self, repo, message, tree, parents, author_name=None,
      author_email=None, author_date=None, committer_name=None,
      committer_email=None, commiter_date=None, user=None):
    msg = Commit(
      message=message,
      parents=parents,
      tree=tree,
      author=User(
        name=author_name,
        email=author_email,
        date=author_date),

      committer = User(
