pixelarraythirdparty 1.3.5__tar.gz → 1.3.7__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 (33) hide show
  1. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/PKG-INFO +2 -1
  2. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/__init__.py +8 -2
  3. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/order/order.py +8 -0
  4. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/project/project.py +1 -1
  5. pixelarraythirdparty-1.3.7/pixelarraythirdparty/support_chat/support_chat.py +157 -0
  6. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty.egg-info/PKG-INFO +2 -1
  7. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pyproject.toml +2 -1
  8. pixelarraythirdparty-1.3.5/pixelarraythirdparty/support_chat/support_chat.py +0 -29
  9. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/LICENSE +0 -0
  10. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/MANIFEST.in +0 -0
  11. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/client.py +0 -0
  12. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/cron/__init__.py +0 -0
  13. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/cron/cron.py +0 -0
  14. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/custom_events/__init__.py +0 -0
  15. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/custom_events/custom_events.py +0 -0
  16. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/feedback/__init__.py +0 -0
  17. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/feedback/feedback.py +0 -0
  18. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/order/__init__.py +0 -0
  19. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/product/__init__.py +0 -0
  20. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/product/product.py +0 -0
  21. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/project/__init__.py +0 -0
  22. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/project_dashboard/__init__.py +0 -0
  23. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/project_dashboard/project_dashboard.py +0 -0
  24. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/support_chat/__init__.py +0 -0
  25. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/unified_login/__init__.py +0 -0
  26. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/unified_login/unified_login.py +0 -0
  27. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/user/__init__.py +0 -0
  28. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty/user/user.py +0 -0
  29. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty.egg-info/SOURCES.txt +0 -0
  30. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty.egg-info/dependency_links.txt +0 -0
  31. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty.egg-info/requires.txt +0 -0
  32. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/pixelarraythirdparty.egg-info/top_level.txt +0 -0
  33. {pixelarraythirdparty-1.3.5 → pixelarraythirdparty-1.3.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pixelarraythirdparty
3
- Version: 1.3.5
3
+ Version: 1.3.7
4
4
  Summary: PixelArray 第三方微服务客户端
5
5
  Author-email: Lu qi <qi.lu@pixelarrayai.com>
6
6
  License-Expression: MIT
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
18
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
20
  Classifier: Topic :: Utilities
20
21
  Requires-Python: >=3.8
@@ -16,11 +16,15 @@ PixelArray 第三方微服务客户端
16
16
  - project_dashboard: 项目看板(按 scope 查询 DNU/DAU/留存)
17
17
  """
18
18
 
19
- from .support_chat.support_chat import SupportChatManagerAsync
19
+ from .feedback.feedback import FeedbackManagerAsync
20
+ from .support_chat.support_chat import (
21
+ SupportChatManagerAsync,
22
+ build_staff_portal_session_url,
23
+ )
20
24
  from .custom_events.custom_events import CustomEventsManagerAsync
21
25
  from .project_dashboard.project_dashboard import ProjectDashboardManagerAsync
22
26
 
23
- __version__ = "1.3.5"
27
+ __version__ = "1.3.7"
24
28
  __author__ = "Lu qi"
25
29
  __email__ = "qi.lu@pixelarrayai.com"
26
30
 
@@ -35,7 +39,9 @@ __all__ = [
35
39
  "support_chat",
36
40
  "custom_events",
37
41
  "project_dashboard",
42
+ "FeedbackManagerAsync",
38
43
  "SupportChatManagerAsync",
44
+ "build_staff_portal_session_url",
39
45
  "CustomEventsManagerAsync",
40
46
  "ProjectDashboardManagerAsync",
41
47
  ]
@@ -8,6 +8,7 @@ class OrderManagerAsync(AsyncClient):
8
8
  body: str = None,
9
9
  remark: str = None,
10
10
  payment_channel: str = "WECHAT",
11
+ amount_yuan: float = None,
11
12
  ):
12
13
  """
13
14
  description:
@@ -17,6 +18,7 @@ class OrderManagerAsync(AsyncClient):
17
18
  body(str): 商品描述
18
19
  remark(str): 订单备注
19
20
  payment_channel(str): 支付渠道,可选值:"WECHAT"(微信支付)、"ALIPAY"(支付宝支付)
21
+ amount_yuan(float, optional): 订单金额(元),可变金额产品必填
20
22
  return:
21
23
  data(dict): 订单信息
22
24
  - id(int): 订单ID
@@ -38,6 +40,8 @@ class OrderManagerAsync(AsyncClient):
38
40
  "remark": remark,
39
41
  "payment_channel": payment_channel,
40
42
  }
