"""
Pull Request
Retrieve information about a pull request in a version control system repository.
"""

name = "vcs/pull-request"
version = "1.1.1"

"""
PullRequest
Get details of the specified pull request.
"""
usecase PullRequest safe {
  input {
    """
    Owner
    Owner of the repository
    """
    owner! string!

    """
    Repo
    Repository name
    """
    repo! string!

    """
    Identifier
    Id of pull request
    """
    identifier! number!
  }

  result {
    """
    Tittle
    Title of pull request
    """
    title! string!

    """
    Id
    Pull request Id
    """
    id! number!

    """
    Url
    Web url of pull request
    """
    url! string!

    """
    Sha
    Pull request sha
    """
    sha! string!
  }

  error {
    """
    Message
    A short, human-readable summary of the problem.
    """
    message! string!
    """
    Status code
    Usually a HTTP status code connected to occured problem.
    """
    statusCode!
    """
    Description
    A optional, human-readable explanation specific to this occurrence of the problem.
    """
    description string!
  }

  example success {
    input {
      owner = 'superfaceai',
      repo = 'one-sdk-js',
      identifier = 42
    }

    result {
      title = 'feat: Better error handling',
      id = 123456789,
      url = 'https://api.github.com/repos/superfaceai/one-sdk-js/pulls/1000',
      sha = '2ae6d65c9fcaff064f067ba8b9123b5a3a90dcdc'
    }
  }

  example errorNoMatch {
    input {
      owner = 'superfaceai',
      repo = 'wrong-repo',
      identifier = 42
    }

    error {
      message = 'Not Found',
      description = 'https://docs.github.com/rest/reference/pulls#get-a-pull-request',
      statusCode = 404
    }
  }
}