diff options
author | Jonathan B <greenbigfrog@gmail.com> | 2019-08-14 21:25:02 +0200 |
---|---|---|
committer | Jonathan B <greenbigfrog@gmail.com> | 2019-08-14 21:25:02 +0200 |
commit | 99b3d7287bd0ac36ee82129ad38bd88c5b5af625 (patch) | |
tree | 461ba1e96425d62a60d4fdb1fd9d892264b146f2 /src/twitch/client.cr | |
download | twitcr-99b3d7287bd0ac36ee82129ad38bd88c5b5af625.tar.gz twitcr-99b3d7287bd0ac36ee82129ad38bd88c5b5af625.zip |
Initial release
Diffstat (limited to 'src/twitch/client.cr')
-rw-r--r-- | src/twitch/client.cr | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/twitch/client.cr b/src/twitch/client.cr new file mode 100644 index 0000000..8502b90 --- /dev/null +++ b/src/twitch/client.cr @@ -0,0 +1,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 |