|
12 | 12 |
|
13 | 13 | from ... import keys, methods |
14 | 14 | from ...api.parameters import Cursor, IntRange, ItemCount |
| 15 | +from ...queries import GQLQuery as GQLQry |
15 | 16 | from ...queries import HelixQuery as Qry |
16 | 17 | from ...queries import query |
17 | 18 |
|
@@ -73,3 +74,46 @@ def update_extensions(): |
73 | 74 | q = Qry('users/extensions', method=methods.PUT) |
74 | 75 |
|
75 | 76 | return q |
| 77 | + |
| 78 | + |
| 79 | +# required scope: user_follows_edit |
| 80 | +@query |
| 81 | +def _follow_channel(channel_id, headers={}, notifications=False): |
| 82 | + data = [{ |
| 83 | + "operationName": "FollowButton_FollowUser", |
| 84 | + "variables": { |
| 85 | + "input": { |
| 86 | + "disableNotifications": notifications, |
| 87 | + "targetID": str(channel_id) |
| 88 | + } |
| 89 | + }, |
| 90 | + "extensions": { |
| 91 | + "persistedQuery": { |
| 92 | + "version": 1, |
| 93 | + "sha256Hash": "14319edb840c1dfce880dc64fa28a1f4eb69d821901e9e96eb9610d2e52b54f2" |
| 94 | + } |
| 95 | + } |
| 96 | + }] |
| 97 | + q = GQLQry('', headers=headers, data=data, use_token=False) |
| 98 | + return q |
| 99 | + |
| 100 | + |
| 101 | +# required scope: user_follows_edit |
| 102 | +@query |
| 103 | +def _unfollow_channel(channel_id, headers={}): |
| 104 | + data = [{ |
| 105 | + "operationName": "FollowButton_UnfollowUser", |
| 106 | + "variables": { |
| 107 | + "input": { |
| 108 | + "targetID": str(channel_id) |
| 109 | + } |
| 110 | + }, |
| 111 | + "extensions": { |
| 112 | + "persistedQuery": { |
| 113 | + "version": 1, |
| 114 | + "sha256Hash": "29783a1dac24124e02f7295526241a9f1476cd2f5ce1e394f93ea50c253d8628" |
| 115 | + } |
| 116 | + } |
| 117 | + }] |
| 118 | + q = GQLQry('', headers=headers, data=data, use_token=False) |
| 119 | + return q |
0 commit comments