qurl-python 0.3.0__py3-none-any.whl → 0.4.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.
layerv_qurl/_utils.py CHANGED
@@ -989,8 +989,10 @@ def _parse_rate_limits(data: dict[str, Any] | None) -> RateLimits | None:
989
989
  create_per_hour=data.get("create_per_hour", 0),
990
990
  list_per_minute=data.get("list_per_minute", 0),
991
991
  resolve_per_minute=data.get("resolve_per_minute", 0),
992
- max_active_qurls=data.get("max_active_qurls", 0),
992
+ max_active_qurls=data.get("max_active_qurls"),
993
993
  max_expiry_seconds=data.get("max_expiry_seconds", 0),
994
+ max_active_resources=data.get("max_active_resources"),
995
+ max_data_transfer_bytes=data.get("max_data_transfer_bytes"),
994
996
  )
995
997
 
996
998
 
@@ -999,11 +1001,14 @@ def _parse_usage_block(data: dict[str, Any] | None) -> Usage | None:
999
1001
  return None
1000
1002
  return Usage(
1001
1003
  qurls_created=data.get("qurls_created", 0),
1002
- active_qurls=data.get("active_qurls", 0),
1004
+ active_qurls=data.get("active_qurls"),
1003
1005
  # Nullable per the API spec — the field is null when
1004
1006
  # max_active_qurls is unlimited.
1005
1007
  active_qurls_percent=data.get("active_qurls_percent"),
1006
1008
  total_accesses=data.get("total_accesses", 0),
1009
+ active_resources=data.get("active_resources"),
1010
+ active_resources_percent=data.get("active_resources_percent"),
1011
+ data_transfer_bytes=data.get("data_transfer_bytes"),
1007
1012
  )
1008
1013
 
1009
1014
 
@@ -1289,8 +1294,10 @@ def parse_current_period_usage(data: dict[str, Any]) -> CurrentPeriodUsage:
1289
1294
  period_start=_parse_dt(data.get("period_start")),
1290
1295
  period_end=_parse_dt(data.get("period_end")),
1291
1296
  qurls_created=data.get("qurls_created", 0),
1292
- active_qurls=data.get("active_qurls", 0),
1297
+ active_qurls=data.get("active_qurls"),
1293
1298
  cost_estimate=_parse_usage_cost(data.get("cost_estimate")),
1299
+ active_resources=data.get("active_resources"),
1300
+ data_transfer_bytes=data.get("data_transfer_bytes"),
1294
1301
  )
1295
1302
 
1296
1303
 
layerv_qurl/types.py CHANGED
@@ -211,14 +211,18 @@ class ListOutput:
211
211
 
212
212
  @dataclass
213
213
  class RateLimits:
214
- """Rate limit configuration."""
214
+ """Rate limits and plan allowances."""
215
215
 
216
216
  create_per_minute: int = 0
217
217
  create_per_hour: int = 0
218
218
  list_per_minute: int = 0
219
219
  resolve_per_minute: int = 0
220
- max_active_qurls: int = 0
220
+ # Deprecated alias for max_active_resources, not a qURL-count cap.
221
+ max_active_qurls: int | None = None
221
222
  max_expiry_seconds: int = 0
223
+ # Missing/null limits remain unknown; -1 is the unlimited sentinel.
224
+ max_active_resources: int | None = None
225
+ max_data_transfer_bytes: int | None = None
222
226
 
223
227
 
224
228
  @dataclass
@@ -226,10 +230,15 @@ class Usage:
226
230
  """Usage statistics."""
227
231
 
228
232
  qurls_created: int = 0
229
- active_qurls: int = 0
233
+ # Deprecated alias for active_resources, not a count of qURLs.
234
+ active_qurls: int | None = None
230
235
  # Changed from float=0.0 — callers must None-check before arithmetic.
231
236
  active_qurls_percent: float | None = None
232
237
  total_accesses: int = 0
238
+ active_resources: int | None = None
239
+ active_resources_percent: float | None = None
240
+ # Measured bytes this UTC calendar month; None is distinct from zero.
241
+ data_transfer_bytes: int | None = None
233
242
 
234
243
 
235
244
  @dataclass
@@ -549,8 +558,12 @@ class CurrentPeriodUsage:
549
558
  period_start: datetime | None
550
559
  period_end: datetime | None
551
560
  qurls_created: int
552
- active_qurls: int
561
+ # Deprecated alias for active_resources, not a count of qURLs.
562
+ active_qurls: int | None
553
563
  cost_estimate: UsageCostEstimate | None = None
564
+ active_resources: int | None = None
565
+ # Measured bytes this UTC calendar month, independent of the billing period.
566
+ data_transfer_bytes: int | None = None
554
567
 
555
568
 
556
569
  @dataclass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: qurl-python
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Python SDK for the qURL™ API — secure, time-limited access links. Quantum URL is how you enter the hidden layer of the internet.
5
5
  Project-URL: Homepage, https://github.com/layervai/qurl-python
