pixelarraythirdparty 1.2.9__tar.gz → 1.3.2__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.
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/PKG-INFO +1 -1
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/__init__.py +9 -1
- pixelarraythirdparty-1.3.2/pixelarraythirdparty/custom_events/__init__.py +3 -0
- pixelarraythirdparty-1.3.2/pixelarraythirdparty/custom_events/custom_events.py +92 -0
- pixelarraythirdparty-1.3.2/pixelarraythirdparty/project_dashboard/__init__.py +6 -0
- pixelarraythirdparty-1.3.2/pixelarraythirdparty/project_dashboard/project_dashboard.py +51 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty.egg-info/PKG-INFO +1 -1
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty.egg-info/SOURCES.txt +4 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pyproject.toml +1 -1
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/LICENSE +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/MANIFEST.in +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/client.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/cron/__init__.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/cron/cron.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/feedback/__init__.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/feedback/feedback.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/order/__init__.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/order/order.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/product/__init__.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/product/product.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/project/__init__.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/project/project.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/support_chat/__init__.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/support_chat/support_chat.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/unified_login/__init__.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/unified_login/unified_login.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/user/__init__.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/user/user.py +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty.egg-info/dependency_links.txt +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty.egg-info/requires.txt +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty.egg-info/top_level.txt +0 -0
- {pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/setup.cfg +0 -0
|
@@ -12,11 +12,15 @@ PixelArray 第三方微服务客户端
|
|
|
12
12
|
- feedback: 客户反馈模块
|
|
13
13
|
- project: 项目管理模块
|
|
14
14
|
- support_chat: 在线客服(临时会话链接)
|
|
15
|
+
- custom_events: 自定义事件(新建定义与上报)
|
|
16
|
+
- project_dashboard: 项目看板(按 scope 查询 DNU/DAU/留存)
|
|
15
17
|
"""
|
|
16
18
|
|
|
17
19
|
from .support_chat.support_chat import SupportChatManagerAsync
|
|
20
|
+
from .custom_events.custom_events import CustomEventsManagerAsync
|
|
21
|
+
from .project_dashboard.project_dashboard import ProjectDashboardManagerAsync
|
|
18
22
|
|
|
19
|
-
__version__ = "1.2
|
|
23
|
+
__version__ = "1.3.2"
|
|
20
24
|
__author__ = "Lu qi"
|
|
21
25
|
__email__ = "qi.lu@pixelarrayai.com"
|
|
22
26
|
|
|
@@ -29,5 +33,9 @@ __all__ = [
|
|
|
29
33
|
"feedback",
|
|
30
34
|
"project",
|
|
31
35
|
"support_chat",
|
|
36
|
+
"custom_events",
|
|
37
|
+
"project_dashboard",
|
|
32
38
|
"SupportChatManagerAsync",
|
|
39
|
+
"CustomEventsManagerAsync",
|
|
40
|
+
"ProjectDashboardManagerAsync",
|
|
33
41
|
]
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
from pixelarraythirdparty.client import AsyncClient
|
|
2
|
+
from typing import Any, Dict, List, Optional, Tuple
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class CustomEventsManagerAsync(AsyncClient):
|
|
6
|
+
"""自定义事件:新建定义与上报(上报前须存在对应事件定义与字段 schema)。"""
|
|
7
|
+
|
|
8
|
+
async def create_custom_event_definition(
|
|
9
|
+
self,
|
|
10
|
+
project_name: str,
|
|
11
|
+
event_key: str,
|
|
12
|
+
display_name: str,
|
|
13
|
+
*,
|
|
14
|
+
description: Optional[str] = None,
|
|
15
|
+
category: str = "custom",
|
|
16
|
+
field_schema: Optional[List[Dict[str, Any]]] = None,
|
|
17
|
+
is_active: bool = True,
|
|
18
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
19
|
+
"""
|
|
20
|
+
description:
|
|
21
|
+
新建自定义事件定义(需 API Key;与 Portal「新建定义」一致,对应 POST /api/custom-events/definitions/create)
|
|
22
|
+
parameters:
|
|
23
|
+
project_name(str): 项目名称(与 projects.name 一致)
|
|
24
|
+
event_key(str): 事件键(1~64 字符)
|
|
25
|
+
display_name(str): 展示名
|
|
26
|
+
description(str, optional): 说明
|
|
27
|
+
category(str): 分类白名单,默认 custom
|
|
28
|
+
field_schema(list, optional): 字段定义列表,每项含 name、type(string|number|boolean)、required、description
|
|
29
|
+
is_active(bool): 是否启用,默认 True
|
|
30
|
+
return:
|
|
31
|
+
data(dict): 成功时为定义记录;失败时含 message 等
|
|
32
|
+
success(bool): 是否成功
|
|
33
|
+
"""
|
|
34
|
+
body: Dict[str, Any] = {
|
|
35
|
+
"project_name": project_name,
|
|
36
|
+
"event_key": event_key,
|
|
37
|
+
"display_name": display_name,
|
|
38
|
+
"category": category,
|
|
39
|
+
"field_schema": field_schema or [],
|
|
40
|
+
"is_active": is_active,
|
|
41
|
+
}
|
|
42
|
+
if description is not None:
|
|
43
|
+
body["description"] = description
|
|
44
|
+
return await self._request(
|
|
45
|
+
"POST", "/api/custom-events/definitions/create", json=body
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
async def report_custom_event(
|
|
49
|
+
self,
|
|
50
|
+
project_name: str,
|
|
51
|
+
event_key: str,
|
|
52
|
+
payload: Dict[str, Any],
|
|
53
|
+
client_occurred_at: Optional[str] = None,
|
|
54
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
55
|
+
"""
|
|
56
|
+
description:
|
|
57
|
+
上报单条自定义事件日志(JSON 载荷须符合 Portal 中配置的 field_schema)
|
|
58
|
+
parameters:
|
|
59
|
+
project_name(str): 项目名称(与 projects.name 一致)
|
|
60
|
+
event_key(str): 事件键
|
|
61
|
+
payload(dict): JSON 对象,键与类型须与定义一致
|
|
62
|
+
client_occurred_at(str, optional): 客户端事件发生时间,ISO8601 字符串
|
|
63
|
+
return:
|
|
64
|
+
data(dict): 成功时为日志记录;失败时含 message 等
|
|
65
|
+
success(bool): 是否成功
|
|
66
|
+
"""
|
|
67
|
+
data: Dict[str, Any] = {
|
|
68
|
+
"project_name": project_name,
|
|
69
|
+
"event_key": event_key,
|
|
70
|
+
"payload": payload,
|
|
71
|
+
}
|
|
72
|
+
if client_occurred_at is not None:
|
|
73
|
+
data["client_occurred_at"] = client_occurred_at
|
|
74
|
+
return await self._request("POST", "/api/custom-events/report", json=data)
|
|
75
|
+
|
|
76
|
+
async def report_custom_events_batch(
|
|
77
|
+
self,
|
|
78
|
+
project_name: str,
|
|
79
|
+
items: List[Dict[str, Any]],
|
|
80
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
81
|
+
"""
|
|
82
|
+
description:
|
|
83
|
+
批量上报自定义事件(同一 project_name;任一条校验失败则整批失败)
|
|
84
|
+
parameters:
|
|
85
|
+
project_name(str): 项目名称(与 projects.name 一致)
|
|
86
|
+
items(list): 每项为 dict,须含 event_key、payload;可选 client_occurred_at(字符串)
|
|
87
|
+
return:
|
|
88
|
+
data(dict): 成功时为日志列表;失败时含 message
|
|
89
|
+
success(bool): 是否成功
|
|
90
|
+
"""
|
|
91
|
+
body = {"project_name": project_name, "items": items}
|
|
92
|
+
return await self._request("POST", "/api/custom-events/report/batch", json=body)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from typing import Any, Dict, Optional, Tuple
|
|
3
|
+
|
|
4
|
+
from pixelarraythirdparty.client import AsyncClient
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _resolve_dashboard_path(scope: str) -> Optional[str]:
|
|
8
|
+
s = (scope or "").strip()
|
|
9
|
+
if s.upper() == "DNU":
|
|
10
|
+
return "/api/project-dashboard/dashboard/dnu"
|
|
11
|
+
if s.upper() == "DAU":
|
|
12
|
+
return "/api/project-dashboard/dashboard/dau"
|
|
13
|
+
if s.upper() == "RETENTION" or s == "留存":
|
|
14
|
+
return "/api/project-dashboard/dashboard/retention"
|
|
15
|
+
return None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ProjectDashboardManagerAsync(AsyncClient):
|
|
19
|
+
"""项目看板:按 scope 查询 DNU / DAU / 留存(与 Portal 同源接口,需 API Key)。"""
|
|
20
|
+
|
|
21
|
+
async def query_dashboard(
|
|
22
|
+
self,
|
|
23
|
+
project_name: str,
|
|
24
|
+
scope: str,
|
|
25
|
+
start_date: Optional[str] = None,
|
|
26
|
+
end_date: Optional[str] = None,
|
|
27
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
28
|
+
"""
|
|
29
|
+
description:
|
|
30
|
+
查询项目看板指标;scope 为 DNU、DAU、RETENTION 或中文「留存」。
|
|
31
|
+
parameters:
|
|
32
|
+
project_name(str): 项目名称(与统一登录 project_name 一致)
|
|
33
|
+
scope(str): DNU | DAU | RETENTION | 留存
|
|
34
|
+
start_date(str, optional): 开始日期 YYYY-MM-DD;不传则服务端默认 T-7
|
|
35
|
+
end_date(str, optional): 结束日期 YYYY-MM-DD;不传则服务端默认 T-0
|
|
36
|
+
return:
|
|
37
|
+
data(dict): 成功时为 DauData / DnuData / RetentionData 结构(见接口文档)
|
|
38
|
+
success(bool): 是否成功
|
|
39
|
+
"""
|
|
40
|
+
path = _resolve_dashboard_path(scope)
|
|
41
|
+
if not path:
|
|
42
|
+
return (
|
|
43
|
+
{"message": "scope 无效,应为 DNU、DAU、RETENTION 或 留存"},
|
|
44
|
+
False,
|
|
45
|
+
)
|
|
46
|
+
params: Dict[str, Any] = {"project_name": project_name}
|
|
47
|
+
if start_date:
|
|
48
|
+
params["start_date"] = start_date
|
|
49
|
+
if end_date:
|
|
50
|
+
params["end_date"] = end_date
|
|
51
|
+
return await self._request("GET", path, params=params)
|
{pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty.egg-info/SOURCES.txt
RENAMED
|
@@ -10,6 +10,8 @@ pixelarraythirdparty.egg-info/requires.txt
|
|
|
10
10
|
pixelarraythirdparty.egg-info/top_level.txt
|
|
11
11
|
pixelarraythirdparty/cron/__init__.py
|
|
12
12
|
pixelarraythirdparty/cron/cron.py
|
|
13
|
+
pixelarraythirdparty/custom_events/__init__.py
|
|
14
|
+
pixelarraythirdparty/custom_events/custom_events.py
|
|
13
15
|
pixelarraythirdparty/feedback/__init__.py
|
|
14
16
|
pixelarraythirdparty/feedback/feedback.py
|
|
15
17
|
pixelarraythirdparty/order/__init__.py
|
|
@@ -18,6 +20,8 @@ pixelarraythirdparty/product/__init__.py
|
|
|
18
20
|
pixelarraythirdparty/product/product.py
|
|
19
21
|
pixelarraythirdparty/project/__init__.py
|
|
20
22
|
pixelarraythirdparty/project/project.py
|
|
23
|
+
pixelarraythirdparty/project_dashboard/__init__.py
|
|
24
|
+
pixelarraythirdparty/project_dashboard/project_dashboard.py
|
|
21
25
|
pixelarraythirdparty/support_chat/__init__.py
|
|
22
26
|
pixelarraythirdparty/support_chat/support_chat.py
|
|
23
27
|
pixelarraythirdparty/unified_login/__init__.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/cron/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/feedback/__init__.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/feedback/feedback.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/order/__init__.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/order/order.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/product/__init__.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/product/product.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/project/__init__.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/project/project.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty/user/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pixelarraythirdparty-1.2.9 → pixelarraythirdparty-1.3.2}/pixelarraythirdparty.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|