<commit_before>module BitbucketServer
  class Client
    attr_reader :connection

    def initialize(options = {})
      @connection = Connection.new(options)
    end

    def issues(repo)
      path = "/repositories/#{repo}/issues"
      get_collection(path, :issue)
    end

    def issue_comments(repo, issue_id)
      path = "/repositories/#{repo}/issues/#{issue_id}/comments"
      get_collection(path, :comment)
    end

    def pull_requests(project_key, repository_slug)
      path = "/projects/#{project}/repos/#{repo}/pull-requests?state=ALL"
      get_collection(path, :pull_request)
    end

    def pull_request_comments(repo, pull_request)
      path = "/repositories/#{repo}/pullrequests/#{pull_request}/comments"
      get_collection(path, :pull_request_comment)
    end

    def pull_request_diff(repo, pull_request)
      path = "/repositories/#{repo}/pullrequests/#{pull_request}/diff"
      connection.get(path)
    end

    def repo(project, repo_name)
      parsed_response = connection.get("/projects/#{project}/repos/#{repo_name}")
      # XXXX TODO Handle failure
      BitbucketServer::Representation::Repo.new(parsed_response)<commit_msg>Fix pull request URLs<commit_after>module BitbucketServer
  class Client
    attr_reader :connection

    def initialize(options = {})
      @connection = Connection.new(options)
    end

    def issues(repo)
      path = "/repositories/#{repo}/issues"
      get_collection(path, :issue)
    end

    def issue_comments(repo, issue_id)
      path = "/repositories/#{repo}/issues/#{issue_id}/comments"
      get_collection(path, :comment)
    end

    def pull_requests(project_key, repo)
      path = "/projects/#{project_key}/repos/#{repo}/pull-requests?state=ALL"
      get_collection(path, :pull_request)
    end

    def pull_request_comments(project_key, repo, pull_request)
      path = "/projects/#{project_key}/repos/#{repo}/pull-requests/#{pull_request}/comments"
      get_collection(path, :pull_request_comment)
    end

    def pull_request_diff(project_key, repo, pull_request)
      path = "/projects/#{project_key}/repos/#{repo}/pull-requests/#{pull_request}/diff"
      connection.get(path)
    end

    def repo(project, repo_name)
      parsed_response = connection.get("/projects/#{project}/repos/#{repo_name}")
      # XXXX TODO Handle failure
      BitbucketServer::Representation::Repo.new(parsed_response)
{'fraction_non_alphanumeric': 0.12452987881320518, 'fraction_numerical': 0.0, 'mean_word_length': 3.6941176470588237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1184778', 'n_tokens_mistral': 731, 'n_tokens_neox': 713, 'n_words': 122}