Skip to content

Commit fe3f5cc

Browse files
committed
Remove token_for for rest of CustomRewards
1 parent a2ffb9b commit fe3f5cc

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

twitchio/models/channel_points.py

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,13 @@ async def delete(self) -> None:
229229
.. note::
230230
Requires a user access token that includes the ``channel:manage:redemptions`` scope.
231231
"""
232-
await self._http.delete_custom_reward(broadcaster_id=self.broadcaster.id, reward_id=self.id, token_for=self.broadcaster.id)
232+
await self._http.delete_custom_reward(
233+
broadcaster_id=self.broadcaster.id, reward_id=self.id, token_for=self.broadcaster.id
234+
)
233235

234236
async def update(
235237
self,
236238
*,
237-
token_for: str | PartialUser,
238239
title: str | None = None,
239240
cost: int | None = None,
240241
prompt: str | None = None,
@@ -256,8 +257,6 @@ async def update(
256257
257258
Parameters
258259
-----------
259-
token_for: str | PartialUser
260-
The user's token that has permission manage the reward.
261260
title: str | None
262261
The user's token that has permission manage the reward.
263262
cost: int | None
@@ -308,7 +307,7 @@ async def update(
308307

309308
data = await self._http.patch_custom_reward(
310309
broadcaster_id=self.broadcaster.id,
311-
token_for=token_for,
310+
token_for=self.broadcaster.id,
312311
reward_id=self.id,
313312
title=title,
314313
cost=cost,
@@ -327,7 +326,6 @@ async def update(
327326
def fetch_redemptions(
328327
self,
329328
*,
330-
token_for: str | PartialUser,
331329
status: Literal["CANCELED", "FULFILLED", "UNFULFILLED"],
332330
ids: list[str] | None = None,
333331
sort: Literal["OLDEST", "NEWEST"] = "OLDEST",
@@ -342,8 +340,6 @@ def fetch_redemptions(
342340
343341
Parameters
344342
-----------
345-
token_for: str | PartialUser
346-
The user's token that has permission manage or read the broadcaster's reward redemptions.
347343
status: typing.Literal["CANCELED", "FULFILLED", "UNFULFILLED"]
348344
The state of the redemption. This can be one of the following: "CANCELED", "FULFILLED", "UNFULFILLED"
349345
ids: list[str] | None
@@ -371,7 +367,7 @@ def fetch_redemptions(
371367

372368
return self._http.get_custom_reward_redemptions(
373369
broadcaster_id=self.broadcaster.id,
374-
token_for=token_for,
370+
token_for=self.broadcaster.id,
375371
reward_id=self.id,
376372
ids=ids,
377373
status=status,
@@ -417,49 +413,40 @@ def __init__(
417413
def __repr__(self) -> str:
418414
return f"<CustomRewardRedemption id={self.id} status={self.status} redeemed_at={self.redeemed_at}>"
419415

420-
async def fulfill(self, *, token_for: str | PartialUser) -> CustomRewardRedemption:
416+
async def fulfill(self) -> CustomRewardRedemption:
421417
"""Updates a redemption's status to FULFILLED.
422418
423419
.. note::
424420
Requires a user access token that includes the ``channel:manage:redemptions`` scope.
425421
426-
Parameters
427-
-----------
428-
token_for: str | PartialUser
429-
The user's token that has permission manage the broadcaster's reward redemptions.
430422
431423
Returns
432424
--------
433425
CustomRewardRedemption
434426
"""
435427
data = await self._http.patch_custom_reward_redemption(
436428
broadcaster_id=self.reward.broadcaster.id,
437-
id=self.id,
438-
token_for=token_for,
429+
id=self.reward.broadcaster.id,
430+
token_for=self,
439431
reward_id=self.reward.id,
440432
status="FULFILLED",
441433
)
442434
return CustomRewardRedemption(data["data"][0], parent_reward=self.reward, http=self._http)
443435

444-
async def refund(self, *, token_for: str | PartialUser) -> CustomRewardRedemption:
436+
async def refund(self) -> CustomRewardRedemption:
445437
"""Updates a redemption's status to CANCELED.
446438
447439
.. note::
448440
Requires a user access token that includes the ``channel:manage:redemptions`` scope.
449441
450-
Parameters
451-
-----------
452-
token_for: str | PartialUser
453-
The user's token that has permission manage the broadcaster's reward redemptions.
454-
455442
Returns
456443
--------
457444
CustomRewardRedemption
458445
"""
459446
data = await self._http.patch_custom_reward_redemption(
460447
broadcaster_id=self.reward.broadcaster.id,
461448
id=self.id,
462-
token_for=token_for,
449+
token_for=self.reward.broadcaster.id,
463450
reward_id=self.reward.id,
464451
status="CANCELED",
465452
)

0 commit comments

Comments
 (0)