# Code generated by lark_sdk_gen. DO NOT EDIT.

from pylark.lark_request import RawRequestReq, _new_method_option
import attr
import typing
import io


@attr.s
class GetHelpdeskTicketMessageListReq(object):
    time_start: int = attr.ib(
        default=0, metadata={"req_type": "query"}
    )  # 起始时间, 示例值：1617960686000
    time_end: int = attr.ib(
        default=0, metadata={"req_type": "query"}
    )  # 结束时间, 示例值：1617960687000
    page: int = attr.ib(default=0, metadata={"req_type": "query"})  # 页数ID, 示例值：1
    page_size: int = attr.ib(
        default=0, metadata={"req_type": "query"}
    )  # 消息数量，最大200，默认20, 示例值：10
    ticket_id: str = attr.ib(
        default="", metadata={"req_type": "path"}
    )  # 工单ID, 示例值："6948728206392295444"


@attr.s
class GetHelpdeskTicketMessageListRespMessageMessageType(object):
    pass


@attr.s
class GetHelpdeskTicketMessageListRespMessage(object):
    id: str = attr.ib(default="", metadata={"req_type": "json"})  # 工单消息ID
    message_id: str = attr.ib(default="", metadata={"req_type": "json"})  # chat消息ID
    message_type: GetHelpdeskTicketMessageListRespMessageMessageType = attr.ib(
        factory=lambda: GetHelpdeskTicketMessageListRespMessageMessageType(),
        metadata={"req_type": "json"},
    )  # 消息类型；text：纯文本；post：富文本
    created_at: int = attr.ib(default=0, metadata={"req_type": "json"})  # 创建时间
    content: str = attr.ib(default="", metadata={"req_type": "json"})  # 内容
    user_name: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户名
    avatar_url: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户图片url
    user_id: str = attr.ib(default="", metadata={"req_type": "json"})  # 用户open ID


@attr.s
class GetHelpdeskTicketMessageListResp(object):
    messages: typing.List[GetHelpdeskTicketMessageListRespMessage] = attr.ib(
        factory=lambda: [], metadata={"req_type": "json"}
    )  # 工单消息列表
    total: int = attr.ib(default=0, metadata={"req_type": "json"})  # 消息总数


def _gen_get_helpdesk_ticket_message_list_req(request, options) -> RawRequestReq:
    return RawRequestReq(
        dataclass=GetHelpdeskTicketMessageListResp,
        scope="Helpdesk",
        api="GetHelpdeskTicketMessageList",
        method="GET",
        url="https://open.feishu.cn/open-apis/helpdesk/v1/tickets/:ticket_id/messages",
        body=request,
        method_option=_new_method_option(options),
        need_tenant_access_token=True,
        need_helpdesk_auth=True,
    )