6
6
  Project-URL: Repository, https://github.com/layervai/qurl-python
@@ -332,10 +332,31 @@ All error classes inherit from `QURLError`, so `except QURLError` catches everyt
332
332
  ```python
333
333
  quota = client.get_quota()
334
334
  print(f"Plan: {quota.plan}")
335
- print(f"Active qURLs: {quota.usage.active_qurls}")
336
- print(f"Rate limit: {quota.rate_limits.create_per_minute}/min")
335
+ usage = quota.usage
336
+ active = usage.active_resources if usage is not None else None
337
+ if active is None and usage is not None:
338
+ active = usage.active_qurls
339
+ print("Active protected resources:", active if active is not None else "unavailable")
340
+ if quota.rate_limits is not None:
341
+ print(f"Rate limit: {quota.rate_limits.create_per_minute}/min")
337
342
  ```
338
343
 
344
+ Use `max_active_resources`, `active_resources`, and `active_resources_percent`
345
+ for resource quotas. `max_data_transfer_bytes` is the monthly byte allowance;
346
+ `data_transfer_bytes` is measured usage, available on both quota usage and
347
+ current-period responses. This usage always covers the current UTC calendar
348
+ month, independently of a paid account's billing period. Missing or null values
349
+ remain `None`, distinct from a reported zero. The [service OpenAPI spec](https://github.com/layervai/qurl-service/blob/01d7c47361b5f72f890428f1a53bd04e8d7f67cc/api/openapi.yaml#L5796)
350
+ defines `-1` as unlimited for `max_active_resources` and its legacy alias
351
+ `max_active_qurls`, as well as `max_data_transfer_bytes`.
352
+
353
+ **Migration:** the deprecated `max_active_qurls` and `active_qurls` fields still
354
+ represent protected resources. Missing values now return `None` instead of
355
+ `0`; check `is not None` before arithmetic or displaying a count. Canonical
356
+ and legacy fields preserve their own wire values, so an older response that
357
+ omits canonical fields leaves those fields `None`. Prefer the canonical fields
358
+ when available.
359
+
339
360
  JWT-authenticated dashboard endpoints are also available for usage, customer
340
361
  settings, billing sessions, invoices, and API-key management. API-key auth
341
362
  continues to work for normal qURL, resource, domain, webhook, connector, and
@@ -1,12 +1,12 @@
1
1
  layerv_qurl/__init__.py,sha256=1PMfphJ3oAJm0VygtRg3lH2uH0NP1ruzkpJeErJJZkk,3795
2
- layerv_qurl/_utils.py,sha256=kuVqz6F64s9sclIreg2hd7OVZet6VytiYXgxnBtrPhY,65316
2
+ layerv_qurl/_utils.py,sha256=UUhH4jsxv6KxDA_iSl3r-JETDl5Bqic0d2OOtM7gLkM,65742
3
3
  layerv_qurl/async_client.py,sha256=2ap4aPZ0FfThnqjA2-P5bkyWpTYYqXC0yyu2D09QRFs,64703
4
4
  layerv_qurl/client.py,sha256=w43jvXKUOyOS_Uta2ve7VfLz8VcM8ESMlwfO-QvFEFE,70582
5
5
  layerv_qurl/errors.py,sha256=7vyBEsJnN-e7804hil9KRwEgmUv5QW-DUGTf6FdSaV0,4932
6
6
  layerv_qurl/langchain.py,sha256=MJdow63lc6DXfL-riyu-rYC3cMiEKIOY9UZUvY4hEUQ,4695
7
7
  layerv_qurl/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- layerv_qurl/types.py,sha256=ynn6LLoZcX9cQ_erMl5bJv_h6YHdeA1KDUHMaAVNQuE,18099
9
- qurl_python-0.3.0.dist-info/METADATA,sha256=VHWfPZKV_qBzUkwzhP4xZQ5yZEHk5iG-2ayJh5gkGrM,13222
10
- qurl_python-0.3.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
11
- qurl_python-0.3.0.dist-info/licenses/LICENSE,sha256=cg6W6pLqMQFf89yPfz5ClnVSrNEeoTh3NOEQyH9CaZw,1069
12
- qurl_python-0.3.0.dist-info/RECORD,,
8
+ layerv_qurl/types.py,sha256=Rb4Wu1ER_1U4pNES7A__TR_k7FPj3Y_6EmHOijGZC1w,18872
9
+ qurl_python-0.4.0.dist-info/METADATA,sha256=dURx4UtZTHY3pdYLXEm96FlY3Ab7Ltyn2f9wqmhUkJg,14560
10
+ qurl_python-0.4.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
11
+ qurl_python-0.4.0.dist-info/licenses/LICENSE,sha256=cg6W6pLqMQFf89yPfz5ClnVSrNEeoTh3NOEQyH9CaZw,1069
12
+ qurl_python-0.4.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.32.0
2
+ Generator: hatchling 1.32.4
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any