summaryrefslogtreecommitdiff
path: root/src/twitch/client.cr
blob: 8502b909865eee6577ebf45ff5d3a3589d46636c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require "./rest"
require "./mappings/*"

module Twitcr::Client
  include REST

  getter token : String
  getter client_id : String

  def initialize(@token, @client_id)
    @token = "Bearer" + @token
  end

  def user?(name : String)
    true if get_user_by_login(name)
  rescue EMPTY_RESULT
    false
  end

  def user(name : String)
    get_user_by_login(name)
  end

  def user(id : Int64)
    get_user_by_id(id)
  end
end