From 20949e77381afd23e4ebe183eeef9b7c3c3476c0 Mon Sep 17 00:00:00 2001 From: DevilXD Date: Tue, 25 Jan 2022 16:04:56 +0100 Subject: [PATCH] Unify constants variables documentation --- constants.py | 47 ++++++++++++++++++++++++++--------------------- twitch.py | 5 +++-- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/constants.py b/constants.py index 0556a56..806df62 100644 --- a/constants.py +++ b/constants.py @@ -82,71 +82,76 @@ class GQLOperation(JsonType): GQL_OPERATIONS: Dict[str, GQLOperation] = { - "IsStreamLive": GQLOperation( - "WithIsStreamLiveQuery", - "04e46329a6786ff3a81c01c50bfa5d725902507a0deb83b0edbf7abe7a3716ea", - ), # returns stream information for a particular channel "GetStreamInfo": GQLOperation( "VideoPlayerStreamInfoOverlayChannel", "a5f2e34d626a9f4f5c0204f910bab2194948a9502089be558bb6e779a9e1b3d2", + variables={ + "channel": ..., # channel login + }, ), # can be used to claim channel points "ClaimCommunityPoints": GQLOperation( "ClaimCommunityPoints", "46aaeebe02c99afdf4fc97c7c0cba964124bf6b0af229395f1f6d1feed05b3d0", + variables={ + "input": { + "claimID": ..., # points claim_id + "channelID": ..., # channel ID as a str + }, + }, ), # can be used to claim a drop "ClaimDrop": GQLOperation( "DropsPage_ClaimDropRewards", "2f884fa187b8fadb2a49db0adc033e636f7b6aaee6e76de1e2bba9a7baf0daf6", + variables={ + "input": { + "dropInstanceID": ..., # drop claim_id + }, + }, ), # returns current state of points (balance, claim available) for a particular channel "ChannelPointsContext": GQLOperation( "ChannelPointsContext", "9988086babc615a918a1e9a722ff41d98847acac822645209ac7379eecb27152", + variables={ + "channelLogin": ..., # channel login + }, ), # returns all in-progress campaigns "Inventory": GQLOperation( "Inventory", "27f074f54ff74e0b05c8244ef2667180c2f911255e589ccd693a1a52ccca7367", + # no variables needed ), # returns current state of drops (current drop progress) "CurrentDrop": GQLOperation( "DropCurrentSessionContext", "2e4b3630b91552eb05b76a94b6850eb25fe42263b7cf6d06bee6d156dd247c1c", + # no variables needed ), # returns all available campaigns "Campaigns": GQLOperation( "ViewerDropsDashboard", "e8b98b52bbd7ccd37d0b671ad0d47be5238caa5bea637d2a65776175b4a23a64", + # no variables needed ), # returns extended information about a particular campaign "CampaignDetails": GQLOperation( "DropCampaignDetails", "f6396f5ffdde867a8f6f6da18286e4baf02e5b98d14689a69b5af320a4c7b7b8", variables={ - "channelLogin": ..., # user ID + "channelLogin": ..., # user login "dropID": ..., # campaign ID }, ), - # returns drops available for a particular channel + # returns drops available for a particular channel (unused) "ChannelDrops": GQLOperation( "DropsHighlightService_AvailableDrops", "b19ee96a0e79e3f8281c4108bc4c7b3f232266db6f96fd04a339ab393673a075", - variables={"channelID": ...}, - ), - "PersonalSections": GQLOperation( - "PersonalSections", - "9fbdfb00156f754c26bde81eb47436dee146655c92682328457037da1a48ed39", variables={ - "input": { - "sectionInputs": ["FOLLOWED_SECTION"], - "recommendationContext": {"platform": "web"}, - }, - "channelLogin": None, - "withChannelUser": False, - "creatorAnniversariesExperimentEnabled": False, + "channelID": ..., # channel ID as a str }, ), # returns live channels for a particular game @@ -154,13 +159,13 @@ GQL_OPERATIONS: Dict[str, GQLOperation] = { "DirectoryPage_Game", "d5c5df7ab9ae65c3ea0f225738c08a36a4a76e4c6c31db7f8c4b8dc064227f9e", variables={ - "limit": 40, - "name": "", + "limit": ..., # limit of channels returned + "name": ..., # game name "options": { "includeRestricted": ["SUB_ONLY_LIVE"], "recommendationsContext": {"platform": "web"}, "sort": "RELEVANCE", - "tags": [], + "tags": [], # list of tag IDs "requestID": "JIRA-VXP-2397", }, "sortTypeIsRecency": False, diff --git a/twitch.py b/twitch.py index cd5422f..ccdc985 100644 --- a/twitch.py +++ b/twitch.py @@ -838,7 +838,8 @@ class Twitch: ] async def claim_points(self, channel_id: Union[str, int], claim_id: str) -> None: - variables = {"input": {"channelID": str(channel_id), "claimID": claim_id}} await self.gql_request( - GQL_OPERATIONS["ClaimCommunityPoints"].with_variables(variables) + GQL_OPERATIONS["ClaimCommunityPoints"].with_variables( + {"input": {"channelID": str(channel_id), "claimID": claim_id}} + ) )