class Gitea::User::HeadmapService < Gitea::ClientService
  attr_reader :start_time, :end_time, :username, :token

  def initialize(username, start_time, end_time, token=nil)
    @username = username 
    @start_time = start_time 
    @end_time = end_time
    @token = token
  end

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

  private 
  def params 
    Hash.new.merge(start: start_time, end: end_time, token: token)
  end

  def url 
    "/users/#{username}/heatmap".freeze
  end
end