proxy-platform 0.3.7__tar.gz → 0.7.1__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 (70) hide show
  1. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/PKG-INFO +1 -1
  2. proxy_platform-0.7.1/proxy_platform/commands/billing.py +381 -0
  3. proxy_platform-0.7.1/proxy_platform/commands/databases.py +513 -0
  4. proxy_platform-0.7.1/proxy_platform/commands/documents.py +118 -0
  5. proxy_platform-0.7.1/proxy_platform/commands/feature_flags.py +65 -0
  6. proxy_platform-0.7.1/proxy_platform/commands/marketplace.py +432 -0
  7. proxy_platform-0.7.1/proxy_platform/commands/nextcloud.py +120 -0
  8. proxy_platform-0.7.1/proxy_platform/commands/providers.py +261 -0
  9. proxy_platform-0.7.1/proxy_platform/commands/settings.py +167 -0
  10. proxy_platform-0.7.1/proxy_platform/commands/subscriptions.py +142 -0
  11. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/main.py +28 -1
  12. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/main_public.py +28 -1
  13. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform.egg-info/PKG-INFO +1 -1
  14. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform.egg-info/SOURCES.txt +30 -0
  15. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/pyproject.toml +1 -1
  16. proxy_platform-0.7.1/tests/test_admin_activities.py +142 -0
  17. proxy_platform-0.7.1/tests/test_admin_audit_logs.py +298 -0
  18. proxy_platform-0.7.1/tests/test_admin_cache.py +473 -0
  19. proxy_platform-0.7.1/tests/test_admin_contact_submissions.py +288 -0
  20. proxy_platform-0.7.1/tests/test_admin_databases.py +986 -0
  21. proxy_platform-0.7.1/tests/test_admin_documents.py +368 -0
  22. proxy_platform-0.7.1/tests/test_admin_feature_flags.py +380 -0
  23. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_admin_feedback.py +8 -6
  24. proxy_platform-0.7.1/tests/test_admin_metrics.py +406 -0
  25. proxy_platform-0.7.1/tests/test_admin_nextcloud.py +599 -0
  26. proxy_platform-0.7.1/tests/test_admin_spending.py +139 -0
  27. proxy_platform-0.7.1/tests/test_admin_subscriptions.py +527 -0
  28. proxy_platform-0.7.1/tests/test_admin_support.py +479 -0
  29. proxy_platform-0.7.1/tests/test_billing.py +662 -0
  30. proxy_platform-0.7.1/tests/test_databases.py +856 -0
  31. proxy_platform-0.7.1/tests/test_documents.py +305 -0
  32. proxy_platform-0.7.1/tests/test_feature_flags.py +74 -0
  33. proxy_platform-0.7.1/tests/test_marketplace.py +501 -0
  34. proxy_platform-0.7.1/tests/test_nextcloud.py +192 -0
  35. proxy_platform-0.7.1/tests/test_providers.py +494 -0
  36. proxy_platform-0.7.1/tests/test_settings.py +364 -0
  37. proxy_platform-0.7.1/tests/test_subscriptions.py +260 -0
  38. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/README.md +0 -0
  39. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/README.public.md +0 -0
  40. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/__init__.py +0 -0
  41. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/client.py +0 -0
  42. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/commands/__init__.py +0 -0
  43. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/commands/auth.py +0 -0
  44. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/commands/clusters.py +0 -0
  45. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/commands/deployments.py +0 -0
  46. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/commands/feedback.py +0 -0
  47. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/commands/firewalls.py +0 -0
  48. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/commands/orders.py +0 -0
  49. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/commands/products.py +0 -0
  50. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/commands/support.py +0 -0
  51. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/commands/users.py +0 -0
  52. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform/config.py +0 -0
  53. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform.egg-info/dependency_links.txt +0 -0
  54. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform.egg-info/entry_points.txt +0 -0
  55. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform.egg-info/requires.txt +0 -0
  56. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/proxy_platform.egg-info/top_level.txt +0 -0
  57. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/setup.cfg +0 -0
  58. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/setup.py +0 -0
  59. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_auth.py +0 -0
  60. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_client.py +0 -0
  61. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_clusters.py +0 -0
  62. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_config.py +0 -0
  63. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_deployments.py +0 -0
  64. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_dev.py +0 -0
  65. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_feedback.py +0 -0
  66. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_firewalls.py +0 -0
  67. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_main.py +0 -0
  68. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_orders.py +0 -0
  69. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_products.py +0 -0
  70. {proxy_platform-0.3.7 → proxy_platform-0.7.1}/tests/test_users.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: proxy-platform
3
- Version: 0.3.7
3
+ Version: 0.7.1
4
4
  Summary: CLI client for the Proxy Platform
5
5
  Author: Proxy Platform B.V.
