Skip to content

children_department_request 中的 department_id 类型标注错误 #100

@Aolinlu

Description

@Aolinlu

文件位置:lark_oapi\api\contact\v3\model\children_department_request.py

ChildrenDepartmentRequest 目前定义如下:

class ChildrenDepartmentRequest(BaseRequest):
    def __init__(self) -> None:
        super().__init__()
        self.user_id_type: Optional[str] = None
        self.department_id_type: Optional[str] = None
        self.fetch_child: Optional[bool] = None
        self.page_size: Optional[int] = None
        self.page_token: Optional[str] = None
        *self.department_id: Optional[int] = None*

    @staticmethod
    def builder() -> "ChildrenDepartmentRequestBuilder":
        return ChildrenDepartmentRequestBuilder()

可以看到 department_id 的类型标注为 int,但是根据调试工具,不难发现,实际上很多部门的 id 并非一个数字,而是一个字符串,例如:

Image

此外,当使用该 str 类型的 department_id,去获取子部门时,也能正确获取到数据,如下图所示:

Image

获取到的子部门数据是正确的,但是截图范围比较小,没有截掉

所以这里应该更换成:

self.department_id: Optional[str] = None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions