class Gitea::Repository::Branches::ListNameService < Gitea::ClientService
  attr_reader :user, :repo, :name

  def initialize(user, repo, name=nil)
    @user = user
    @repo = repo
    @name = name
  end

  def call
    response = get(url, params, true)
    render_200_response(response)
  end

  private
  def params
    Hash.new.merge(token: user.gitea_token, name: name)
  end

  def url
    "/repos/#{user.login}/#{repo}/branch_name_set".freeze
  end
end
