Skip to content

Commit

Permalink
feat: jianshu_lottery 模块更名为 lottery
Browse files Browse the repository at this point in the history
  • Loading branch information
FHU-yezi committed Mar 14, 2024
1 parent 389a8eb commit e6dee6b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions jkit/jianshu_lottery.py → jkit/lottery.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ def to_user_obj(self) -> "User":
return User.from_slug(self.slug)._as_checked()


class JianshuLotteryWinRecord(DataObject, **DATA_OBJECT_CONFIG):
class LotteryWinRecord(DataObject, **DATA_OBJECT_CONFIG):
id: PositiveInt
time: NormalizedDatetime
award_name: NonEmptyStr

user_info: UserInfoField


class JianshuLottery(ResourceObject):
class Lottery(ResourceObject):
async def iter_win_records(
self, *, count: int = 100
) -> AsyncGenerator[JianshuLotteryWinRecord, None]:
) -> AsyncGenerator[LotteryWinRecord, None]:
data: List[Dict[str, Any]] = await get_json(
endpoint=CONFIG.endpoints.jianshu,
path="/asimov/ad_rewards/winner_list",
params={"count": count},
) # type: ignore

for item in data:
yield JianshuLotteryWinRecord(
yield LotteryWinRecord(
id=item["id"],
time=normalize_datetime(item["created_at"]),
award_name=item["name"],
Expand Down

0 comments on commit e6dee6b

Please sign in to comment.