payi 0.1.0a8__py3-none-any.whl → 0.1.0a9__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 payi might be problematic. Click here for more details.

payi/_models.py CHANGED
@@ -10,6 +10,7 @@ from typing_extensions import (
10
10
  ClassVar,
11
11
  Protocol,
12
12
  Required,
13
+ ParamSpec,
13
14
  TypedDict,
14
15
  TypeGuard,
15
16
  final,
@@ -67,6 +68,9 @@ if TYPE_CHECKING:
67
68
  __all__ = ["BaseModel", "GenericModel"]
68
69
 
69
70
  _T = TypeVar("_T")
71
+ _BaseModelT = TypeVar("_BaseModelT", bound="BaseModel")
72
+
73
+ P = ParamSpec("P")
70
74
 
71
75
 
72
76
  @runtime_checkable
@@ -379,6 +383,29 @@ def is_basemodel_type(type_: type) -> TypeGuard[type[BaseModel] | type[GenericMo
379
383
  return issubclass(origin, BaseModel) or issubclass(origin, GenericModel)
380
384
 
381
385
 
386
+ def build(
387
+ base_model_cls: Callable[P, _BaseModelT],
388
+ *args: P.args,
389
+ **kwargs: P.kwargs,
390
+ ) -> _BaseModelT:
391
+ """Construct a BaseModel class without validation.
392
+
393
+ This is useful for cases where you need to instantiate a `BaseModel`
394
+ from an API response as this provides type-safe params which isn't supported
395
+ by helpers like `construct_type()`.
396
+
397
+ ```py
398
+ build(MyModel, my_field_a="foo", my_field_b=123)
399
+ ```
400
+ """
401
+ if args:
402
+ raise TypeError(
403
+ "Received positional arguments which are not supported; Keyword arguments must be used instead",
404
+ )
405
+
406
+ return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs))
407
+
408
+
382
409
  def construct_type(*, value: object, type_: object) -> object:
383
410
  """Loose coercion to the expected type with construction of nested values.
384
411
 
payi/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "payi"
4
- __version__ = "0.1.0-alpha.8" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.9" # x-release-please-version
payi/resources/ingest.py CHANGED
@@ -69,12 +69,17 @@ class IngestResource(SyncAPIResource):
69
69
 
70
70
  if isinstance(budget_ids, NotGiven):
71
71
  valid_ids_str = NOT_GIVEN
72
+ elif not isinstance(budget_ids, list): # type: ignore
73
+ raise TypeError("budget_ids must be a list")
72
74
  else:
73
75
  # Proceed with the list comprehension if budget_ids is not NotGiven
74
76
  valid_ids = [id.strip() for id in budget_ids if id.strip()]
75
77
  valid_ids_str = ",".join(valid_ids) if valid_ids else NOT_GIVEN
78
+
76
79
  if isinstance(request_tags, NotGiven):
77
80
  valid_tags_str = NOT_GIVEN
81
+ elif not isinstance(request_tags, list): # type: ignore
82
+ raise TypeError("request_tags must be a list")
78
83
  else:
79
84
  # Proceed with the list comprehension if budget_ids is not NotGiven
80
85
  valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: payi
3
- Version: 0.1.0a8
3
+ Version: 0.1.0a9
4
4
  Summary: The official Python library for the payi API
5
5
  Project-URL: Homepage, https://github.com/Pay-i/pay-i-python
6
6
  Project-URL: Repository, https://github.com/Pay-i/pay-i-python
@@ -5,13 +5,13 @@ payi/_compat.py,sha256=m0I0haqFZuVxd5m227_8nNmvA1saXyuNJ7BjidX_PTE,6389
5
5
  payi/_constants.py,sha256=JE8kyZa2Q4NK_i4fO--8siEYTzeHnT0fYbOFDgDP4uk,464
6
6
  payi/_exceptions.py,sha256=ItygKNrNXIVY0H6LsGVZvFuAHB3Vtm_VZXmWzCnpHy0,3216
7
7
  payi/_files.py,sha256=me2eyWzJCM4YKh10Gzkxw4YyIEJoikzD4BVu_20UUc0,3565
8
- payi/_models.py,sha256=kbTvpEMoo6a_660jyvLNARXzS7fsSlg-O0yQrjJpdBs,26876
8
+ payi/_models.py,sha256=k20LxEUkldClNv6I_51gfVsisaGqMHXReSflhS3uz9Q,27656
9
9
  payi/_qs.py,sha256=AOkSz4rHtK4YI3ZU_kzea-zpwBUgEY8WniGmTPyEimc,4846
10
10
  payi/_resource.py,sha256=j2jIkTr8OIC8sU6-05nxSaCyj4MaFlbZrwlyg4_xJos,1088
11
11
  payi/_response.py,sha256=W6pADUzbnMFGnVzGY4M3FkX9uvw8AFSMTPZKPgQ_TV4,28363
12
12
  payi/_streaming.py,sha256=Z_wIyo206T6Jqh2rolFg2VXZgX24PahLmpURp0-NssU,10092
13
13
  payi/_types.py,sha256=04q-KHD-qZ1xlfwEb_muyIHWmD-nZ-KxnRxA_QEjqNk,6125
14
- payi/_version.py,sha256=Ls4MSTXQFcf_KpAijqH7H0RxHhpuu3maVXh4b1igY6Q,164
14
+ payi/_version.py,sha256=1gvO5TBWmFdSbbzpztc_dc8uAUuPegSCPkPOxFki5Mc,164
15
15
  payi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  payi/_utils/__init__.py,sha256=Uzq1-FIih_VUjzdNVWXks0sdC39KBKLMrZoz-_JOjJ4,1988
17
17
  payi/_utils/_logs.py,sha256=fmnf5D9TOgkgZKfgYmSa3PiUc3SZgkchn6CzJUeo0SQ,768
@@ -25,7 +25,7 @@ payi/_utils/_utils.py,sha256=FaZdW0tWil7IERdxUfKt7pVcyXL2aCnR3lo73q66qgI,11447
25
25
  payi/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
26
26
  payi/lib/helpers.py,sha256=IdB_pi8dLtVh9b4DG-zasA1i9Yk-5xAayoUTNWBAFpc,1235
27
27
  payi/resources/__init__.py,sha256=1p8kzMES8NNDQQoK3TEDE-8vVuQ59xxUjyyblZJBTjw,1015
28
- payi/resources/ingest.py,sha256=bMWFiUsMbV913HmE61CEGnPcqTydM6OLNQP22Kg1_Eg,7631
28
+ payi/resources/ingest.py,sha256=NSNGb1HH00yfn7QoEnbTXrE0SFhmeS9L1ZVH4f_Zq34,7874
29
29
  payi/resources/budgets/__init__.py,sha256=w1UhOdDXtUH4A91ME5Tw2nr9bRvPJyJY1YWiVVy7jj0,989
30
30
  payi/resources/budgets/budgets.py,sha256=aMu39MrRsVTtNfYwQPMeFK329ouwnHuFXM_vK9Ewj0k,24047
31
31
  payi/resources/budgets/tags.py,sha256=jzP0nal287bL2htY1TwDcdFRJyNMm6IdM936O1jCeMo,17850
@@ -52,7 +52,7 @@ payi/types/budgets/tag_remove_params.py,sha256=fNiHex1U11o_B0bfJDkpGARkEf99J-bd-
52
52
  payi/types/budgets/tag_remove_response.py,sha256=Wt4KwC76y3qxdEqKhXzFkYu2iECYePgXcpidXkuheWQ,219
53
53
  payi/types/budgets/tag_update_params.py,sha256=bWWeDqfySt7CZ6HDsZzENREOWGWGWFgnAtyleNMwUsE,314
54
54
  payi/types/budgets/tag_update_response.py,sha256=Vlf-zxLZzvmhUodhzF7hiqWcxyjrb7Ri_lSajg8vOPM,219
55
- payi-0.1.0a8.dist-info/METADATA,sha256=jEUmB2yAVCC_6IRuV-Wzj8obdFgO0LkKbYBAJkzOWjY,11872
56
- payi-0.1.0a8.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
57
- payi-0.1.0a8.dist-info/licenses/LICENSE,sha256=8vX1pjh3esb6D5DvXAf6NxiBcVyon8aHWNJCxmmHXeY,11334
58
- payi-0.1.0a8.dist-info/RECORD,,
55
+ payi-0.1.0a9.dist-info/METADATA,sha256=5PUYlpelVKHtEFKW7h6ugOHgC4_ESiGbBMTuVPmv6eo,11872
56
+ payi-0.1.0a9.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
57
+ payi-0.1.0a9.dist-info/licenses/LICENSE,sha256=8vX1pjh3esb6D5DvXAf6NxiBcVyon8aHWNJCxmmHXeY,11334
58
+ payi-0.1.0a9.dist-info/RECORD,,
File without changes