43
+ if amount_yuan is not None:
44
+ data["amount_yuan"] = amount_yuan
41
45
  data, success = await self._request("POST", "/api/orders/create", json=data)
42
46
  if not success:
43
47
  return data, False
@@ -49,6 +53,7 @@ class OrderManagerAsync(AsyncClient):
49
53
  body: str = None,
50
54
  remark: str = None,
51
55
  payment_channel: str = "WECHAT",
56
+ amount_yuan: float = None,
52
57
  ):
53
58
  """
54
59
  description:
@@ -59,6 +64,7 @@ class OrderManagerAsync(AsyncClient):
59
64
  body(str): 商品描述
60
65
  remark(str): 订单备注
61
66
  payment_channel(str): 支付渠道,可选值:"WECHAT"、"ALIPAY"、"PAYPAL"
67
+ amount_yuan(float, optional): 订单金额(元),可变金额产品必填
62
68
  return:
63
69
  data(dict): 返回数据
64
70
  - order(dict): 订单信息(字段同 create_order 返回)
@@ -71,6 +77,8 @@ class OrderManagerAsync(AsyncClient):
71
77
  "remark": remark,
72
78
  "payment_channel": payment_channel,
73
79
  }
80
+ if amount_yuan is not None:
81
+ data["amount_yuan"] = amount_yuan
74
82
  data, success = await self._request("POST", "/api/orders/create_v2", json=data)
75
83
  if not success:
76
84
  return data, False
@@ -69,7 +69,7 @@ class ProjectManagerAsync(AsyncClient):
69
69
  project_id(int): 项目ID
70
70
  name(str): 新项目名称
71
71
  return:
72
- data(dict): 更新后的项目信息(含 id、name、bound_domains、created_at)
72
+ data(dict): 更新后的项目信息(含 id、name、created_at)
73
73
  success(bool): 操作是否成功
74
74
  """
75
75
  data = {"name": name}
