# Path: flask_github/client/messages.py
# class PullRequest(msgs.Message):
#   title = msgs.StringField(1)
#   base = msgs.StringField(2)
#   head = msgs.StringField(3)
#   body = msgs.StringField(4)
#   issue = msgs.StringField(5)
# 
# Path: flask_github/client/messages.py
# class CommitMessage(msgs.Message):
#   commit_message = msgs.StringField(1)
# 
# Path: flask_github/client/requests.py
# class PullRequestResponse(msgs.Message):
#   response = msgs.MessageField('PullRequest', 1)
# 
# Path: flask_github/client/requests.py
# class PullRequestListResponse(msgs.Message):
#   response = msgs.MessageField('PullRequest', 1, repeated=True)


from pullreqsreviewcomments import PullReviewComments
from ..messages import PullRequest
from ..messages import CommitMessage
from ..requests import PullRequestResponse
from ..requests import PullRequestListResponse

    if state:
      query = {'state': state}
    return self.client.get('repos/%s/%s/pulls' % (self.client.user(user),
      repo), query=query, msg_type=PullRequestListResponse)

  def get(self, repo, id, user=None):
    return self.client.get(
      'repos/%s/%s/pulls/%s' % (
        self.client.user(user), repo, id), msg_type=PullRequestResponse)

  def create(self, repo, title, base, head, body=None, user=None):
    msg = PullRequest(
      title=title,
      base=base,
      head=head,
      body=body)
    return self._create(repo=repo, msg=msg, user=user)

  def _create(self, repo, msg, user=None):
    return self.client.post(
      'repos/%s/%s/pulls' % (self.client.user(user), repo), data=msg,
      msg_type=PullRequestResponse)

  def create_from_issue(self, repo, issue, base, head, user=None):
    msg = PullRequest(
      issue=issue,
      base=base,
      head=head)
    return self.client.post(
      'repos/%s/%s/pulls' % (

# Path: flask_github/client/messages.py
# class PullRequest(msgs.Message):
#   title = msgs.StringField(1)
#   base = msgs.StringField(2)
#   head = msgs.StringField(3)
#   body = msgs.StringField(4)
#   issue = msgs.StringField(5)
# 
# Path: flask_github/client/messages.py
# class CommitMessage(msgs.Message):
#   commit_message = msgs.StringField(1)
# 
# Path: flask_github/client/requests.py
# class PullRequestResponse(msgs.Message):
#   response = msgs.MessageField('PullRequest', 1)
# 
# Path: flask_github/client/requests.py
# class PullRequestListResponse(msgs.Message):
#   response = msgs.MessageField('PullRequest', 1, repeated=True)


# Path: flask_github/client/pullreqs/pullreqs.py
from pullreqsreviewcomments import PullReviewComments
from ..messages import PullRequest
from ..messages import CommitMessage
from ..requests import PullRequestResponse
from ..requests import PullRequestListResponse

    if state:
      query = {'state': state}
    return self.client.get('repos/%s/%s/pulls' % (self.client.user(user),
      repo), query=query, msg_type=PullRequestListResponse)

  def get(self, repo, id, user=None):
    return self.client.get(
      'repos/%s/%s/pulls/%s' % (
        self.client.user(user), repo, id), msg_type=PullRequestResponse)

  def create(self, repo, title, base, head, body=None, user=None):
    msg = PullRequest(
      title=title,
      base=base,
      head=head,
      body=body)
    return self._create(repo=repo, msg=msg, user=user)

  def _create(self, repo, msg, user=None):
    return self.client.post(
      'repos/%s/%s/pulls' % (self.client.user(user), repo), data=msg,
      msg_type=PullRequestResponse)

  def create_from_issue(self, repo, issue, base, head, user=None):
    msg = PullRequest(
      issue=issue,
      base=base,
      head=head)
    return self.client.post(
      'repos/%s/%s/pulls' % (

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