6
6
  License: Proprietary - Proxy Platform B.V.
@@ -0,0 +1,381 @@
1
+ """Billing & payments commands for users."""
2
+
3
+ import json
4
+ from pathlib import Path
5
+
6
+ import typer
7
+ from rich.console import Console
8
+
9
+ from ..client import APIClient
10
+
11
+ app = typer.Typer(help="Billing & payments")
12
+ console = Console()
13
+
14
+
15
+ @app.command(name="billing-info")
16
+ def billing_info(
17
+ api: str = typer.Option("user", "--api", "-a", help="API type (admin or user)"),
18
+ ) -> None:
19
+ """Show your billing information.
20
+
21
+ Examples:
22
+ proxy-platform billing billing-info
23
+ """
24
+ try:
25
+ client = APIClient(api_type=api)
26
+ response = client.get("/api/v1/payments/my-billing-info")
27
+
28
+ if response.status_code != 200:
29
+ console.print(f"[red]Error: {response.status_code}[/red]")
30
+ try:
31
+ console.print(response.json().get("detail", "Unknown error"))
32
+ except Exception:
33
+ console.print(response.text)
34
+ raise typer.Exit(1)
35
+
36
+ info = response.json()
37
+ console.print()
38
+ console.print("[bold]Billing Information[/bold]")
39
+ console.print("-" * 70)
40
+ for key, value in info.items():
41
+ console.print(f"{key}: [cyan]{value}[/cyan]")
42
+ console.print()
43
+
44
+ except typer.Exit:
45
+ raise
46
+ except Exception as e:
47
+ console.print(f"[red]Error: {e}[/red]")
48
+ raise typer.Exit(1) from None
49
+
50
+
51
+ @app.command(name="check-credit")
52
+ def check_credit(
53
+ data: str = typer.Option(..., "--data", "-d", help="JSON payload"),
54
+ api: str = typer.Option("user", "--api", "-a", help="API type (admin or user)"),
55
+ ) -> None:
56
+ """Check available credit for a payment.
57
+
58
+ Examples:
59
+ proxy-platform billing check-credit --data '{"amount": 10.0}'
60
+ """
61
+ try:
62
+ payload = json.loads(data)
63
+ except json.JSONDecodeError as e:
64
+ console.print(f"[red]Error: Invalid JSON payload: {e}[/red]")
65
+ raise typer.Exit(1) from None
66
+
67
+ try:
68
+ client = APIClient(api_type=api)
69
+ response = client.post("/api/v1/payments/check-credit", data=payload)
70
+
71
+ if response.status_code != 200:
72
+ console.print(f"[red]Error: {response.status_code}[/red]")
73
+ try:
74
+ console.print(response.json().get("detail", "Unknown error"))
75
+ except Exception:
76
+ console.print(response.text)
77
+ raise typer.Exit(1)
78
+
79
+ result = response.json()
80
+ console.print()
81
+ console.print("[bold]Credit Check[/bold]")
82
+ console.print("-" * 70)
83
+ for key, value in result.items():
84
+ console.print(f"{key}: [cyan]{value}[/cyan]")
85
+ console.print()
86
+
87
+ except typer.Exit:
88
+ raise
89
+ except Exception as e:
90
+ console.print(f"[red]Error: {e}[/red]")
91
+ raise typer.Exit(1) from None
92
+
93
+
94
+ @app.command(name="create-payment")
95
+ def create_payment(
96
+ data: str = typer.Option(..., "--data", "-d", help="JSON payload"),
97
+ api: str = typer.Option("user", "--api", "-a", help="API type (admin or user)"),
98
+ ) -> None:
99
+ """Create a new payment.
100
+
101
+ Examples:
102
+ proxy-platform billing create-payment --data '{"order_id": "..."}'
103
+ """
104
+ try:
105
+ payload = json.loads(data)
106
+ except json.JSONDecodeError as e:
107
+ console.print(f"[red]Error: Invalid JSON payload: {e}[/red]")
108
+ raise typer.Exit(1) from None
109
+
110
+ try:
111
+ client = APIClient(api_type=api)
112
+ response = client.post("/api/v1/payments/create", data=payload)
113
+
114
+ if response.status_code not in (200, 201):
115
+ console.print(f"[red]Error: {response.status_code}[/red]")
116
+ try:
117
+ console.print(response.json().get("detail", "Unknown error"))
118
+ except Exception:
119
+ console.print(response.text)
120
+ raise typer.Exit(1)
121
+
122
+ result = response.json()
123
+ console.print()
124
+ console.print("[green]Payment created successfully![/green]")
125
+ console.print()
126
+ console.print("[bold]Payment Details[/bold]")
127
+ console.print("-" * 70)
128
+ for key, value in result.items():
129
+ console.print(f"{key}: [cyan]{value}[/cyan]")
130
+ console.print()
131
+
132
+ except typer.Exit:
133
+ raise
134
+ except Exception as e:
135
+ console.print(f"[red]Error: {e}[/red]")
136
+ raise typer.Exit(1) from None
137
+
138
+
139
+ @app.command(name="order-status")
140
+ def order_status(
141
+ order_id: str = typer.Argument(..., help="Order ID (UUID)"),
142
+ api: str = typer.Option("user", "--api", "-a", help="API type (admin or user)"),
143
+ ) -> None:
144
+ """Show the payment status of one of your orders.
145
+
146
+ Examples:
147
+ proxy-platform billing order-status <order-id>
148
+ """
149
+ try:
150
+ client = APIClient(api_type=api)
151
+ response = client.get(f"/api/v1/payments/my-orders/{order_id}/status")
152
+
153
+ if response.status_code != 200:
154
+ console.print(f"[red]Error: {response.status_code}[/red]")
155
+ try:
156
+ console.print(response.json().get("detail", "Unknown error"))
157
+ except Exception:
158
+ console.print(response.text)
159
+ raise typer.Exit(1)
160
+
161
+ result = response.json()
162
+ console.print()
163
+ console.print(f"[bold]Order Status: [cyan]{order_id}[/cyan][/bold]")
164
+ console.print("-" * 70)
165
+ for key, value in result.items():
166
+ console.print(f"{key}: [cyan]{value}[/cyan]")
167
+ console.print()
168
+
169
+ except typer.Exit:
170
+ raise
171
+ except Exception as e:
172
+ console.print(f"[red]Error: {e}[/red]")
173
+ raise typer.Exit(1) from None
174
+
175
+
176
+ @app.command(name="invoice-details")
177
+ def invoice_details(
178
+ order_id: str = typer.Argument(..., help="Order ID (UUID)"),
179
+ api: str = typer.Option("user", "--api", "-a", help="API type (admin or user)"),
180
+ ) -> None:
181
+ """Show invoice details for one of your orders.
182
+
183
+ Examples:
184
+ proxy-platform billing invoice-details <order-id>
185
+ """
186
+ try:
187
+ client = APIClient(api_type=api)
188
+ response = client.get(f"/api/v1/payments/my-orders/{order_id}/invoice-details")
189
+
190
+ if response.status_code != 200:
191
+ console.print(f"[red]Error: {response.status_code}[/red]")
192
+ try:
193
+ console.print(response.json().get("detail", "Unknown error"))
194
+ except Exception:
195
+ console.print(response.text)
196
+ raise typer.Exit(1)
197
+
198
+ result = response.json()
199
+ console.print()
200
+ console.print(f"[bold]Invoice Details: [cyan]{order_id}[/cyan][/bold]")
201
+ console.print("-" * 70)
202
+ for key, value in result.items():
203
+ console.print(f"{key}: [cyan]{value}[/cyan]")
204
+ console.print()
205
+
206
+ except typer.Exit:
207
+ raise
208
+ except Exception as e:
209
+ console.print(f"[red]Error: {e}[/red]")
210
+ raise typer.Exit(1) from None
211
+
212
+
213
+ @app.command(name="invoice-pdf")
214
+ def invoice_pdf(
215
+ order_id: str = typer.Argument(..., help="Order ID (UUID)"),
216
+ output: str | None = typer.Option(
217
+ None, "--output", "-o", help="Output file path (default: invoice-<order-id>.pdf)"
218
+ ),
219
+ api: str = typer.Option("user", "--api", "-a", help="API type (admin or user)"),
220
+ ) -> None:
221
+ """Download the invoice PDF for one of your orders.
222
+
223
+ Examples:
224
+ proxy-platform billing invoice-pdf <order-id>
225
+ proxy-platform billing invoice-pdf <order-id> --output invoice.pdf
226
+ """
227
+ try:
228
+ client = APIClient(api_type=api)
229
+ response = client.get(f"/api/v1/payments/my-orders/{order_id}/invoice-pdf")
230
+
231
+ if response.status_code != 200:
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
+ output_path = Path(output) if output else Path(f"invoice-{order_id}.pdf")
240
+ output_path.write_bytes(response.content)
241
+ console.print(f"[green]Invoice saved to [cyan]{output_path}[/cyan][/green]")
242
+
243
+ except typer.Exit:
244
+ raise
245
+ except Exception as e:
246
+ console.print(f"[red]Error: {e}[/red]")
247
+ raise typer.Exit(1) from None
248
+
249
+
250
+ def _billing_get_and_print(endpoint: str, api: str, title: str) -> None:
251
+ """GET a billing endpoint and print the JSON result."""
252
+ try:
253
+ client = APIClient(api_type=api)
254
+ response = client.get(endpoint)
255
+
256
+ if response.status_code != 200:
257
+ console.print(f"[red]Error: {response.status_code}[/red]")
258
+ try:
259
+ console.print(response.json().get("detail", "Unknown error"))
260
+ except Exception:
261
+ console.print(response.text)
262
+ raise typer.Exit(1)
263
+
264
+ console.print()
265
+ console.print(f"[bold]{title}[/bold]")
266
+ console.print("-" * 70)
267
+ console.print_json(data=response.json())
268
+ console.print()
269
+
270
+ except typer.Exit:
271
+ raise
272
+ except Exception as e:
273
+ console.print(f"[red]Error: {e}[/red]")
274
+ raise typer.Exit(1) from None
275
+
276
+
277
+ @app.command(name="invoices")
278
+ def list_invoices(
279
+ api: str = typer.Option("user", "--api", "-a", help="API type (admin or user)"),
280
+ ) -> None:
281
+ """List your invoices.
282
+
283
+ Examples:
284
+ proxy-platform billing invoices
285
+ """
286
+ _billing_get_and_print("/api/v1/billing/invoices", api, "Invoices")
287
+
288
+
289
+ @app.command(name="download-invoice")
290
+ def download_invoice(
291
+ invoice_id: str = typer.Argument(..., help="Invoice ID"),
292
+ output: str | None = typer.Option(None, "--output", "-o", help="Output file path"),
293
+ api: str = typer.Option("user", "--api", "-a", help="API type (admin or user)"),
294
+ ) -> None:
295
+ """Download an invoice PDF by invoice ID.
296
+
297
+ Examples:
298
+ proxy-platform billing download-invoice <invoice-id>
299
+ """
300
+ try:
301
+ client = APIClient(api_type=api)
302
+ response = client.get(f"/api/v1/billing/invoices/{invoice_id}/pdf")
303
+
304
+ if response.status_code != 200:
305
+ console.print(f"[red]Error: {response.status_code}[/red]")
306
+ try:
307
+ console.print(response.json().get("detail", "Unknown error"))
308
+ except Exception:
309
+ console.print(response.text)
310
+ raise typer.Exit(1)
311
+
312
+ output_path = Path(output) if output else Path(f"invoice-{invoice_id}.pdf")
313
+ output_path.write_bytes(response.content)
314
+ console.print(f"[green]Invoice saved to [cyan]{output_path}[/cyan][/green]")
315
+
316
+ except typer.Exit:
317
+ raise
318
+ except Exception as e:
319
+ console.print(f"[red]Error: {e}[/red]")
320
+ raise typer.Exit(1) from None
321
+
322
+
323
+ @app.command(name="validate-vat")
324
+ def validate_vat(
325
+ data: str = typer.Option(..., "--data", "-d", help="JSON payload"),
326
+ api: str = typer.Option("user", "--api", "-a", help="API type (admin or user)"),
327
+ ) -> None:
328
+ """Validate a VAT number.
329
+
330
+ Examples:
331
+ proxy-platform billing validate-vat --data '{"vat_number": "NL123456789B01"}'
332
+ """
333
+ try:
334
+ payload = json.loads(data)
335
+ except json.JSONDecodeError as e:
336
+ console.print(f"[red]Error: Invalid JSON payload: {e}[/red]")
337
+ raise typer.Exit(1) from None
338
+
339
+ try:
340
+ client = APIClient(api_type=api)
341
+ response = client.post("/api/v1/billing/vat/validate", data=payload)
342
+
343
+ if response.status_code != 200:
344
+ console.print(f"[red]Error: {response.status_code}[/red]")
345
+ try:
346
+ console.print(response.json().get("detail", "Unknown error"))
347
+ except Exception:
348
+ console.print(response.text)
349
+ raise typer.Exit(1)
350
+
351
+ console.print_json(data=response.json())
352
+
353
+ except typer.Exit:
354
+ raise
355
+ except Exception as e:
356
+ console.print(f"[red]Error: {e}[/red]")
357
+ raise typer.Exit(1) from None
358
+
359
+
360
+ @app.command(name="profile")
361
+ def billing_profile(
362
+ api: str = typer.Option("user", "--api", "-a", help="API type (admin or user)"),
363
+ ) -> None:
364
+ """Show your billing profile.
365
+
366
+ Examples:
367
+ proxy-platform billing profile
368
+ """
369
+ _billing_get_and_print("/api/v1/billing/profile", api, "Billing Profile")
370
+
371
+
372
+ @app.command(name="countries")
373
+ def list_countries(
374
+ api: str = typer.Option("user", "--api", "-a", help="API type (admin or user)"),
375
+ ) -> None:
376
+ """List supported billing countries.
377
+
378
+ Examples:
379
+ proxy-platform billing countries
380
+ """
381
+ _billing_get_and_print("/api/v1/billing/countries", api, "Countries")