payi 0.1.0a24__py3-none-any.whl → 0.1.0a26__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/_base_client.py +63 -48
- payi/_client.py +8 -0
- payi/_compat.py +2 -0
- payi/_utils/_utils.py +4 -3
- payi/_version.py +1 -1
- payi/resources/__init__.py +14 -0
- payi/resources/budgets/budgets.py +22 -0
- payi/resources/budgets/tags.py +22 -0
- payi/resources/categories/categories.py +22 -0
- payi/resources/categories/resources.py +26 -0
- payi/resources/csat.py +188 -0
- payi/resources/experiences/experiences.py +22 -0
- payi/resources/experiences/types.py +22 -0
- payi/resources/ingest.py +27 -2
- payi/types/__init__.py +2 -0
- payi/types/bulk_ingest_response.py +7 -0
- payi/types/categories/resource_create_params.py +2 -0
- payi/types/category_resource_response.py +2 -0
- payi/types/csat.py +11 -0
- payi/types/csat_create_params.py +14 -0
- payi/types/evaluations/__init__.py +6 -0
- payi/types/evaluations/experience_create_params.py +14 -0
- payi/types/evaluations/request_create_params.py +14 -0
- payi/types/experiences/experience_type.py +0 -2
- payi/types/ingest_event_param.py +2 -0
- payi/types/ingest_units_params.py +3 -1
- payi/types/shared/__init__.py +2 -0
- {payi-0.1.0a24.dist-info → payi-0.1.0a26.dist-info}/METADATA +12 -1
- {payi-0.1.0a24.dist-info → payi-0.1.0a26.dist-info}/RECORD +31 -24
- {payi-0.1.0a24.dist-info → payi-0.1.0a26.dist-info}/WHEEL +0 -0
- {payi-0.1.0a24.dist-info → payi-0.1.0a26.dist-info}/licenses/LICENSE +0 -0
payi/_base_client.py
CHANGED
|
@@ -400,14 +400,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
400
400
|
) -> _exceptions.APIStatusError:
|
|
401
401
|
raise NotImplementedError()
|
|
402
402
|
|
|
403
|
-
def
|
|
404
|
-
self,
|
|
405
|
-
remaining_retries: Optional[int],
|
|
406
|
-
options: FinalRequestOptions,
|
|
407
|
-
) -> int:
|
|
408
|
-
return remaining_retries if remaining_retries is not None else options.get_max_retries(self.max_retries)
|
|
409
|
-
|
|
410
|
-
def _build_headers(self, options: FinalRequestOptions) -> httpx.Headers:
|
|
403
|
+
def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0) -> httpx.Headers:
|
|
411
404
|
custom_headers = options.headers or {}
|
|
412
405
|
headers_dict = _merge_mappings(self.default_headers, custom_headers)
|
|
413
406
|
self._validate_headers(headers_dict, custom_headers)
|
|
@@ -419,6 +412,11 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
419
412
|
if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers:
|
|
420
413
|
headers[idempotency_header] = options.idempotency_key or self._idempotency_key()
|
|
421
414
|
|
|
415
|
+
# Don't set the retry count header if it was already set or removed by the caller. We check
|
|
416
|
+
# `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case.
|
|
417
|
+
if "x-stainless-retry-count" not in (header.lower() for header in custom_headers):
|
|
418
|
+
headers["x-stainless-retry-count"] = str(retries_taken)
|
|
419
|
+
|
|
422
420
|
return headers
|
|
423
421
|
|
|
424
422
|
def _prepare_url(self, url: str) -> URL:
|
|
@@ -440,6 +438,8 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
440
438
|
def _build_request(
|
|
441
439
|
self,
|
|
442
440
|
options: FinalRequestOptions,
|
|
441
|
+
*,
|
|
442
|
+
retries_taken: int = 0,
|
|
443
443
|
) -> httpx.Request:
|
|
444
444
|
if log.isEnabledFor(logging.DEBUG):
|
|
445
445
|
log.debug("Request options: %s", model_dump(options, exclude_unset=True))
|
|
@@ -455,7 +455,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
455
455
|
else:
|
|
456
456
|
raise RuntimeError(f"Unexpected JSON data type, {type(json_data)}, cannot merge with `extra_body`")
|
|
457
457
|
|
|
458
|
-
headers = self._build_headers(options)
|
|
458
|
+
headers = self._build_headers(options, retries_taken=retries_taken)
|
|
459
459
|
params = _merge_mappings(self.default_query, options.params)
|
|
460
460
|
content_type = headers.get("Content-Type")
|
|
461
461
|
files = options.files
|
|
@@ -489,12 +489,17 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
489
489
|
if not files:
|
|
490
490
|
files = cast(HttpxRequestFiles, ForceMultipartDict())
|
|
491
491
|
|
|
492
|
+
prepared_url = self._prepare_url(options.url)
|
|
493
|
+
if "_" in prepared_url.host:
|
|
494
|
+
# work around https://github.com/encode/httpx/discussions/2880
|
|
495
|
+
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
|
|
496
|
+
|
|
492
497
|
# TODO: report this error to httpx
|
|
493
498
|
return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
|
|
494
499
|
headers=headers,
|
|
495
500
|
timeout=self.timeout if isinstance(options.timeout, NotGiven) else options.timeout,
|
|
496
501
|
method=options.method,
|
|
497
|
-
url=
|
|
502
|
+
url=prepared_url,
|
|
498
503
|
# the `Query` type that we use is incompatible with qs'
|
|
499
504
|
# `Params` type as it needs to be typed as `Mapping[str, object]`
|
|
500
505
|
# so that passing a `TypedDict` doesn't cause an error.
|
|
@@ -933,12 +938,17 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
933
938
|
stream: bool = False,
|
|
934
939
|
stream_cls: type[_StreamT] | None = None,
|
|
935
940
|
) -> ResponseT | _StreamT:
|
|
941
|
+
if remaining_retries is not None:
|
|
942
|
+
retries_taken = options.get_max_retries(self.max_retries) - remaining_retries
|
|
943
|
+
else:
|
|
944
|
+
retries_taken = 0
|
|
945
|
+
|
|
936
946
|
return self._request(
|
|
937
947
|
cast_to=cast_to,
|
|
938
948
|
options=options,
|
|
939
949
|
stream=stream,
|
|
940
950
|
stream_cls=stream_cls,
|
|
941
|
-
|
|
951
|
+
retries_taken=retries_taken,
|
|
942
952
|
)
|
|
943
953
|
|
|
944
954
|
def _request(
|
|
@@ -946,7 +956,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
946
956
|
*,
|
|
947
957
|
cast_to: Type[ResponseT],
|
|
948
958
|
options: FinalRequestOptions,
|
|
949
|
-
|
|
959
|
+
retries_taken: int,
|
|
950
960
|
stream: bool,
|
|
951
961
|
stream_cls: type[_StreamT] | None,
|
|
952
962
|
) -> ResponseT | _StreamT:
|
|
@@ -958,8 +968,8 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
958
968
|
cast_to = self._maybe_override_cast_to(cast_to, options)
|
|
959
969
|
options = self._prepare_options(options)
|
|
960
970
|
|
|
961
|
-
|
|
962
|
-
request = self._build_request(options)
|
|
971
|
+
remaining_retries = options.get_max_retries(self.max_retries) - retries_taken
|
|
972
|
+
request = self._build_request(options, retries_taken=retries_taken)
|
|
963
973
|
self._prepare_request(request)
|
|
964
974
|
|
|
965
975
|
kwargs: HttpxSendArgs = {}
|
|
@@ -977,11 +987,11 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
977
987
|
except httpx.TimeoutException as err:
|
|
978
988
|
log.debug("Encountered httpx.TimeoutException", exc_info=True)
|
|
979
989
|
|
|
980
|
-
if
|
|
990
|
+
if remaining_retries > 0:
|
|
981
991
|
return self._retry_request(
|
|
982
992
|
input_options,
|
|
983
993
|
cast_to,
|
|
984
|
-
|
|
994
|
+
retries_taken=retries_taken,
|
|
985
995
|
stream=stream,
|
|
986
996
|
stream_cls=stream_cls,
|
|
987
997
|
response_headers=None,
|
|
@@ -992,11 +1002,11 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
992
1002
|
except Exception as err:
|
|
993
1003
|
log.debug("Encountered Exception", exc_info=True)
|
|
994
1004
|
|
|
995
|
-
if
|
|
1005
|
+
if remaining_retries > 0:
|
|
996
1006
|
return self._retry_request(
|
|
997
1007
|
input_options,
|
|
998
1008
|
cast_to,
|
|
999
|
-
|
|
1009
|
+
retries_taken=retries_taken,
|
|
1000
1010
|
stream=stream,
|
|
1001
1011
|
stream_cls=stream_cls,
|
|
1002
1012
|
response_headers=None,
|
|
@@ -1019,13 +1029,13 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
1019
1029
|
except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code
|
|
1020
1030
|
log.debug("Encountered httpx.HTTPStatusError", exc_info=True)
|
|
1021
1031
|
|
|
1022
|
-
if
|
|
1032
|
+
if remaining_retries > 0 and self._should_retry(err.response):
|
|
1023
1033
|
err.response.close()
|
|
1024
1034
|
return self._retry_request(
|
|
1025
1035
|
input_options,
|
|
1026
1036
|
cast_to,
|
|
1027
|
-
|
|
1028
|
-
err.response.headers,
|
|
1037
|
+
retries_taken=retries_taken,
|
|
1038
|
+
response_headers=err.response.headers,
|
|
1029
1039
|
stream=stream,
|
|
1030
1040
|
stream_cls=stream_cls,
|
|
1031
1041
|
)
|
|
@@ -1044,26 +1054,26 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
1044
1054
|
response=response,
|
|
1045
1055
|
stream=stream,
|
|
1046
1056
|
stream_cls=stream_cls,
|
|
1047
|
-
retries_taken=
|
|
1057
|
+
retries_taken=retries_taken,
|
|
1048
1058
|
)
|
|
1049
1059
|
|
|
1050
1060
|
def _retry_request(
|
|
1051
1061
|
self,
|
|
1052
1062
|
options: FinalRequestOptions,
|
|
1053
1063
|
cast_to: Type[ResponseT],
|
|
1054
|
-
remaining_retries: int,
|
|
1055
|
-
response_headers: httpx.Headers | None,
|
|
1056
1064
|
*,
|
|
1065
|
+
retries_taken: int,
|
|
1066
|
+
response_headers: httpx.Headers | None,
|
|
1057
1067
|
stream: bool,
|
|
1058
1068
|
stream_cls: type[_StreamT] | None,
|
|
1059
1069
|
) -> ResponseT | _StreamT:
|
|
1060
|
-
|
|
1061
|
-
if
|
|
1070
|
+
remaining_retries = options.get_max_retries(self.max_retries) - retries_taken
|
|
1071
|
+
if remaining_retries == 1:
|
|
1062
1072
|
log.debug("1 retry left")
|
|
1063
1073
|
else:
|
|
1064
|
-
log.debug("%i retries left",
|
|
1074
|
+
log.debug("%i retries left", remaining_retries)
|
|
1065
1075
|
|
|
1066
|
-
timeout = self._calculate_retry_timeout(
|
|
1076
|
+
timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers)
|
|
1067
1077
|
log.info("Retrying request to %s in %f seconds", options.url, timeout)
|
|
1068
1078
|
|
|
1069
1079
|
# In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a
|
|
@@ -1073,7 +1083,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
1073
1083
|
return self._request(
|
|
1074
1084
|
options=options,
|
|
1075
1085
|
cast_to=cast_to,
|
|
1076
|
-
|
|
1086
|
+
retries_taken=retries_taken + 1,
|
|
1077
1087
|
stream=stream,
|
|
1078
1088
|
stream_cls=stream_cls,
|
|
1079
1089
|
)
|
|
@@ -1491,12 +1501,17 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1491
1501
|
stream_cls: type[_AsyncStreamT] | None = None,
|
|
1492
1502
|
remaining_retries: Optional[int] = None,
|
|
1493
1503
|
) -> ResponseT | _AsyncStreamT:
|
|
1504
|
+
if remaining_retries is not None:
|
|
1505
|
+
retries_taken = options.get_max_retries(self.max_retries) - remaining_retries
|
|
1506
|
+
else:
|
|
1507
|
+
retries_taken = 0
|
|
1508
|
+
|
|
1494
1509
|
return await self._request(
|
|
1495
1510
|
cast_to=cast_to,
|
|
1496
1511
|
options=options,
|
|
1497
1512
|
stream=stream,
|
|
1498
1513
|
stream_cls=stream_cls,
|
|
1499
|
-
|
|
1514
|
+
retries_taken=retries_taken,
|
|
1500
1515
|
)
|
|
1501
1516
|
|
|
1502
1517
|
async def _request(
|
|
@@ -1506,7 +1521,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1506
1521
|
*,
|
|
1507
1522
|
stream: bool,
|
|
1508
1523
|
stream_cls: type[_AsyncStreamT] | None,
|
|
1509
|
-
|
|
1524
|
+
retries_taken: int,
|
|
1510
1525
|
) -> ResponseT | _AsyncStreamT:
|
|
1511
1526
|
if self._platform is None:
|
|
1512
1527
|
# `get_platform` can make blocking IO calls so we
|
|
@@ -1521,8 +1536,8 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1521
1536
|
cast_to = self._maybe_override_cast_to(cast_to, options)
|
|
1522
1537
|
options = await self._prepare_options(options)
|
|
1523
1538
|
|
|
1524
|
-
|
|
1525
|
-
request = self._build_request(options)
|
|
1539
|
+
remaining_retries = options.get_max_retries(self.max_retries) - retries_taken
|
|
1540
|
+
request = self._build_request(options, retries_taken=retries_taken)
|
|
1526
1541
|
await self._prepare_request(request)
|
|
1527
1542
|
|
|
1528
1543
|
kwargs: HttpxSendArgs = {}
|
|
@@ -1538,11 +1553,11 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1538
1553
|
except httpx.TimeoutException as err:
|
|
1539
1554
|
log.debug("Encountered httpx.TimeoutException", exc_info=True)
|
|
1540
1555
|
|
|
1541
|
-
if
|
|
1556
|
+
if remaining_retries > 0:
|
|
1542
1557
|
return await self._retry_request(
|
|
1543
1558
|
input_options,
|
|
1544
1559
|
cast_to,
|
|
1545
|
-
|
|
1560
|
+
retries_taken=retries_taken,
|
|
1546
1561
|
stream=stream,
|
|
1547
1562
|
stream_cls=stream_cls,
|
|
1548
1563
|
response_headers=None,
|
|
@@ -1553,11 +1568,11 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1553
1568
|
except Exception as err:
|
|
1554
1569
|
log.debug("Encountered Exception", exc_info=True)
|
|
1555
1570
|
|
|
1556
|
-
if
|
|
1571
|
+
if retries_taken > 0:
|
|
1557
1572
|
return await self._retry_request(
|
|
1558
1573
|
input_options,
|
|
1559
1574
|
cast_to,
|
|
1560
|
-
|
|
1575
|
+
retries_taken=retries_taken,
|
|
1561
1576
|
stream=stream,
|
|
1562
1577
|
stream_cls=stream_cls,
|
|
1563
1578
|
response_headers=None,
|
|
@@ -1575,13 +1590,13 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1575
1590
|
except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code
|
|
1576
1591
|
log.debug("Encountered httpx.HTTPStatusError", exc_info=True)
|
|
1577
1592
|
|
|
1578
|
-
if
|
|
1593
|
+
if remaining_retries > 0 and self._should_retry(err.response):
|
|
1579
1594
|
await err.response.aclose()
|
|
1580
1595
|
return await self._retry_request(
|
|
1581
1596
|
input_options,
|
|
1582
1597
|
cast_to,
|
|
1583
|
-
|
|
1584
|
-
err.response.headers,
|
|
1598
|
+
retries_taken=retries_taken,
|
|
1599
|
+
response_headers=err.response.headers,
|
|
1585
1600
|
stream=stream,
|
|
1586
1601
|
stream_cls=stream_cls,
|
|
1587
1602
|
)
|
|
@@ -1600,26 +1615,26 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1600
1615
|
response=response,
|
|
1601
1616
|
stream=stream,
|
|
1602
1617
|
stream_cls=stream_cls,
|
|
1603
|
-
retries_taken=
|
|
1618
|
+
retries_taken=retries_taken,
|
|
1604
1619
|
)
|
|
1605
1620
|
|
|
1606
1621
|
async def _retry_request(
|
|
1607
1622
|
self,
|
|
1608
1623
|
options: FinalRequestOptions,
|
|
1609
1624
|
cast_to: Type[ResponseT],
|
|
1610
|
-
remaining_retries: int,
|
|
1611
|
-
response_headers: httpx.Headers | None,
|
|
1612
1625
|
*,
|
|
1626
|
+
retries_taken: int,
|
|
1627
|
+
response_headers: httpx.Headers | None,
|
|
1613
1628
|
stream: bool,
|
|
1614
1629
|
stream_cls: type[_AsyncStreamT] | None,
|
|
1615
1630
|
) -> ResponseT | _AsyncStreamT:
|
|
1616
|
-
|
|
1617
|
-
if
|
|
1631
|
+
remaining_retries = options.get_max_retries(self.max_retries) - retries_taken
|
|
1632
|
+
if remaining_retries == 1:
|
|
1618
1633
|
log.debug("1 retry left")
|
|
1619
1634
|
else:
|
|
1620
|
-
log.debug("%i retries left",
|
|
1635
|
+
log.debug("%i retries left", remaining_retries)
|
|
1621
1636
|
|
|
1622
|
-
timeout = self._calculate_retry_timeout(
|
|
1637
|
+
timeout = self._calculate_retry_timeout(remaining_retries, options, response_headers)
|
|
1623
1638
|
log.info("Retrying request to %s in %f seconds", options.url, timeout)
|
|
1624
1639
|
|
|
1625
1640
|
await anyio.sleep(timeout)
|
|
@@ -1627,7 +1642,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1627
1642
|
return await self._request(
|
|
1628
1643
|
options=options,
|
|
1629
1644
|
cast_to=cast_to,
|
|
1630
|
-
|
|
1645
|
+
retries_taken=retries_taken + 1,
|
|
1631
1646
|
stream=stream,
|
|
1632
1647
|
stream_cls=stream_cls,
|
|
1633
1648
|
)
|
payi/_client.py
CHANGED
|
@@ -50,6 +50,7 @@ class Payi(SyncAPIClient):
|
|
|
50
50
|
ingest: resources.IngestResource
|
|
51
51
|
categories: resources.CategoriesResource
|
|
52
52
|
experiences: resources.ExperiencesResource
|
|
53
|
+
csat: resources.CsatResource
|
|
53
54
|
with_raw_response: PayiWithRawResponse
|
|
54
55
|
with_streaming_response: PayiWithStreamedResponse
|
|
55
56
|
|
|
@@ -111,6 +112,7 @@ class Payi(SyncAPIClient):
|
|
|
111
112
|
self.ingest = resources.IngestResource(self)
|
|
112
113
|
self.categories = resources.CategoriesResource(self)
|
|
113
114
|
self.experiences = resources.ExperiencesResource(self)
|
|
115
|
+
self.csat = resources.CsatResource(self)
|
|
114
116
|
self.with_raw_response = PayiWithRawResponse(self)
|
|
115
117
|
self.with_streaming_response = PayiWithStreamedResponse(self)
|
|
116
118
|
|
|
@@ -224,6 +226,7 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
224
226
|
ingest: resources.AsyncIngestResource
|
|
225
227
|
categories: resources.AsyncCategoriesResource
|
|
226
228
|
experiences: resources.AsyncExperiencesResource
|
|
229
|
+
csat: resources.AsyncCsatResource
|
|
227
230
|
with_raw_response: AsyncPayiWithRawResponse
|
|
228
231
|
with_streaming_response: AsyncPayiWithStreamedResponse
|
|
229
232
|
|
|
@@ -285,6 +288,7 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
285
288
|
self.ingest = resources.AsyncIngestResource(self)
|
|
286
289
|
self.categories = resources.AsyncCategoriesResource(self)
|
|
287
290
|
self.experiences = resources.AsyncExperiencesResource(self)
|
|
291
|
+
self.csat = resources.AsyncCsatResource(self)
|
|
288
292
|
self.with_raw_response = AsyncPayiWithRawResponse(self)
|
|
289
293
|
self.with_streaming_response = AsyncPayiWithStreamedResponse(self)
|
|
290
294
|
|
|
@@ -399,6 +403,7 @@ class PayiWithRawResponse:
|
|
|
399
403
|
self.ingest = resources.IngestResourceWithRawResponse(client.ingest)
|
|
400
404
|
self.categories = resources.CategoriesResourceWithRawResponse(client.categories)
|
|
401
405
|
self.experiences = resources.ExperiencesResourceWithRawResponse(client.experiences)
|
|
406
|
+
self.csat = resources.CsatResourceWithRawResponse(client.csat)
|
|
402
407
|
|
|
403
408
|
|
|
404
409
|
class AsyncPayiWithRawResponse:
|
|
@@ -407,6 +412,7 @@ class AsyncPayiWithRawResponse:
|
|
|
407
412
|
self.ingest = resources.AsyncIngestResourceWithRawResponse(client.ingest)
|
|
408
413
|
self.categories = resources.AsyncCategoriesResourceWithRawResponse(client.categories)
|
|
409
414
|
self.experiences = resources.AsyncExperiencesResourceWithRawResponse(client.experiences)
|
|
415
|
+
self.csat = resources.AsyncCsatResourceWithRawResponse(client.csat)
|
|
410
416
|
|
|
411
417
|
|
|
412
418
|
class PayiWithStreamedResponse:
|
|
@@ -415,6 +421,7 @@ class PayiWithStreamedResponse:
|
|
|
415
421
|
self.ingest = resources.IngestResourceWithStreamingResponse(client.ingest)
|
|
416
422
|
self.categories = resources.CategoriesResourceWithStreamingResponse(client.categories)
|
|
417
423
|
self.experiences = resources.ExperiencesResourceWithStreamingResponse(client.experiences)
|
|
424
|
+
self.csat = resources.CsatResourceWithStreamingResponse(client.csat)
|
|
418
425
|
|
|
419
426
|
|
|
420
427
|
class AsyncPayiWithStreamedResponse:
|
|
@@ -423,6 +430,7 @@ class AsyncPayiWithStreamedResponse:
|
|
|
423
430
|
self.ingest = resources.AsyncIngestResourceWithStreamingResponse(client.ingest)
|
|
424
431
|
self.categories = resources.AsyncCategoriesResourceWithStreamingResponse(client.categories)
|
|
425
432
|
self.experiences = resources.AsyncExperiencesResourceWithStreamingResponse(client.experiences)
|
|
433
|
+
self.csat = resources.AsyncCsatResourceWithStreamingResponse(client.csat)
|
|
426
434
|
|
|
427
435
|
|
|
428
436
|
Client = Payi
|
payi/_compat.py
CHANGED
|
@@ -136,12 +136,14 @@ def model_dump(
|
|
|
136
136
|
exclude: IncEx = None,
|
|
137
137
|
exclude_unset: bool = False,
|
|
138
138
|
exclude_defaults: bool = False,
|
|
139
|
+
warnings: bool = True,
|
|
139
140
|
) -> dict[str, Any]:
|
|
140
141
|
if PYDANTIC_V2:
|
|
141
142
|
return model.model_dump(
|
|
142
143
|
exclude=exclude,
|
|
143
144
|
exclude_unset=exclude_unset,
|
|
144
145
|
exclude_defaults=exclude_defaults,
|
|
146
|
+
warnings=warnings,
|
|
145
147
|
)
|
|
146
148
|
return cast(
|
|
147
149
|
"dict[str, Any]",
|
payi/_utils/_utils.py
CHANGED
|
@@ -363,12 +363,13 @@ def file_from_path(path: str) -> FileTypes:
|
|
|
363
363
|
|
|
364
364
|
def get_required_header(headers: HeadersLike, header: str) -> str:
|
|
365
365
|
lower_header = header.lower()
|
|
366
|
-
if
|
|
367
|
-
|
|
366
|
+
if is_mapping_t(headers):
|
|
367
|
+
# mypy doesn't understand the type narrowing here
|
|
368
|
+
for k, v in headers.items(): # type: ignore
|
|
368
369
|
if k.lower() == lower_header and isinstance(v, str):
|
|
369
370
|
return v
|
|
370
371
|
|
|
371
|
-
|
|
372
|
+
# to deal with the case where the header looks like Stainless-Event-Id
|
|
372
373
|
intercaps_header = re.sub(r"([^\w])(\w)", lambda pat: pat.group(1) + pat.group(2).upper(), header.capitalize())
|
|
373
374
|
|
|
374
375
|
for normalized_header in [header, lower_header, header.upper(), intercaps_header]:
|
payi/_version.py
CHANGED
payi/resources/__init__.py
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
from .csat import (
|
|
4
|
+
CsatResource,
|
|
5
|
+
AsyncCsatResource,
|
|
6
|
+
CsatResourceWithRawResponse,
|
|
7
|
+
AsyncCsatResourceWithRawResponse,
|
|
8
|
+
CsatResourceWithStreamingResponse,
|
|
9
|
+
AsyncCsatResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
3
11
|
from .ingest import (
|
|
4
12
|
IngestResource,
|
|
5
13
|
AsyncIngestResource,
|
|
@@ -58,4 +66,10 @@ __all__ = [
|
|
|
58
66
|
"AsyncExperiencesResourceWithRawResponse",
|
|
59
67
|
"ExperiencesResourceWithStreamingResponse",
|
|
60
68
|
"AsyncExperiencesResourceWithStreamingResponse",
|
|
69
|
+
"CsatResource",
|
|
70
|
+
"AsyncCsatResource",
|
|
71
|
+
"CsatResourceWithRawResponse",
|
|
72
|
+
"AsyncCsatResourceWithRawResponse",
|
|
73
|
+
"CsatResourceWithStreamingResponse",
|
|
74
|
+
"AsyncCsatResourceWithStreamingResponse",
|
|
61
75
|
]
|
|
@@ -45,10 +45,21 @@ class BudgetsResource(SyncAPIResource):
|
|
|
45
45
|
|
|
46
46
|
@cached_property
|
|
47
47
|
def with_raw_response(self) -> BudgetsResourceWithRawResponse:
|
|
48
|
+
"""
|
|
49
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
50
|
+
the raw response object instead of the parsed content.
|
|
51
|
+
|
|
52
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
53
|
+
"""
|
|
48
54
|
return BudgetsResourceWithRawResponse(self)
|
|
49
55
|
|
|
50
56
|
@cached_property
|
|
51
57
|
def with_streaming_response(self) -> BudgetsResourceWithStreamingResponse:
|
|
58
|
+
"""
|
|
59
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
60
|
+
|
|
61
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
62
|
+
"""
|
|
52
63
|
return BudgetsResourceWithStreamingResponse(self)
|
|
53
64
|
|
|
54
65
|
def create(
|
|
@@ -297,10 +308,21 @@ class AsyncBudgetsResource(AsyncAPIResource):
|
|
|
297
308
|
|
|
298
309
|
@cached_property
|
|
299
310
|
def with_raw_response(self) -> AsyncBudgetsResourceWithRawResponse:
|
|
311
|
+
"""
|
|
312
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
313
|
+
the raw response object instead of the parsed content.
|
|
314
|
+
|
|
315
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
316
|
+
"""
|
|
300
317
|
return AsyncBudgetsResourceWithRawResponse(self)
|
|
301
318
|
|
|
302
319
|
@cached_property
|
|
303
320
|
def with_streaming_response(self) -> AsyncBudgetsResourceWithStreamingResponse:
|
|
321
|
+
"""
|
|
322
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
323
|
+
|
|
324
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
325
|
+
"""
|
|
304
326
|
return AsyncBudgetsResourceWithStreamingResponse(self)
|
|
305
327
|
|
|
306
328
|
async def create(
|
payi/resources/budgets/tags.py
CHANGED
|
@@ -33,10 +33,21 @@ __all__ = ["TagsResource", "AsyncTagsResource"]
|
|
|
33
33
|
class TagsResource(SyncAPIResource):
|
|
34
34
|
@cached_property
|
|
35
35
|
def with_raw_response(self) -> TagsResourceWithRawResponse:
|
|
36
|
+
"""
|
|
37
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
38
|
+
the raw response object instead of the parsed content.
|
|
39
|
+
|
|
40
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
41
|
+
"""
|
|
36
42
|
return TagsResourceWithRawResponse(self)
|
|
37
43
|
|
|
38
44
|
@cached_property
|
|
39
45
|
def with_streaming_response(self) -> TagsResourceWithStreamingResponse:
|
|
46
|
+
"""
|
|
47
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
48
|
+
|
|
49
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
50
|
+
"""
|
|
40
51
|
return TagsResourceWithStreamingResponse(self)
|
|
41
52
|
|
|
42
53
|
def create(
|
|
@@ -214,10 +225,21 @@ class TagsResource(SyncAPIResource):
|
|
|
214
225
|
class AsyncTagsResource(AsyncAPIResource):
|
|
215
226
|
@cached_property
|
|
216
227
|
def with_raw_response(self) -> AsyncTagsResourceWithRawResponse:
|
|
228
|
+
"""
|
|
229
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
230
|
+
the raw response object instead of the parsed content.
|
|
231
|
+
|
|
232
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
233
|
+
"""
|
|
217
234
|
return AsyncTagsResourceWithRawResponse(self)
|
|
218
235
|
|
|
219
236
|
@cached_property
|
|
220
237
|
def with_streaming_response(self) -> AsyncTagsResourceWithStreamingResponse:
|
|
238
|
+
"""
|
|
239
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
240
|
+
|
|
241
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
242
|
+
"""
|
|
221
243
|
return AsyncTagsResourceWithStreamingResponse(self)
|
|
222
244
|
|
|
223
245
|
async def create(
|
|
@@ -37,10 +37,21 @@ class CategoriesResource(SyncAPIResource):
|
|
|
37
37
|
|
|
38
38
|
@cached_property
|
|
39
39
|
def with_raw_response(self) -> CategoriesResourceWithRawResponse:
|
|
40
|
+
"""
|
|
41
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
42
|
+
the raw response object instead of the parsed content.
|
|
43
|
+
|
|
44
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
45
|
+
"""
|
|
40
46
|
return CategoriesResourceWithRawResponse(self)
|
|
41
47
|
|
|
42
48
|
@cached_property
|
|
43
49
|
def with_streaming_response(self) -> CategoriesResourceWithStreamingResponse:
|
|
50
|
+
"""
|
|
51
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
52
|
+
|
|
53
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
54
|
+
"""
|
|
44
55
|
return CategoriesResourceWithStreamingResponse(self)
|
|
45
56
|
|
|
46
57
|
def list(
|
|
@@ -172,10 +183,21 @@ class AsyncCategoriesResource(AsyncAPIResource):
|
|
|
172
183
|
|
|
173
184
|
@cached_property
|
|
174
185
|
def with_raw_response(self) -> AsyncCategoriesResourceWithRawResponse:
|
|
186
|
+
"""
|
|
187
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
188
|
+
the raw response object instead of the parsed content.
|
|
189
|
+
|
|
190
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
191
|
+
"""
|
|
175
192
|
return AsyncCategoriesResourceWithRawResponse(self)
|
|
176
193
|
|
|
177
194
|
@cached_property
|
|
178
195
|
def with_streaming_response(self) -> AsyncCategoriesResourceWithStreamingResponse:
|
|
196
|
+
"""
|
|
197
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
198
|
+
|
|
199
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
200
|
+
"""
|
|
179
201
|
return AsyncCategoriesResourceWithStreamingResponse(self)
|
|
180
202
|
|
|
181
203
|
async def list(
|
|
@@ -31,10 +31,21 @@ __all__ = ["ResourcesResource", "AsyncResourcesResource"]
|
|
|
31
31
|
class ResourcesResource(SyncAPIResource):
|
|
32
32
|
@cached_property
|
|
33
33
|
def with_raw_response(self) -> ResourcesResourceWithRawResponse:
|
|
34
|
+
"""
|
|
35
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
36
|
+
the raw response object instead of the parsed content.
|
|
37
|
+
|
|
38
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
39
|
+
"""
|
|
34
40
|
return ResourcesResourceWithRawResponse(self)
|
|
35
41
|
|
|
36
42
|
@cached_property
|
|
37
43
|
def with_streaming_response(self) -> ResourcesResourceWithStreamingResponse:
|
|
44
|
+
"""
|
|
45
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
46
|
+
|
|
47
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
48
|
+
"""
|
|
38
49
|
return ResourcesResourceWithStreamingResponse(self)
|
|
39
50
|
|
|
40
51
|
def create(
|
|
@@ -45,6 +56,7 @@ class ResourcesResource(SyncAPIResource):
|
|
|
45
56
|
input_price: float | NotGiven = NOT_GIVEN,
|
|
46
57
|
max_input_units: int | NotGiven = NOT_GIVEN,
|
|
47
58
|
max_output_units: int | NotGiven = NOT_GIVEN,
|
|
59
|
+
max_total_units: int | NotGiven = NOT_GIVEN,
|
|
48
60
|
output_price: float | NotGiven = NOT_GIVEN,
|
|
49
61
|
start_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
50
62
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -77,6 +89,7 @@ class ResourcesResource(SyncAPIResource):
|
|
|
77
89
|
"input_price": input_price,
|
|
78
90
|
"max_input_units": max_input_units,
|
|
79
91
|
"max_output_units": max_output_units,
|
|
92
|
+
"max_total_units": max_total_units,
|
|
80
93
|
"output_price": output_price,
|
|
81
94
|
"start_timestamp": start_timestamp,
|
|
82
95
|
},
|
|
@@ -206,10 +219,21 @@ class ResourcesResource(SyncAPIResource):
|
|
|
206
219
|
class AsyncResourcesResource(AsyncAPIResource):
|
|
207
220
|
@cached_property
|
|
208
221
|
def with_raw_response(self) -> AsyncResourcesResourceWithRawResponse:
|
|
222
|
+
"""
|
|
223
|
+
This property can be used as a prefix for any HTTP method call to return the
|
|
224
|
+
the raw response object instead of the parsed content.
|
|
225
|
+
|
|
226
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
|
|
227
|
+
"""
|
|
209
228
|
return AsyncResourcesResourceWithRawResponse(self)
|
|
210
229
|
|
|
211
230
|
@cached_property
|
|
212
231
|
def with_streaming_response(self) -> AsyncResourcesResourceWithStreamingResponse:
|
|
232
|
+
"""
|
|
233
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
234
|
+
|
|
235
|
+
For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
|
|
236
|
+
"""
|
|
213
237
|
return AsyncResourcesResourceWithStreamingResponse(self)
|
|
214
238
|
|
|
215
239
|
async def create(
|
|
@@ -220,6 +244,7 @@ class AsyncResourcesResource(AsyncAPIResource):
|
|
|
220
244
|
input_price: float | NotGiven = NOT_GIVEN,
|
|
221
245
|
max_input_units: int | NotGiven = NOT_GIVEN,
|
|
222
246
|
max_output_units: int | NotGiven = NOT_GIVEN,
|
|
247
|
+
max_total_units: int | NotGiven = NOT_GIVEN,
|
|
223
248
|
output_price: float | NotGiven = NOT_GIVEN,
|
|
224
249
|
start_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
225
250
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -252,6 +277,7 @@ class AsyncResourcesResource(AsyncAPIResource):
|
|
|
252
277
|
"input_price": input_price,
|
|
253
278
|
"max_input_units": max_input_units,
|
|
254
279
|
"max_output_units": max_output_units,
|
|
280
|
+
"max_total_units": max_total_units,
|
|
255
281
|
"output_price": output_price,
|
|
256
282
|
"start_timestamp": start_timestamp,
|
|
257
283
|
},
|