proxy-platform 0.3.0__py3-none-any.whl

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.

Potentially problematic release.


This version of proxy-platform might be problematic. Click here for more details.

@@ -0,0 +1,603 @@
1
+ """Feedback portal commands for users."""
2
+
3
+ import typer
4
+ from rich.console import Console
5
+ from rich.table import Table
6
+
7
+ from ..client import APIClient
8
+ from ..config import get_default_api_type
9
+
10
+ app = typer.Typer()
11
+ console = Console()
12
+
13
+ # Valid feedback categories and statuses (mirrors pbd-shared enums)
14
+ FEEDBACK_CATEGORIES = ["bug_report", "feature_request", "improvement", "other"]
15
+ FEEDBACK_STATUSES = ["open", "solved"]
16
+
17
+
18
+ @app.command(name="submit")
19
+ def submit_feedback(
20
+ title: str = typer.Option(..., "--title", "-t", help="Feedback title"),
21
+ description: str = typer.Option(..., "--description", "-d", help="Feedback description"),
22
+ category: str = typer.Option(..., "--category", "-c", help=f"Category: {', '.join(FEEDBACK_CATEGORIES)}"),
23
+ api: str | None = typer.Option(None, "--api", "-a", help="API type (admin or user)"),
24
+ ) -> None:
25
+ """Submit new feedback.
26
+
27
+ Submits a feedback item to the portal. The category must be one of:
28
+ bug_report, feature_request, improvement, other.
29
+
30
+ Examples:
31
+ pbd feedback submit --title "Login broken" --description "Cannot login" --category bug_report
32
+ pbd feedback submit --title "Dark mode" --description "Please add dark mode" --category feature_request
33
+ """
34
+ if api is None:
35
+ api = get_default_api_type()
36
+
37
+ if category not in FEEDBACK_CATEGORIES:
38
+ console.print(f"[red]Error: Invalid category '{category}'[/red]")
39
+ console.print(f"[yellow]Valid categories: {', '.join(FEEDBACK_CATEGORIES)}[/yellow]")
40
+ raise typer.Exit(1)
41
+
42
+ try:
43
+ client = APIClient(api_type=api)
44
+ data = {
45
+ "title": title,
46
+ "description": description,
47
+ "category": category,
48
+ }
49
+
50
+ response = client.post("/api/v1/feedback", data=data)
51
+
52
+ if response.status_code == 201:
53
+ result = response.json()
54
+ console.print()
55
+ console.print("[green]Feedback submitted successfully![/green]")
56
+ console.print()
57
+ console.print("[bold]Feedback Details[/bold]")
58
+ console.print("-" * 70)
59
+ console.print(f"ID: [cyan]{result.get('id')}[/cyan]")
60
+ console.print(f"Title: {result.get('title')}")
61
+ console.print(f"Category: [blue]{result.get('category')}[/blue]")
62
+ console.print(f"Status: [yellow]{result.get('status')}[/yellow]")
63
+ console.print(f"Votes: {result.get('vote_count', 0)}")
64
+ console.print()
65
+ else:
66
+ console.print(f"[red]Error: {response.status_code}[/red]")
67
+ try:
68
+ console.print(response.json().get("detail", "Unknown error"))
69
+ except Exception:
70
+ console.print(response.text)
71
+ raise typer.Exit(1)
72
+
73
+ except typer.Exit:
74
+ raise
75
+ except Exception as e:
76
+ console.print(f"[red]Error: {str(e)}[/red]")
77
+ raise typer.Exit(1) from None
78
+
79
+
80
+ @app.command(name="list")
81
+ def list_feedback(
82
+ limit: int = typer.Option(20, "--limit", "-l", help="Number of items per page"),
83
+ page: int = typer.Option(1, "--page", "-p", help="Page number (1-based)"),
84
+ category: str | None = typer.Option(
85
+ None, "--category", "-c", help=f"Filter by category: {', '.join(FEEDBACK_CATEGORIES)}"
86
+ ),
87
+ status: str | None = typer.Option(None, "--status", "-s", help=f"Filter by status: {', '.join(FEEDBACK_STATUSES)}"),
88
+ api: str | None = typer.Option(None, "--api", "-a", help="API type (admin or user)"),
89
+ ) -> None:
90
+ """List feedback items.
91
+
92
+ By default, solved items are excluded. Pass --status solved to see them,
93
+ or --status open to see only open items.
94
+
95
+ Examples:
96
+ pbd feedback list
97
+ pbd feedback list --category bug_report
98
+ pbd feedback list --status solved
99
+ pbd feedback list --limit 50 --page 2
100
+ """
101
+ if api is None:
102
+ api = get_default_api_type()
103
+
104
+ if category and category not in FEEDBACK_CATEGORIES:
105
+ console.print(f"[red]Error: Invalid category '{category}'[/red]")
106
+ console.print(f"[yellow]Valid categories: {', '.join(FEEDBACK_CATEGORIES)}[/yellow]")
107
+ raise typer.Exit(1)
108
+
109
+ if status and status not in FEEDBACK_STATUSES:
110
+ console.print(f"[red]Error: Invalid status '{status}'[/red]")
111
+ console.print(f"[yellow]Valid statuses: {', '.join(FEEDBACK_STATUSES)}[/yellow]")
112
+ raise typer.Exit(1)
113
+
114
+ try:
115
+ client = APIClient(api_type=api)
116
+ params: dict[str, str | int] = {"per_page": limit, "page": page}
117
+ if category:
118
+ params["category"] = category
119
+ if status:
120
+ params["status"] = status
121
+
122
+ response = client.get("/api/v1/feedback", params=params)
123
+
124
+ if response.status_code == 200:
125
+ data = response.json()
126
+ items = data.get("data", [])
127
+
128
+ if not items:
129
+ console.print("[yellow]No feedback items found[/yellow]")
130
+ return
131
+
132
+ total = data.get("total", len(items))
133
+ table = Table(title=f"Feedback ({len(items)} of {total})")
134
+ table.add_column("ID", style="cyan", no_wrap=True)
135
+ table.add_column("Title", style="white")
136
+ table.add_column("Category", style="blue")
137
+ table.add_column("Status", style="yellow")
138
+ table.add_column("Votes", style="green")
139
+ table.add_column("Voted", style="magenta")
140
+ table.add_column("Date", style="dim")
141
+
142
+ for item in items:
143
+ item_id = str(item.get("id", "N/A"))[:8] + "..."
144
+ voted = "[green]Yes[/green]" if item.get("user_has_voted") else ""
145
+ created = item.get("created_at", "N/A")[:10] if item.get("created_at") else "N/A"
146
+
147
+ table.add_row(
148
+ item_id,
149
+ item.get("title", "N/A"),
150
+ item.get("category", "N/A"),
151
+ item.get("status", "N/A"),
152
+ str(item.get("vote_count", 0)),
153
+ voted,
154
+ created,
155
+ )
156
+
157
+ console.print()
158
+ console.print(table)
159
+
160
+ if data.get("has_next"):
161
+ console.print(f"\n[dim]Page {data.get('page')} of {-(-total // limit)}. Use --page to navigate.[/dim]")
162
+
163
+ console.print()
164
+ else:
165
+ console.print(f"[red]Error: {response.status_code}[/red]")
166
+ try:
167
+ console.print(response.json().get("detail", "Unknown error"))
168
+ except Exception:
169
+ console.print(response.text)
170
+ raise typer.Exit(1)
171
+
172
+ except typer.Exit:
173
+ raise
174
+ except Exception as e:
175
+ console.print(f"[red]Error: {str(e)}[/red]")
176
+ raise typer.Exit(1) from None
177
+
178
+
179
+ @app.command(name="get")
180
+ def get_feedback(
181
+ feedback_id: str = typer.Argument(..., help="Feedback ID (UUID)"),
182
+ api: str | None = typer.Option(None, "--api", "-a", help="API type (admin or user)"),
183
+ ) -> None:
184
+ """Get a single feedback item by ID, including comments and vote status.
185
+
186
+ Examples:
187
+ pbd feedback get 550e8400-e29b-41d4-a716-446655440000
188
+ """
189
+ if api is None:
190
+ api = get_default_api_type()
191
+
192
+ try:
193
+ client = APIClient(api_type=api)
194
+ response = client.get(f"/api/v1/feedback/{feedback_id}")
195
+
196
+ if response.status_code == 200:
197
+ item = response.json()
198
+ console.print()
199
+ console.print("[bold]Feedback Details[/bold]")
200
+ console.print("-" * 70)
201
+ console.print(f"ID: [cyan]{item.get('id')}[/cyan]")
202
+ console.print(f"Title: {item.get('title')}")
203
+ console.print(f"Description: {item.get('description')}")
204
+ console.print(f"Category: [blue]{item.get('category')}[/blue]")
205
+ console.print(f"Status: [yellow]{item.get('status')}[/yellow]")
206
+ console.print(f"Votes: [green]{item.get('vote_count', 0)}[/green]")
207
+ console.print(f"Voted by you: {'Yes' if item.get('user_has_voted') else 'No'}")
208
+ console.print(f"Submitted by: {item.get('user_name')} ({item.get('user_email')})")
209
+
210
+ if item.get("jira_ticket"):
211
+ console.print(f"Jira Ticket: [cyan]{item.get('jira_ticket')}[/cyan]")
212
+ if item.get("solved_in_release"):
213
+ console.print(f"Solved in: {item.get('solved_in_release')}")
214
+ if item.get("created_at"):
215
+ console.print(f"Created: {item.get('created_at')}")
216
+
217
+ # Show comments if present
218
+ comments = item.get("comments", [])
219
+ if comments:
220
+ console.print()
221
+ console.print(f"[bold]Comments ({len(comments)})[/bold]")
222
+ console.print("-" * 70)
223
+ for comment in comments:
224
+ console.print(f"[cyan]{comment.get('user_name')}[/cyan] ({comment.get('created_at', 'N/A')[:10]}):")
225
+ console.print(f" {comment.get('content')}")
226
+ console.print()
227
+ console.print()
228
+ elif response.status_code == 404:
229
+ console.print(f"[red]Feedback not found: {feedback_id}[/red]")
230
+ raise typer.Exit(1)
231
+ else:
232
+ console.print(f"[red]Error: {response.status_code}[/red]")
233
+ try:
234
+ console.print(response.json().get("detail", "Unknown error"))
235
+ except Exception:
236
+ console.print(response.text)
237
+ raise typer.Exit(1)
238
+
239
+ except typer.Exit:
240
+ raise
241
+ except Exception as e:
242
+ console.print(f"[red]Error: {str(e)}[/red]")
243
+ raise typer.Exit(1) from None
244
+
245
+
246
+ @app.command(name="update")
247
+ def update_feedback(
248
+ feedback_id: str = typer.Argument(..., help="Feedback ID (UUID)"),
249
+ title: str | None = typer.Option(None, "--title", "-t", help="New title"),
250
+ description: str | None = typer.Option(None, "--description", "-d", help="New description"),
251
+ category: str | None = typer.Option(
252
+ None, "--category", "-c", help=f"New category: {', '.join(FEEDBACK_CATEGORIES)}"
253
+ ),
254
+ api: str | None = typer.Option(None, "--api", "-a", help="API type (admin or user)"),
255
+ ) -> None:
256
+ """Update your own feedback item (title, description, category).
257
+
258
+ Only the owner of the feedback can update it.
259
+ Status cannot be changed here — that is admin-only.
260
+
261
+ Examples:
262
+ pbd feedback update <id> --title "Updated title"
263
+ pbd feedback update <id> --category feature_request
264
+ """
265
+ if api is None:
266
+ api = get_default_api_type()
267
+
268
+ if category and category not in FEEDBACK_CATEGORIES:
269
+ console.print(f"[red]Error: Invalid category '{category}'[/red]")
270
+ console.print(f"[yellow]Valid categories: {', '.join(FEEDBACK_CATEGORIES)}[/yellow]")
271
+ raise typer.Exit(1)
272
+
273
+ if not any([title, description, category]):
274
+ console.print("[red]Error: At least one field must be provided (--title, --description, --category)[/red]")
275
+ raise typer.Exit(1)
276
+
277
+ try:
278
+ client = APIClient(api_type=api)
279
+
280
+ # The user API PUT endpoint uses FeedbackCreate which requires all fields,
281
+ # so we fetch current values first and merge
282
+ get_response = client.get(f"/api/v1/feedback/{feedback_id}")
283
+ if get_response.status_code != 200:
284
+ console.print(f"[red]Error: Could not fetch feedback {feedback_id}[/red]")
285
+ raise typer.Exit(1)
286
+
287
+ current = get_response.json()
288
+ data = {
289
+ "title": title if title is not None else current.get("title", ""),
290
+ "description": description if description is not None else current.get("description", ""),
291
+ "category": category if category is not None else current.get("category", ""),
292
+ }
293
+
294
+ response = client.put(f"/api/v1/feedback/{feedback_id}", data=data)
295
+
296
+ if response.status_code == 200:
297
+ result = response.json()
298
+ console.print(f"[green]Feedback [cyan]{feedback_id}[/cyan] updated successfully[/green]")
299
+ console.print(f" Title: {result.get('title')}")
300
+ console.print(f" Category: {result.get('category')}")
301
+ console.print()
302
+ elif response.status_code == 403:
303
+ console.print("[red]Error: You are not allowed to edit this feedback[/red]")
304
+ raise typer.Exit(1)
305
+ elif response.status_code == 404:
306
+ console.print(f"[red]Feedback not found: {feedback_id}[/red]")
307
+ raise typer.Exit(1)
308
+ else:
309
+ console.print(f"[red]Error: {response.status_code}[/red]")
310
+ try:
311
+ console.print(response.json().get("detail", "Unknown error"))
312
+ except Exception:
313
+ console.print(response.text)
314
+ raise typer.Exit(1)
315
+
316
+ except typer.Exit:
317
+ raise
318
+ except Exception as e:
319
+ console.print(f"[red]Error: {str(e)}[/red]")
320
+ raise typer.Exit(1) from None
321
+
322
+
323
+ @app.command(name="delete")
324
+ def delete_feedback(
325
+ feedback_id: str = typer.Argument(..., help="Feedback ID (UUID)"),
326
+ yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation prompt"),
327
+ api: str | None = typer.Option(None, "--api", "-a", help="API type (admin or user)"),
328
+ ) -> None:
329
+ """Delete your own feedback item.
330
+
331
+ Only the owner of the feedback can delete it.
332
+ This action cannot be undone.
333
+
334
+ Examples:
335
+ pbd feedback delete <id>
336
+ pbd feedback delete <id> --yes
337
+ """
338
+ if api is None:
339
+ api = get_default_api_type()
340
+
341
+ try:
342
+ client = APIClient(api_type=api)
343
+
344
+ if not yes:
345
+ confirm = typer.confirm(f"Are you sure you want to delete feedback {feedback_id}?")
346
+ if not confirm:
347
+ console.print("[yellow]Deletion cancelled[/yellow]")
348
+ raise typer.Exit(0)
349
+
350
+ response = client.delete(f"/api/v1/feedback/{feedback_id}")
351
+
352
+ if response.status_code == 204:
353
+ console.print(f"[green]Feedback [cyan]{feedback_id}[/cyan] deleted successfully[/green]")
354
+ elif response.status_code == 403:
355
+ console.print("[red]Error: You are not allowed to delete this feedback[/red]")
356
+ raise typer.Exit(1)
357
+ elif response.status_code == 404:
358
+ console.print(f"[red]Feedback not found: {feedback_id}[/red]")
359
+ raise typer.Exit(1)
360
+ else:
361
+ console.print(f"[red]Error: {response.status_code}[/red]")
362
+ try:
363
+ console.print(response.json().get("detail", "Unknown error"))
364
+ except Exception:
365
+ console.print(response.text)
366
+ raise typer.Exit(1)
367
+
368
+ except typer.Exit:
369
+ raise
370
+ except Exception as e:
371
+ console.print(f"[red]Error: {str(e)}[/red]")
372
+ raise typer.Exit(1) from None
373
+
374
+
375
+ @app.command(name="vote")
376
+ def vote_feedback(
377
+ feedback_id: str = typer.Argument(..., help="Feedback ID (UUID)"),
378
+ api: str | None = typer.Option(None, "--api", "-a", help="API type (admin or user)"),
379
+ ) -> None:
380
+ """Upvote a feedback item.
381
+
382
+ Each user can vote once per feedback item.
383
+ Returns an error if you have already voted.
384
+
385
+ Examples:
386
+ pbd feedback vote 550e8400-e29b-41d4-a716-446655440000
387
+ """
388
+ if api is None:
389
+ api = get_default_api_type()
390
+
391
+ try:
392
+ client = APIClient(api_type=api)
393
+ response = client.post(f"/api/v1/feedback/{feedback_id}/vote")
394
+
395
+ if response.status_code == 204:
396
+ console.print(f"[green]Vote added to feedback [cyan]{feedback_id}[/cyan][/green]")
397
+ elif response.status_code == 409:
398
+ console.print("[yellow]You have already voted on this feedback[/yellow]")
399
+ raise typer.Exit(1)
400
+ elif response.status_code == 404:
401
+ console.print(f"[red]Feedback not found: {feedback_id}[/red]")
402
+ raise typer.Exit(1)
403
+ else:
404
+ console.print(f"[red]Error: {response.status_code}[/red]")
405
+ try:
406
+ console.print(response.json().get("detail", "Unknown error"))
407
+ except Exception:
408
+ console.print(response.text)
409
+ raise typer.Exit(1)
410
+
411
+ except typer.Exit:
412
+ raise
413
+ except Exception as e:
414
+ console.print(f"[red]Error: {str(e)}[/red]")
415
+ raise typer.Exit(1) from None
416
+
417
+
418
+ @app.command(name="unvote")
419
+ def unvote_feedback(
420
+ feedback_id: str = typer.Argument(..., help="Feedback ID (UUID)"),
421
+ api: str | None = typer.Option(None, "--api", "-a", help="API type (admin or user)"),
422
+ ) -> None:
423
+ """Retract your vote on a feedback item.
424
+
425
+ Returns an error if you have not voted on this item.
426
+
427
+ Examples:
428
+ pbd feedback unvote 550e8400-e29b-41d4-a716-446655440000
429
+ """
430
+ if api is None:
431
+ api = get_default_api_type()
432
+
433
+ try:
434
+ client = APIClient(api_type=api)
435
+ response = client.delete(f"/api/v1/feedback/{feedback_id}/vote")
436
+
437
+ if response.status_code == 204:
438
+ console.print(f"[green]Vote removed from feedback [cyan]{feedback_id}[/cyan][/green]")
439
+ elif response.status_code == 404:
440
+ # Could be feedback not found or vote not found
441
+ try:
442
+ detail = response.json().get("detail", "Not found")
443
+ except Exception:
444
+ detail = "Not found"
445
+ console.print(f"[red]{detail}[/red]")
446
+ raise typer.Exit(1)
447
+ else:
448
+ console.print(f"[red]Error: {response.status_code}[/red]")
449
+ try:
450
+ console.print(response.json().get("detail", "Unknown error"))
451
+ except Exception:
452
+ console.print(response.text)
453
+ raise typer.Exit(1)
454
+
455
+ except typer.Exit:
456
+ raise
457
+ except Exception as e:
458
+ console.print(f"[red]Error: {str(e)}[/red]")
459
+ raise typer.Exit(1) from None
460
+
461
+
462
+ @app.command(name="comment")
463
+ def add_comment(
464
+ feedback_id: str = typer.Argument(..., help="Feedback ID (UUID)"),
465
+ content: str = typer.Option(..., "--content", "-c", help="Comment content"),
466
+ api: str | None = typer.Option(None, "--api", "-a", help="API type (admin or user)"),
467
+ ) -> None:
468
+ """Add a comment to a feedback item.
469
+
470
+ Examples:
471
+ pbd feedback comment <id> --content "This is a great idea!"
472
+ """
473
+ if api is None:
474
+ api = get_default_api_type()
475
+
476
+ try:
477
+ client = APIClient(api_type=api)
478
+ data = {"content": content}
479
+ response = client.post(f"/api/v1/feedback/{feedback_id}/comments", data=data)
480
+
481
+ if response.status_code == 201:
482
+ result = response.json()
483
+ console.print(f"[green]Comment added to feedback [cyan]{feedback_id}[/cyan][/green]")
484
+ console.print(f" Comment ID: [cyan]{result.get('id')}[/cyan]")
485
+ console.print(f" Content: {result.get('content')}")
486
+ console.print()
487
+ elif response.status_code == 404:
488
+ console.print(f"[red]Feedback not found: {feedback_id}[/red]")
489
+ raise typer.Exit(1)
490
+ else:
491
+ console.print(f"[red]Error: {response.status_code}[/red]")
492
+ try:
493
+ console.print(response.json().get("detail", "Unknown error"))
494
+ except Exception:
495
+ console.print(response.text)
496
+ raise typer.Exit(1)
497
+
498
+ except typer.Exit:
499
+ raise
500
+ except Exception as e:
501
+ console.print(f"[red]Error: {str(e)}[/red]")
502
+ raise typer.Exit(1) from None
503
+
504
+
505
+ @app.command(name="update-comment")
506
+ def update_comment(
507
+ feedback_id: str = typer.Argument(..., help="Feedback ID (UUID)"),
508
+ comment_id: str = typer.Argument(..., help="Comment ID (UUID)"),
509
+ content: str = typer.Option(..., "--content", "-c", help="New comment content"),
510
+ api: str | None = typer.Option(None, "--api", "-a", help="API type (admin or user)"),
511
+ ) -> None:
512
+ """Edit your own comment on a feedback item.
513
+
514
+ Only the comment owner can edit their comment.
515
+
516
+ Examples:
517
+ pbd feedback update-comment <feedback-id> <comment-id> --content "Updated comment"
518
+ """
519
+ if api is None:
520
+ api = get_default_api_type()
521
+
522
+ try:
523
+ client = APIClient(api_type=api)
524
+ data = {"content": content}
525
+ response = client.put(f"/api/v1/feedback/{feedback_id}/comments/{comment_id}", data=data)
526
+
527
+ if response.status_code == 200:
528
+ result = response.json()
529
+ console.print(f"[green]Comment [cyan]{comment_id}[/cyan] updated successfully[/green]")
530
+ console.print(f" Content: {result.get('content')}")
531
+ console.print()
532
+ elif response.status_code == 403:
533
+ console.print("[red]Error: You are not allowed to edit this comment[/red]")
534
+ raise typer.Exit(1)
535
+ elif response.status_code == 404:
536
+ console.print("[red]Feedback or comment not found[/red]")
537
+ raise typer.Exit(1)
538
+ else:
539
+ console.print(f"[red]Error: {response.status_code}[/red]")
540
+ try:
541
+ console.print(response.json().get("detail", "Unknown error"))
542
+ except Exception:
543
+ console.print(response.text)
544
+ raise typer.Exit(1)
545
+
546
+ except typer.Exit:
547
+ raise
548
+ except Exception as e:
549
+ console.print(f"[red]Error: {str(e)}[/red]")
550
+ raise typer.Exit(1) from None
551
+
552
+
553
+ @app.command(name="delete-comment")
554
+ def delete_comment(
555
+ feedback_id: str = typer.Argument(..., help="Feedback ID (UUID)"),
556
+ comment_id: str = typer.Argument(..., help="Comment ID (UUID)"),
557
+ yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation prompt"),
558
+ api: str | None = typer.Option(None, "--api", "-a", help="API type (admin or user)"),
559
+ ) -> None:
560
+ """Delete your own comment on a feedback item.
561
+
562
+ Only the comment owner can delete their comment.
563
+ This action cannot be undone.
564
+
565
+ Examples:
566
+ pbd feedback delete-comment <feedback-id> <comment-id>
567
+ pbd feedback delete-comment <feedback-id> <comment-id> --yes
568
+ """
569
+ if api is None:
570
+ api = get_default_api_type()
571
+
572
+ try:
573
+ client = APIClient(api_type=api)
574
+
575
+ if not yes:
576
+ confirm = typer.confirm(f"Are you sure you want to delete comment {comment_id}?")
577
+ if not confirm:
578
+ console.print("[yellow]Deletion cancelled[/yellow]")
579
+ raise typer.Exit(0)
580
+
581
+ response = client.delete(f"/api/v1/feedback/{feedback_id}/comments/{comment_id}")
582
+
583
+ if response.status_code == 204:
584
+ console.print(f"[green]Comment [cyan]{comment_id}[/cyan] deleted successfully[/green]")
585
+ elif response.status_code == 403:
586
+ console.print("[red]Error: You are not allowed to delete this comment[/red]")
587
+ raise typer.Exit(1)
588
+ elif response.status_code == 404:
589
+ console.print("[red]Feedback or comment not found[/red]")
590
+ raise typer.Exit(1)
591
+ else:
592
+ console.print(f"[red]Error: {response.status_code}[/red]")
593
+ try:
594
+ console.print(response.json().get("detail", "Unknown error"))
595
+ except Exception:
596
+ console.print(response.text)
597
+ raise typer.Exit(1)
598
+
599
+ except typer.Exit:
600
+ raise
601
+ except Exception as e:
602
+ console.print(f"[red]Error: {str(e)}[/red]")
603
+ raise typer.Exit(1) from None