Skip to content

Commit

Permalink
merge user and game into helix
Browse files Browse the repository at this point in the history
  • Loading branch information
offish authored Sep 21, 2021
1 parent cd35da5 commit 887780d
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions twitchtube/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,13 @@ def data(slug: str, oauth_token: str, client_id: str) -> requests.Response:
)


def game(game_list: list, oauth_token: str, client_id: str) -> requests.Response:
# returns data about every specified name of the game (including it's id)
# e.g. [Minecraft] -> {'id': '27471', 'name': 'Minecraft',
# 'box_art_url': 'https://static-cdn.jtvnw.net/ttv-boxart/Minecraft-{width}x{height}.jpg'}
def helix(
category: str, data: list, oauth_token: str, client_id: str
) -> requests.Response:
return request(
"helix/games",
"helix/" + category,
{"Authorization": "Bearer " + oauth_token, "Client-Id": client_id},
{"name": game_list}
)


def user(user_list: list, oauth_token: str, client_id: str) -> requests.Response:
# just like game() but for users
return request(
"helix/users",
{"Authorization": "Bearer " + oauth_token, "Client-Id": client_id},
{"login": user_list}
{"login" if category == "users" else "name": data},
)


Expand Down

0 comments on commit 887780d

Please sign in to comment.