pixelarraythirdparty 1.2.6__tar.gz → 1.2.8__tar.gz

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.
Files changed (30) hide show
  1. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/PKG-INFO +1 -1
  2. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/__init__.py +6 -3
  3. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/feedback/feedback.py +18 -0
  4. pixelarraythirdparty-1.2.8/pixelarraythirdparty/support_chat/support_chat.py +29 -0
  5. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/unified_login/__init__.py +2 -0
  6. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/unified_login/unified_login.py +110 -1
  7. pixelarraythirdparty-1.2.8/pixelarraythirdparty/user/__init__.py +0 -0
  8. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty.egg-info/PKG-INFO +1 -1
  9. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty.egg-info/SOURCES.txt +2 -2
  10. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pyproject.toml +1 -1
  11. pixelarraythirdparty-1.2.6/pixelarraythirdparty/temporary_phone/__init__.py +0 -10
  12. pixelarraythirdparty-1.2.6/pixelarraythirdparty/temporary_phone/temporary_phone.py +0 -47
  13. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/LICENSE +0 -0
  14. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/MANIFEST.in +0 -0
  15. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/client.py +0 -0
  16. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/cron/__init__.py +0 -0
  17. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/cron/cron.py +0 -0
  18. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/feedback/__init__.py +0 -0
  19. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/order/__init__.py +0 -0
  20. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/order/order.py +0 -0
  21. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/product/__init__.py +0 -0
  22. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/product/product.py +0 -0
  23. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/project/__init__.py +0 -0
  24. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/project/project.py +0 -0
  25. {pixelarraythirdparty-1.2.6/pixelarraythirdparty/user → pixelarraythirdparty-1.2.8/pixelarraythirdparty/support_chat}/__init__.py +0 -0
  26. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty/user/user.py +0 -0
  27. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty.egg-info/dependency_links.txt +0 -0
  28. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty.egg-info/requires.txt +0 -0
  29. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/pixelarraythirdparty.egg-info/top_level.txt +0 -0
  30. {pixelarraythirdparty-1.2.6 → pixelarraythirdparty-1.2.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pixelarraythirdparty
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: PixelArray 第三方微服务客户端
5
5
  Author-email: Lu qi <qi.lu@pixelarrayai.com>
6
6
  License-Expression: MIT
@@ -11,10 +11,12 @@ PixelArray 第三方微服务客户端
11
11
  - unified_login: 统一登录模块
12
12
  - feedback: 客户反馈模块
13
13
  - project: 项目管理模块
14
- - temporary_phone: 临时手机号接码模块
14
+ - support_chat: 在线客服(临时会话链接)
15
15
  """
16
16
 
17
- __version__ = "1.2.6"
17
+ from .support_chat.support_chat import SupportChatManagerAsync
18
+
19
+ __version__ = "1.2.8"
18
20
  __author__ = "Lu qi"
19
21
  __email__ = "qi.lu@pixelarrayai.com"
20
22
 
@@ -26,5 +28,6 @@ __all__ = [
26
28
  "order",
27
29
  "feedback",
28
30
  "project",
29
- "temporary_phone",
31
+ "support_chat",
32
+ "SupportChatManagerAsync",
30
33
  ]
@@ -256,6 +256,24 @@ class FeedbackManagerAsync(AsyncClient):
256
256
  return data, False
257
257
  return data, True
258
258
 
259
+ async def delete_feedback_batch(self, feedback_ids: List[int]):
260
+ """
261
+ description:
262
+ 批量删除反馈记录。仅管理员可操作。不存在的 ID 会跳过,返回实际删除数量。
263
+ parameters:
264
+ feedback_ids(List[int]): 反馈 ID 列表,最多 100 条
265
+ return:
266
+ data(dict): 成功时包含 deleted_count(int) 实际删除数量
267
+ success(bool): 操作是否成功
268
+ """
269
+ if not feedback_ids:
270
+ return {"message": "请提供要删除的反馈 ID 列表"}, False
271
+ payload = {"feedback_ids": feedback_ids}
272
+ data, success = await self._request("POST", "/api/feedback/batch-delete", json=payload)
273
+ if not success:
274
+ return data, False
275
+ return data, True
276
+
259
277
  async def create_ticket_link(
260
278
  self,
261
279
  project_id: int,
@@ -0,0 +1,29 @@
1
+ from pixelarraythirdparty.client import AsyncClient
2
+
3
+
4
+ class SupportChatManagerAsync(AsyncClient):
5
+ async def create_support_chat_link(
6
+ self,
7
+ expires_in_hours: int = 24,
8
+ ):
9
+ """
10
+ description:
11
+ 创建在线客服临时会话链接。其它服务调用此接口后,将返回的 chat_url 下发给用户,
12
+ 用户打开链接即可与客服对话(无需登录)。链接有时效。
13
+ parameters:
14
+ expires_in_hours(int, optional): 链接有效小时数,默认 24,范围 1~720
15
+ return:
16
+ data(dict): 成功时包含
17
+ - chat_url(str): 客服聊天页完整 URL
18
+ - token(str): 会话 token
19
+ - session_id(int): 会话 ID
20
+ - expires_at(str): 过期时间
21
+ success(bool): 操作是否成功
22
+ """
23
+ payload = {"expires_in_hours": expires_in_hours}
24
+ data, success = await self._request(
25
+ "POST", "/api/support-chat/create-link", json=payload
26
+ )
27
+ if not success:
28
+ return data, False
29
+ return data, True
@@ -8,6 +8,7 @@ from .unified_login import (
8
8
  GitLabLogin,
9
9
  SMSLogin,
10
10
  EmailLogin,
11
+ PasswordLogin,
11
12
  )
12
13
 
13
14
  __all__ = [
@@ -20,5 +21,6 @@ __all__ = [
20
21
  "GitLabLogin",
21
22
  "SMSLogin",
22
23
  "EmailLogin",
24
+ "PasswordLogin",
23
25
  ]
24
26
 
@@ -1,7 +1,7 @@
1
1
  import asyncio
2
2
  import urllib.parse
3
3
  import webbrowser
4
- from typing import Dict, Optional, Tuple
4
+ from typing import Any, Dict, Optional, Tuple
5
5
 
6
6
  from pixelarraythirdparty.client import AsyncClient
7
7
 
@@ -917,3 +917,112 @@ class EmailLogin(AsyncClient):
917
917
  return {"message": "验证码校验失败"}, False
918
918
 
919
919
  return await self._wait_for_login(email, timeout)
920
+
921
+
922
+ class PasswordLogin(AsyncClient):
923
+ """
924
+ 密码登录客户端(邮箱 + 密码,统一登录外部用户表)
925
+
926
+ 使用示例:
927
+ ```
928
+ password_client = PasswordLogin(api_key="your_api_key")
929
+ # 注册/设置密码
930
+ success = await password_client.register(
931
+ user_identifier="user@example.com",
932
+ password="your_password",
933
+ display_name="可选展示名",
934
+ )
935
+ if success:
936
+ # 登录
937
+ user_info, success = await password_client.login(
938
+ user_identifier="user@example.com",
939
+ password="your_password",
940
+ )
941
+ # 修改密码
942
+ success = await password_client.change_password(
943
+ user_identifier="user@example.com",
944
+ old_password="old_password",
945
+ new_password="new_password",
946
+ )
947
+ ```
948
+ """
949
+
950
+ def __init__(self, api_key: str):
951
+ super().__init__(api_key)
952
+
953
+ async def register(
954
+ self,
955
+ user_identifier: str,
956
+ password: str,
957
+ display_name: Optional[str] = None,
958
+ ) -> bool:
959
+ """
960
+ 注册/设置密码:将密码哈希后写入外部用户表(login_method=password)。
961
+ 若该邮箱已存在则更新密码与展示名称。
962
+
963
+ :param user_identifier: 用户标识(邮箱)
964
+ :param password: 密码(6~100 位)
965
+ :param display_name: 展示名称,可选
966
+ :return: 是否成功
967
+ """
968
+ payload: Dict[str, Any] = {
969
+ "user_identifier": user_identifier,
970
+ "password": password,
971
+ }
972
+ if display_name is not None:
973
+ payload["display_name"] = display_name
974
+ _, success = await self._request(
975
+ "POST",
976
+ "/api/unified-login/password/register",
977
+ json=payload,
978
+ )
979
+ return bool(success)
980
+
981
+ async def login(
982
+ self,
983
+ user_identifier: str,
984
+ password: str,
985
+ ) -> Tuple[Dict, bool]:
986
+ """
987
+ 密码登录:校验邮箱与密码,成功则返回用户信息(与其它统一登录方式格式一致)。
988
+
989
+ :param user_identifier: 用户标识(邮箱)
990
+ :param password: 密码
991
+ :return: (用户信息字典, 是否成功)
992
+ """
993
+ data, success = await self._request(
994
+ "POST",
995
+ "/api/unified-login/password/login",
996
+ json={
997
+ "user_identifier": user_identifier,
998
+ "password": password,
999
+ },
1000
+ )
1001
+ if not success:
1002
+ return data if isinstance(data, dict) else {"message": data}, False
1003
+ return data, True
1004
+
1005
+ async def change_password(
1006
+ self,
1007
+ user_identifier: str,
1008
+ old_password: str,
1009
+ new_password: str,
1010
+ ) -> bool:
1011
+ """
1012
+ 修改密码:校验原密码后更新为新密码。
1013
+
1014
+ :param user_identifier: 用户标识(邮箱)
1015
+ :param old_password: 当前密码
1016
+ :param new_password: 新密码(6~100 位)
1017
+ :return: 是否成功
1018
+ """
1019
+ _, success = await self._request(
1020
+ "POST",
1021
+ "/api/unified-login/password/change",
1022
+ json={
1023
+ "user_identifier": user_identifier,
1024
+ "old_password": old_password,
1025
+ "new_password": new_password,
1026
+ },
1027
+ )
1028
+ return bool(success)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pixelarraythirdparty
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: PixelArray 第三方微服务客户端
5
5
  Author-email: Lu qi <qi.lu@pixelarrayai.com>
6
6
  License-Expression: MIT
@@ -18,8 +18,8 @@ pixelarraythirdparty/product/__init__.py
18
18
  pixelarraythirdparty/product/product.py
19
19
  pixelarraythirdparty/project/__init__.py
20
20
  pixelarraythirdparty/project/project.py
21
- pixelarraythirdparty/temporary_phone/__init__.py
22
- pixelarraythirdparty/temporary_phone/temporary_phone.py
21
+ pixelarraythirdparty/support_chat/__init__.py
22
+ pixelarraythirdparty/support_chat/support_chat.py
23
23
  pixelarraythirdparty/unified_login/__init__.py
24
24
  pixelarraythirdparty/unified_login/unified_login.py
25
25
  pixelarraythirdparty/user/__init__.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pixelarraythirdparty"
7
- version = "1.2.6"
7
+ version = "1.2.8"
8
8
  authors = [
9
9
  {name = "Lu qi", email = "qi.lu@pixelarrayai.com"},
10
10
  ]
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
-
4
- """
5
- 临时手机号接码模块
6
- """
7
-
8
- from .temporary_phone import TemporaryPhoneAsync
9
-
10
- __all__ = ["TemporaryPhoneAsync"]
@@ -1,47 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
-
4
- """
5
- 临时手机号接码客户端
6
- 基于RapidAPI的temp-phone-number-sms实现
7
- """
8
-
9
- from typing import Dict, Tuple
10
- from ..client import AsyncClient
11
-
12
-
13
- class TemporaryPhoneAsync(AsyncClient):
14
- """
15
- 临时手机号接码异步客户端类
16
- 提供临时手机号接码相关的API调用方法
17
- """
18
-
19
- async def get_number_sms(self, phone_number: str) -> Tuple[Dict, bool]:
20
- """
21
- description:
22
- 获取手机号短信
23
- parameters:
24
- phone_number(str): 手机号码
25
- return:
26
- data(dict): 响应数据
27
- success(bool): 是否成功
28
- """
29
- result = await self._request(
30
- "GET", "/api/temporary-phone/number-sms", params={"phone_number": phone_number}
31
- )
32
- return result
33
-
34
- async def get_temp_number(self, country_code: str) -> Tuple[Dict, bool]:
35
- """
36
- description:
37
- 获取临时手机号
38
- parameters:
39
- country_code(str): 国家代码(如:in, us, br等)
40
- return:
41
- data(dict): 响应数据
42
- success(bool): 是否成功
43
- """
44
- result = await self._request(
45
- "GET", "/api/temporary-phone/temp-number", params={"country_code": country_code}
46
- )
47
- return result