29 lines
931 B
Python
29 lines
931 B
Python
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)
|