pixelarraythirdparty 1.3.3__tar.gz → 1.3.5__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.3.3 → pixelarraythirdparty-1.3.5}/PKG-INFO +1 -1
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/__init__.py +2 -2
- pixelarraythirdparty-1.3.5/pixelarraythirdparty/custom_events/custom_events.py +220 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/project/project.py +19 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/project_dashboard/project_dashboard.py +20 -9
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty.egg-info/PKG-INFO +1 -1
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pyproject.toml +1 -1
- pixelarraythirdparty-1.3.3/pixelarraythirdparty/custom_events/custom_events.py +0 -92
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/LICENSE +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/MANIFEST.in +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/client.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/cron/__init__.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/cron/cron.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/custom_events/__init__.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/feedback/__init__.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/feedback/feedback.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/order/__init__.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/order/order.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/product/__init__.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/product/product.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/project/__init__.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/project_dashboard/__init__.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/support_chat/__init__.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/support_chat/support_chat.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/unified_login/__init__.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/unified_login/unified_login.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/user/__init__.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/user/user.py +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty.egg-info/SOURCES.txt +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty.egg-info/dependency_links.txt +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty.egg-info/requires.txt +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty.egg-info/top_level.txt +0 -0
- {pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/setup.cfg +0 -0
|
@@ -12,7 +12,7 @@ PixelArray 第三方微服务客户端
|
|
|
12
12
|
- feedback: 客户反馈模块
|
|
13
13
|
- project: 项目管理模块
|
|
14
14
|
- support_chat: 在线客服(临时会话链接)
|
|
15
|
-
- custom_events:
|
|
15
|
+
- custom_events: 自定义事件(新建定义、上报与报表查询)
|
|
16
16
|
- project_dashboard: 项目看板(按 scope 查询 DNU/DAU/留存)
|
|
17
17
|
"""
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ from .support_chat.support_chat import SupportChatManagerAsync
|
|
|
20
20
|
from .custom_events.custom_events import CustomEventsManagerAsync
|
|
21
21
|
from .project_dashboard.project_dashboard import ProjectDashboardManagerAsync
|
|
22
22
|
|
|
23
|
-
__version__ = "1.3.
|
|
23
|
+
__version__ = "1.3.5"
|
|
24
24
|
__author__ = "Lu qi"
|
|
25
25
|
__email__ = "qi.lu@pixelarrayai.com"
|
|
26
26
|
|
|
@@ -0,0 +1,220 @@
|
|
|
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
|
+
def _dashboard_params(
|
|
9
|
+
self,
|
|
10
|
+
project_name: str,
|
|
11
|
+
*,
|
|
12
|
+
start_date: Optional[str] = None,
|
|
13
|
+
end_date: Optional[str] = None,
|
|
14
|
+
top_events_limit: Optional[int] = None,
|
|
15
|
+
) -> Dict[str, Any]:
|
|
16
|
+
p: Dict[str, Any] = {"project_name": project_name}
|
|
17
|
+
if start_date is not None:
|
|
18
|
+
p["start_date"] = start_date
|
|
19
|
+
if end_date is not None:
|
|
20
|
+
p["end_date"] = end_date
|
|
21
|
+
if top_events_limit is not None:
|
|
22
|
+
p["top_events_limit"] = top_events_limit
|
|
23
|
+
return p
|
|
24
|
+
|
|
25
|
+
async def create_custom_event_definition(
|
|
26
|
+
self,
|
|
27
|
+
project_name: str,
|
|
28
|
+
event_key: str,
|
|
29
|
+
display_name: str,
|
|
30
|
+
*,
|
|
31
|
+
description: Optional[str] = None,
|
|
32
|
+
category: str = "custom",
|
|
33
|
+
field_schema: Optional[List[Dict[str, Any]]] = None,
|
|
34
|
+
is_active: bool = True,
|
|
35
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
36
|
+
"""
|
|
37
|
+
description:
|
|
38
|
+
新建自定义事件定义(需 API Key;与 Portal「新建定义」一致,对应 POST /api/custom-events/definitions/create)
|
|
39
|
+
parameters:
|
|
40
|
+
project_name(str): 项目名称(与 projects.name 一致)
|
|
41
|
+
event_key(str): 事件键(1~64 字符)
|
|
42
|
+
display_name(str): 展示名
|
|
43
|
+
description(str, optional): 说明
|
|
44
|
+
category(str): 分类白名单,默认 custom
|
|
45
|
+
field_schema(list, optional): 字段定义列表,每项含 name、type(string|number|boolean)、required、description
|
|
46
|
+
is_active(bool): 是否启用,默认 True
|
|
47
|
+
return:
|
|
48
|
+
data(dict): 成功时为定义记录;失败时含 message 等
|
|
49
|
+
success(bool): 是否成功
|
|
50
|
+
"""
|
|
51
|
+
body: Dict[str, Any] = {
|
|
52
|
+
"project_name": project_name,
|
|
53
|
+
"event_key": event_key,
|
|
54
|
+
"display_name": display_name,
|
|
55
|
+
"category": category,
|
|
56
|
+
"field_schema": field_schema or [],
|
|
57
|
+
"is_active": is_active,
|
|
58
|
+
}
|
|
59
|
+
if description is not None:
|
|
60
|
+
body["description"] = description
|
|
61
|
+
return await self._request(
|
|
62
|
+
"POST", "/api/custom-events/definitions/create", json=body
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
async def get_custom_event_common_field_schema(
|
|
66
|
+
self, project_name: str
|
|
67
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
68
|
+
"""
|
|
69
|
+
description:
|
|
70
|
+
查询项目自定义事件公共维度(GET /api/custom-events/common-field-schema)
|
|
71
|
+
"""
|
|
72
|
+
return await self._request(
|
|
73
|
+
"GET",
|
|
74
|
+
"/api/custom-events/common-field-schema",
|
|
75
|
+
params={"project_name": project_name},
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
async def update_custom_event_common_field_schema(
|
|
79
|
+
self,
|
|
80
|
+
project_name: str,
|
|
81
|
+
field_schema: List[Dict[str, Any]],
|
|
82
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
83
|
+
"""
|
|
84
|
+
description:
|
|
85
|
+
更新项目公共维度;传空列表表示恢复服务端内置默认(POST /api/custom-events/common-field-schema/update)
|
|
86
|
+
parameters:
|
|
87
|
+
field_schema: 每项含 name、type、required、可选 nullable、description
|
|
88
|
+
"""
|
|
89
|
+
body: Dict[str, Any] = {
|
|
90
|
+
"project_name": project_name,
|
|
91
|
+
"field_schema": field_schema or [],
|
|
92
|
+
}
|
|
93
|
+
return await self._request(
|
|
94
|
+
"POST", "/api/custom-events/common-field-schema/update", json=body
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
async def report_custom_event(
|
|
98
|
+
self,
|
|
99
|
+
project_name: str,
|
|
100
|
+
event_key: str,
|
|
101
|
+
payload: Dict[str, Any],
|
|
102
|
+
client_occurred_at: Optional[str] = None,
|
|
103
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
104
|
+
"""
|
|
105
|
+
description:
|
|
106
|
+
上报单条自定义事件日志(有效载荷 = 项目公共维度 ∪ 该事件 field_schema;未传的公共键由服务端补 null)
|
|
107
|
+
parameters:
|
|
108
|
+
project_name(str): 项目名称(与 projects.name 一致)
|
|
109
|
+
event_key(str): 事件键
|
|
110
|
+
payload(dict): JSON 对象,键与类型须与定义一致
|
|
111
|
+
client_occurred_at(str, optional): 客户端事件发生时间,ISO8601 字符串
|
|
112
|
+
return:
|
|
113
|
+
data(dict): 成功时为日志记录;失败时含 message 等
|
|
114
|
+
success(bool): 是否成功
|
|
115
|
+
"""
|
|
116
|
+
data: Dict[str, Any] = {
|
|
117
|
+
"project_name": project_name,
|
|
118
|
+
"event_key": event_key,
|
|
119
|
+
"payload": payload,
|
|
120
|
+
}
|
|
121
|
+
if client_occurred_at is not None:
|
|
122
|
+
data["client_occurred_at"] = client_occurred_at
|
|
123
|
+
return await self._request("POST", "/api/custom-events/report", json=data)
|
|
124
|
+
|
|
125
|
+
async def report_custom_events_batch(
|
|
126
|
+
self,
|
|
127
|
+
project_name: str,
|
|
128
|
+
items: List[Dict[str, Any]],
|
|
129
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
130
|
+
"""
|
|
131
|
+
description:
|
|
132
|
+
批量上报自定义事件(同一 project_name;任一条校验失败则整批失败)
|
|
133
|
+
parameters:
|
|
134
|
+
project_name(str): 项目名称(与 projects.name 一致)
|
|
135
|
+
items(list): 每项为 dict,须含 event_key、payload;可选 client_occurred_at(字符串)
|
|
136
|
+
return:
|
|
137
|
+
data(dict): 成功时为日志列表;失败时含 message
|
|
138
|
+
success(bool): 是否成功
|
|
139
|
+
"""
|
|
140
|
+
body = {"project_name": project_name, "items": items}
|
|
141
|
+
return await self._request("POST", "/api/custom-events/report/batch", json=body)
|
|
142
|
+
|
|
143
|
+
async def get_custom_events_dashboard_summary(
|
|
144
|
+
self,
|
|
145
|
+
project_name: str,
|
|
146
|
+
*,
|
|
147
|
+
start_date: Optional[str] = None,
|
|
148
|
+
end_date: Optional[str] = None,
|
|
149
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
150
|
+
"""GET /api/custom-events/dashboard/summary:KPI 摘要(需 API Key 或 JWT)。"""
|
|
151
|
+
params = self._dashboard_params(
|
|
152
|
+
project_name, start_date=start_date, end_date=end_date
|
|
153
|
+
)
|
|
154
|
+
return await self._request(
|
|
155
|
+
"GET", "/api/custom-events/dashboard/summary", params=params
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
async def get_custom_events_dashboard_daily(
|
|
159
|
+
self,
|
|
160
|
+
project_name: str,
|
|
161
|
+
*,
|
|
162
|
+
start_date: Optional[str] = None,
|
|
163
|
+
end_date: Optional[str] = None,
|
|
164
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
165
|
+
"""GET /api/custom-events/dashboard/daily:按日事件量(UTC)。"""
|
|
166
|
+
params = self._dashboard_params(
|
|
167
|
+
project_name, start_date=start_date, end_date=end_date
|
|
168
|
+
)
|
|
169
|
+
return await self._request(
|
|
170
|
+
"GET", "/api/custom-events/dashboard/daily", params=params
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
async def get_custom_events_dashboard_top_events(
|
|
174
|
+
self,
|
|
175
|
+
project_name: str,
|
|
176
|
+
*,
|
|
177
|
+
start_date: Optional[str] = None,
|
|
178
|
+
end_date: Optional[str] = None,
|
|
179
|
+
top_events_limit: Optional[int] = None,
|
|
180
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
181
|
+
"""GET /api/custom-events/dashboard/top-events:事件量 TOP N。"""
|
|
182
|
+
params = self._dashboard_params(
|
|
183
|
+
project_name,
|
|
184
|
+
start_date=start_date,
|
|
185
|
+
end_date=end_date,
|
|
186
|
+
top_events_limit=top_events_limit,
|
|
187
|
+
)
|
|
188
|
+
return await self._request(
|
|
189
|
+
"GET", "/api/custom-events/dashboard/top-events", params=params
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
async def get_custom_events_dashboard_by_category(
|
|
193
|
+
self,
|
|
194
|
+
project_name: str,
|
|
195
|
+
*,
|
|
196
|
+
start_date: Optional[str] = None,
|
|
197
|
+
end_date: Optional[str] = None,
|
|
198
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
199
|
+
"""GET /api/custom-events/dashboard/by-category:按分类分布。"""
|
|
200
|
+
params = self._dashboard_params(
|
|
201
|
+
project_name, start_date=start_date, end_date=end_date
|
|
202
|
+
)
|
|
203
|
+
return await self._request(
|
|
204
|
+
"GET", "/api/custom-events/dashboard/by-category", params=params
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
async def get_custom_events_dashboard_by_hour(
|
|
208
|
+
self,
|
|
209
|
+
project_name: str,
|
|
210
|
+
*,
|
|
211
|
+
start_date: Optional[str] = None,
|
|
212
|
+
end_date: Optional[str] = None,
|
|
213
|
+
) -> Tuple[Dict[str, Any], bool]:
|
|
214
|
+
"""GET /api/custom-events/dashboard/by-hour:按 UTC 小时分布。"""
|
|
215
|
+
params = self._dashboard_params(
|
|
216
|
+
project_name, start_date=start_date, end_date=end_date
|
|
217
|
+
)
|
|
218
|
+
return await self._request(
|
|
219
|
+
"GET", "/api/custom-events/dashboard/by-hour", params=params
|
|
220
|
+
)
|
{pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/project/project.py
RENAMED
|
@@ -61,6 +61,25 @@ class ProjectManagerAsync(AsyncClient):
|
|
|
61
61
|
return data, False
|
|
62
62
|
return data, True
|
|
63
63
|
|
|
64
|
+
async def rename_project(self, project_id: int, name: str):
|
|
65
|
+
"""
|
|
66
|
+
description:
|
|
67
|
+
重命名项目;同步更新 external_users 中与旧项目名一致的 project_name。
|
|
68
|
+
parameters:
|
|
69
|
+
project_id(int): 项目ID
|
|
70
|
+
name(str): 新项目名称
|
|
71
|
+
return:
|
|
72
|
+
data(dict): 更新后的项目信息(含 id、name、bound_domains、created_at)
|
|
73
|
+
success(bool): 操作是否成功
|
|
74
|
+
"""
|
|
75
|
+
data = {"name": name}
|
|
76
|
+
data, success = await self._request(
|
|
77
|
+
"PATCH", f"/api/projects/{project_id}/name", json=data
|
|
78
|
+
)
|
|
79
|
+
if not success:
|
|
80
|
+
return data, False
|
|
81
|
+
return data, True
|
|
82
|
+
|
|
64
83
|
async def delete_project(self, project_id: int):
|
|
65
84
|
"""
|
|
66
85
|
description:
|
|
@@ -12,6 +12,8 @@ def _resolve_dashboard_path(scope: str) -> Optional[str]:
|
|
|
12
12
|
return "/api/project-dashboard/dashboard/dau"
|
|
13
13
|
if s.upper() == "RETENTION" or s == "留存":
|
|
14
14
|
return "/api/project-dashboard/dashboard/retention"
|
|
15
|
+
if s.upper() == "TOTAL_USERS" or s == "总用户":
|
|
16
|
+
return "/api/project-dashboard/dashboard/total-users"
|
|
15
17
|
return None
|
|
16
18
|
|
|
17
19
|
|
|
@@ -28,13 +30,13 @@ class ProjectDashboardManagerAsync(AsyncClient):
|
|
|
28
30
|
) -> Tuple[Dict[str, Any], bool]:
|
|
29
31
|
"""
|
|
30
32
|
description:
|
|
31
|
-
查询项目看板指标;scope 为 DNU、DAU、RETENTION
|
|
33
|
+
查询项目看板指标;scope 为 DNU、DAU、RETENTION、TOTAL_USERS 或中文「留存」「总用户」。
|
|
32
34
|
parameters:
|
|
33
35
|
project_name(str): 项目名称(与统一登录 project_name 一致)
|
|
34
36
|
scope(str): DNU | DAU | RETENTION | 留存
|
|
35
37
|
start_date(str, optional): 开始日期 YYYY-MM-DD;不传则服务端默认 T-7
|
|
36
38
|
end_date(str, optional): 结束日期 YYYY-MM-DD;不传则服务端默认 T-0
|
|
37
|
-
retention_days(str
|
|
39
|
+
retention_days(str): scope 为留存时必填;逗号分隔天数,如 1,7,14,20
|
|
38
40
|
return:
|
|
39
41
|
data(dict): 成功时为 DauData / DnuData / RetentionData 结构(见接口文档)
|
|
40
42
|
success(bool): 是否成功
|
|
@@ -42,14 +44,23 @@ class ProjectDashboardManagerAsync(AsyncClient):
|
|
|
42
44
|
path = _resolve_dashboard_path(scope)
|
|
43
45
|
if not path:
|
|
44
46
|
return (
|
|
45
|
-
{"message": "scope 无效,应为 DNU、DAU、RETENTION 或 留存"},
|
|
47
|
+
{"message": "scope 无效,应为 DNU、DAU、RETENTION、TOTAL_USERS 或 留存 / 总用户"},
|
|
48
|
+
False,
|
|
49
|
+
)
|
|
50
|
+
is_retention = "/retention" in path
|
|
51
|
+
is_total_users = "/total-users" in path
|
|
52
|
+
rd = (retention_days or "").strip()
|
|
53
|
+
if is_retention and not rd:
|
|
54
|
+
return (
|
|
55
|
+
{"message": "scope 为留存时须传入 retention_days(逗号分隔正整数,如 1,7,14)"},
|
|
46
56
|
False,
|
|
47
57
|
)
|
|
48
58
|
params: Dict[str, Any] = {"project_name": project_name}
|
|
49
|
-
if
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
if not is_total_users:
|
|
60
|
+
if start_date:
|
|
61
|
+
params["start_date"] = start_date
|
|
62
|
+
if end_date:
|
|
63
|
+
params["end_date"] = end_date
|
|
64
|
+
if rd:
|
|
65
|
+
params["retention_days"] = rd
|
|
55
66
|
return await self._request("GET", path, params=params)
|
|
@@ -1,92 +0,0 @@
|
|
|
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)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/cron/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/feedback/__init__.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/feedback/feedback.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/order/__init__.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/order/order.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/product/__init__.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/product/product.py
RENAMED
|
File without changes
|
{pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/project/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty/user/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{pixelarraythirdparty-1.3.3 → pixelarraythirdparty-1.3.5}/pixelarraythirdparty.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|