@@ -0,0 +1,157 @@
1
+ from typing import List, Optional
2
+
3
+ from pixelarraythirdparty.client import AsyncClient
4
+
5
+
6
+ def build_staff_portal_session_url(portal_base_url: str, session_id: int) -> str:
7
+ """
8
+ 拼接带会话 ID 的 Portal 客服管理页 URL,便于运营在浏览器中打开指定会话。
9
+ portal_base_url 为 Portal 站点根地址(与工单 ticket_url 所用域名一致,不含末尾斜杠亦可)。
10
+ """
11
+ base = (portal_base_url or "").strip().rstrip("/")
12
+ return f"{base}/support-chat-management?session_id={session_id}"
13
+
14
+
15
+ class SupportChatManagerAsync(AsyncClient):
16
+ async def create_support_chat_link(
17
+ self,
18
+ expires_in_hours: int = 24,
19
+ ):
20
+ """
21
+ description:
22
+ 创建在线客服临时会话链接。其它服务调用此接口后,将返回的 chat_url 下发给用户,
23
+ 用户打开链接即可与客服对话(无需登录)。链接有时效。
24
+ parameters:
25
+ expires_in_hours(int, optional): 链接有效小时数,默认 24,范围 1~720
26
+ return:
27
+ data(dict): 成功时包含
28
+ - chat_url(str): 客服聊天页完整 URL
29
+ - token(str): 会话 token
30
+ - session_id(int): 会话 ID
31
+ - expires_at(str): 过期时间
32
+ success(bool): 操作是否成功
33
+ """
34
+ payload = {"expires_in_hours": expires_in_hours}
35
+ data, success = await self._request(
36
+ "POST", "/api/support-chat/create-link", json=payload
37
+ )
38
+ if not success:
39
+ return data, False
40
+ return data, True
41
+
42
+ async def list_support_chat_sessions(
43
+ self,
44
+ page: int = 1,
45
+ page_size: int = 20,
46
+ ):
47
+ """
48
+ 客服端:分页查询会话列表(需 API Key)。返回每条含 unread_from_customer 等字段。
49
+ """
50
+ params = {"page": page, "page_size": page_size}
51
+ data, success = await self._request(
52
+ "GET", "/api/support-chat/sessions", params=params
53
+ )
54
+ if not success:
55
+ return data, False
56
+ return data, True
57
+
58
+ async def get_support_chat_messages(
59
+ self,
60
+ session_id: int,
61
+ since_id: Optional[int] = None,
62
+ ):
63
+ """
64
+ 客服端:拉取指定会话消息(轮询;需 API Key)。媒体消息含 media_url。
65
+ """
66
+ params: dict = {"session_id": session_id}
67
+ if since_id is not None:
68
+ params["since_id"] = since_id
69
+ data, success = await self._request(
70
+ "GET", "/api/support-chat/messages", params=params
71
+ )
72
+ if not success:
73
+ return data, False
74
+ return data, True
75
+
76
+ async def send_support_message(
77
+ self,
78
+ session_id: int,
79
+ content: str = "",
80
+ content_type: str = "text",
81
+ oss_path: Optional[str] = None,
82
+ mime_type: Optional[str] = None,
83
+ ):
84
+ """
85
+ 客服端:发送回复(文本或图片/视频,与 Portal 约定一致;需 API Key)。
86
+ """
87
+ payload = {
88
+ "session_id": session_id,
89
+ "content": content,
90
+ "content_type": content_type,
91
+ }
92
+ if oss_path is not None:
93
+ payload["oss_path"] = oss_path
94
+ if mime_type is not None:
95
+ payload["mime_type"] = mime_type
96
+ data, success = await self._request(
97
+ "POST", "/api/support-chat/send-message", json=payload
98
+ )
99
+ if not success:
100
+ return data, False
101
+ return data, True
102
+
103
+ async def mark_support_session_read(self, session_id: int):
104
+ """客服端:将用户发来且未读的消息标记为已读。"""
105
+ payload = {"session_id": session_id}
106
+ data, success = await self._request(
107
+ "POST", "/api/support-chat/mark-read", json=payload
108
+ )
109
+ if not success:
110
+ return data, False
111
+ return data, True
112
+
113
+ async def get_support_upload_presigned_url(
114
+ self,
115
+ session_id: int,
116
+ file_name: str,
117
+ file_type: str,
118
+ file_size: Optional[int] = None,
119
+ mime_type: Optional[str] = None,
120
+ ):
121
+ """客服端:获取 OSS 直传预签名(image | video)。"""
122
+ payload = {
123
+ "session_id": session_id,
124
+ "file_name": file_name,
125
+ "file_type": file_type,
126
+ }
127
+ if file_size is not None:
128
+ payload["file_size"] = file_size
129
+ if mime_type is not None:
130
+ payload["mime_type"] = mime_type
131
+ data, success = await self._request(
132
+ "POST", "/api/support-chat/upload/presigned-url", json=payload
133
+ )
134
+ if not success:
135
+ return data, False
136
+ return data, True
137
+
138
+ async def delete_support_chat_session(self, session_id: int):
139
+ """客服端:删除单个会话及消息与对应临时 token。"""
140
+ data, success = await self._request(
141
+ "DELETE", f"/api/support-chat/sessions/{session_id}"
142
+ )
143
+ if not success:
144
+ return data, False
145
+ return data, True
146
+
147
+ async def batch_delete_support_chat_sessions(self, session_ids: List[int]):
148
+ """客服端:批量删除会话。"""
149
+ if not session_ids:
150
+ return {"message": "请提供要删除的会话 ID 列表"}, False
151
+ payload = {"session_ids": session_ids}
152
+ data, success = await self._request(
153
+ "POST", "/api/support-chat/sessions/batch-delete", json=payload
154
+ )
155
+ if not success:
156
+ return data, False
157
+ return data, True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pixelarraythirdparty
3
- Version: 1.3.5
3
+ Version: 1.3.7
4
4
  Summary: PixelArray 第三方微服务客户端
5
5
  Author-email: Lu qi <qi.lu@pixelarrayai.com>
6
6
  License-Expression: MIT
@@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
18
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
20
  Classifier: Topic :: Utilities
20
21
  Requires-Python: >=3.8
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pixelarraythirdparty"
7
- version = "1.3.5"
7
+ version = "1.3.7"
8
8
  authors = [
9
9
  {name = "Lu qi", email = "qi.lu@pixelarrayai.com"},
10
10
  ]
@@ -23,6 +23,7 @@ classifiers = [
23
23
  "Programming Language :: Python :: 3.11",
24
24
  "Programming Language :: Python :: 3.12",
25
25
  "Programming Language :: Python :: 3.13",
26
+ "Programming Language :: Python :: 3.14",
26
27
  "Topic :: Software Development :: Libraries :: Python Modules",
27
28
  "Topic :: Utilities",
28
29
  ]
@@ -1,29 +0,0 @@
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