Add WeCom card client for retrieving check-in records

This commit is contained in:
2026-01-16 10:48:14 +08:00
parent 1496af0973
commit 1f5140c0fe
4 changed files with 78 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
from service.wecom.exceptions.general import SDKException
from service.wecom.modules.base import WecomBaseClient
from service.wecom.schemas.card import (
GetCardRecord,
GetCardRecordsRequest,
GetCardRecordsResponse,
)
from service.wecom.utils.requests import HttpxRequest
class WecomCardClient(WecomBaseClient):
async def get_card_records(
self, data: GetCardRecordsRequest
) -> list[GetCardRecord]:
"""
获取打卡记录数据
@param data: 获取打卡记录数据的参数
"""
url = self.BASE_URL + "/checkin/getcheckindata"
params = {"access_token": await self.access_token}
resp = GetCardRecordsResponse(
**await HttpxRequest.post(url=url, params=params, json=data.model_dump())
)
if resp.errcode == 0:
return resp.checkindata
else:
raise SDKException(resp.errcode, resp.errmsg)