@josephyan/qingflow-cli 0.2.0-beta.81 → 0.2.0-beta.83

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.
@@ -142,6 +142,51 @@ class PackageTools(ToolBase):
142
142
 
143
143
  return self._run(profile, runner)
144
144
 
145
+ def package_group_create(self, *, profile: str, tag_id: int, group_name: str) -> JSONObject:
146
+ self._require_tag_id(tag_id)
147
+ normalized_name = str(group_name or "").strip()
148
+ if not normalized_name:
149
+ raise_tool_error(QingflowApiError.config_error("group_name is required"))
150
+
151
+ def runner(session_profile, context):
152
+ result = self.backend.request(
153
+ "POST",
154
+ context,
155
+ f"/tag/{tag_id}/group",
156
+ json_body={"groupName": normalized_name},
157
+ )
158
+ return {"profile": profile, "ws_id": session_profile.selected_ws_id, "tag_id": tag_id, "result": result}
159
+
160
+ return self._run(profile, runner)
161
+
162
+ def package_group_update(self, *, profile: str, tag_id: int, group_id: int, group_name: str) -> JSONObject:
163
+ self._require_tag_id(tag_id)
164
+ self._require_group_id(group_id)
165
+ normalized_name = str(group_name or "").strip()
166
+ if not normalized_name:
167
+ raise_tool_error(QingflowApiError.config_error("group_name is required"))
168
+
169
+ def runner(session_profile, context):
170
+ result = self.backend.request(
171
+ "POST",
172
+ context,
173
+ f"/tag/{tag_id}/group/{group_id}",
174
+ json_body={"groupName": normalized_name},
175
+ )
176
+ return {"profile": profile, "ws_id": session_profile.selected_ws_id, "tag_id": tag_id, "group_id": group_id, "result": result}
177
+
178
+ return self._run(profile, runner)
179
+
180
+ def package_group_delete(self, *, profile: str, tag_id: int, group_id: int) -> JSONObject:
181
+ self._require_tag_id(tag_id)
182
+ self._require_group_id(group_id)
183
+
184
+ def runner(session_profile, context):
185
+ result = self.backend.request("DELETE", context, f"/tag/{tag_id}/group/{group_id}")
186
+ return {"profile": profile, "ws_id": session_profile.selected_ws_id, "tag_id": tag_id, "group_id": group_id, "result": result}
187
+
188
+ return self._run(profile, runner)
189
+
145
190
  def package_delete(self, *, profile: str, tag_id: int, deleted_all_data: bool = False) -> JSONObject:
146
191
  self._require_tag_id(tag_id)
147
192
 
@@ -164,6 +209,10 @@ class PackageTools(ToolBase):
164
209
  if tag_id <= 0:
165
210
  raise_tool_error(QingflowApiError.config_error("tag_id must be positive"))
166
211
 
212
+ def _require_group_id(self, group_id: int) -> None:
213
+ if group_id <= 0:
214
+ raise_tool_error(QingflowApiError.config_error("group_id must be positive"))
215
+
167
216
  def _require_readable_tag_id(self, tag_id: int) -> None:
168
217
  if tag_id < 0:
169
218
  raise_tool_error(QingflowApiError.config_error("tag_id must be non-negative"))