"""
Single File Content
Retrieve the raw content of single file from a version control system repository.
"""
name = "vcs/single-file-content"
version = "1.1.1"

"""
Single File Content
Get the content of the specified file.
"""
usecase SingleFileContent {
  input {
    """
    Owner
    Owner of the repository
    """
    owner! string!

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

    """
    Path
    Path to file at repository
    """
    path! string!

    """
    Ref
    Branch eg. main
    """
    ref! string!
  }

  result {
    """
    Size
    Size of content according to used provider
    """
    size! number!

    """
    Content
    Content of file
    """
    content! string!

    """
    Encoding
    Used encoding
    """
    encoding! 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",
      path = "/README.md",
      ref = "c5e4d76",
    }

    result {
      size = 5, 
      content = '0.a4ba399d443d3', 
      encoding = 'base64'
    }
  }

  example errorNoMatch {
    input {
      owner = "superfaceai",
      repo = "one-sdk-js",
      path = "/wrongfile.md",
      ref = "c5e4d76",
    }

    error {
      message = 'No commit found for the ref 1a2b3c4',
      description = 'https://docs.github.com/v3/repos/contents/',
      statusCode = 404
    }
  }
}