dagster-dingtalk 0.1.19__py3-none-any.whl → 0.1.21__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,6 @@ from datetime import datetime
5
5
  from enum import Enum
6
6
  from pathlib import Path
7
7
  from typing import List, Literal
8
- import platform
9
8
 
10
9
  import httpx
11
10
  from httpx import Client
@@ -34,7 +33,7 @@ class DingTalkClient:
34
33
  self.即时通信 = 即时通信_API(self)
35
34
 
36
35
  def __get_access_token(self) -> str:
37
- access_token_cache = Path.home() / ".dingtalk_cache"
36
+ access_token_cache = Path.home() / ".dagster_dingtalk_cache"
38
37
  all_access_token: dict = {}
39
38
  access_token: str|None = None
40
39
  expire_in: int = 0
@@ -100,6 +99,30 @@ class 智能人事_花名册_API:
100
99
  )
101
100
  return response.json()
102
101
 
102
+ def 获取花名册字段组详情(self) -> dict:
103
+ response = self.__client.oapi.post(
104
+ url="/topapi/smartwork/hrm/employee/field/grouplist",
105
+ json={"agentid": self.__client.agent_id},
106
+ )
107
+ return response.json()
108
+
109
+ def 更新员工花名册信息(self, user_id: str, groups: List[dict]) -> dict:
110
+ """
111
+ 花名册分组数据结构查看 https://open.dingtalk.com/document/orgapp/intelligent-personnel-update-employee-file-information
112
+ :param user_id: 被更新字段信息的员工userid
113
+ :param groups: 花名册分组
114
+ :return:
115
+ """
116
+ response = self.__client.oapi.post(
117
+ url="/topapi/smartwork/hrm/employee/v2/update",
118
+ json={
119
+ "agentid": self.__client.agent_id,
120
+ "param": {"groups": groups},
121
+ "user_id": user_id
122
+ },
123
+ )
124
+ return response.json()
125
+
103
126
  def 获取员工花名册字段信息(self, user_id_list:List[str], field_filter_list:List[str]|None = None, text_to_select_convert:bool|None = None) -> dict:
104
127
  body_dict = {"userIdList": user_id_list, "appAgentId": self.__client.agent_id}
105
128
  if field_filter_list is not None:
@@ -176,6 +199,15 @@ class 通讯录管理_用户管理_API:
176
199
  response = self.__client.api.get(url="/v1.0/contact/empLeaveRecords", params=params)
177
200
  return response.json()
178
201
 
202
+ def 获取部门用户userid列表(self, dept_id: int):
203
+ response = self.__client.oapi.post(url="/topapi/user/listid", json={"dept_id": dept_id})
204
+ return response.json()
205
+
206
+ def 根据unionid获取用户userid(self, unionid: str):
207
+ response = self.__client.oapi.post(url="/topapi/user/getbyunionid", json={"unionid": unionid})
208
+ return response.json()
209
+
210
+
179
211
  # noinspection NonAsciiCharacters
180
212
  class 通讯录管理_部门管理_API:
181
213
  def __init__(self, _client:DingTalkClient):
@@ -211,6 +243,20 @@ class 通讯录管理_部门管理_API:
211
243
  )
212
244
  return response.json()
213
245
 
246
+ def 获取子部门ID列表(self, dept_id: int):
247
+ """
248
+ 调用本接口,获取下一级部门基础信息。
249
+
250
+ https://open.dingtalk.com/document/orgapp/obtain-a-sub-department-id-list-v2
251
+
252
+ :param dept_id: 部门 ID ,根部门 ID 为 1。
253
+ """
254
+ response = self.__client.oapi.post(
255
+ url="/topapi/v2/department/listsubid",
256
+ json={"dept_id": dept_id}
257
+ )
258
+ return response.json()
259
+
214
260
  # noinspection NonAsciiCharacters
215
261
  class 文档文件_API:
216
262
  def __init__(self, _client:DingTalkClient):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dagster-dingtalk
3
- Version: 0.1.19
3
+ Version: 0.1.21
4
4
  Summary: A dagster plugin for the DingTalk
5
5
  Author: YiZixuan
6
6
  Author-email: sqkkyzx@qq.com
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Requires-Dist: dagster (>=1.8.10)
13
13
  Requires-Dist: httpx (>=0.27)
14
- Requires-Dist: pydantic (>=2,<2.10)
14
+ Requires-Dist: pydantic (>=2.10)
15
15
  Description-Content-Type: text/markdown
16
16
 
17
17
  # 钉钉与 Dagster 集成
@@ -1,8 +1,8 @@
1
1
  dagster_dingtalk/__init__.py,sha256=jAyn67nRx5wU0YYWDMRINn7Tt3joP5IXsztTtyMbxsE,424
2
- dagster_dingtalk/app_client.py,sha256=i9az_Dfchx10uYC1jtDqCKihp4bA5nwIcKWFsqV9t-M,26018
2
+ dagster_dingtalk/app_client.py,sha256=Yi8jlaLRdNSEscylmrPkZStDZGAiawZByOBDwknU1oc,27839
3
3
  dagster_dingtalk/operations.py,sha256=C1wwXCW7mpKhLC1-Y7TCP_72L9e93a9ceVHRWhNda-Q,3891
4
4
  dagster_dingtalk/resources.py,sha256=1u8-oXRa7H_e0CAYkTJDxbjEmt3ZcD_ntBNvrS_rwr8,17430
5
5
  dagster_dingtalk/version.py,sha256=ncWWGHPke5qy2-s8w3nAgDE4R__CZi-Q7CLWtmtkbvA,25
6
- dagster_dingtalk-0.1.19.dist-info/METADATA,sha256=P4EkowEGRGm3Ek0Zmr9fWvbutVGJ-nwfYrTvhoEfwUY,7999
7
- dagster_dingtalk-0.1.19.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
8
- dagster_dingtalk-0.1.19.dist-info/RECORD,,
6
+ dagster_dingtalk-0.1.21.dist-info/METADATA,sha256=UVbaACkuv9bBC4sWwuF9HCdbCh00LSEYqllF7TZBfUE,7996
7
+ dagster_dingtalk-0.1.21.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
8
+ dagster_dingtalk-0.1.21.dist-info/RECORD,,