payi 0.1.0a33__py3-none-any.whl → 0.1.0a35__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 +6 -0
- payi/_client.py +9 -9
- payi/_models.py +5 -1
- payi/_version.py +1 -1
- payi/lib/helpers.py +11 -8
- payi/resources/__init__.py +13 -13
- payi/resources/billing_models.py +4 -4
- payi/resources/experiences/__init__.py +0 -14
- payi/resources/experiences/experiences.py +0 -32
- payi/resources/experiences/properties.py +5 -5
- payi/resources/ingest.py +49 -23
- payi/resources/{budgets → limits}/__init__.py +13 -13
- payi/resources/{budgets/budgets.py → limits/limits.py} +213 -196
- payi/resources/{budgets → limits}/tags.py +68 -68
- payi/resources/requests/properties.py +5 -5
- payi/types/__init__.py +8 -6
- payi/types/billing_model.py +1 -1
- payi/types/billing_model_create_params.py +1 -1
- payi/types/billing_model_update_params.py +1 -1
- payi/types/category_resource_response.py +4 -0
- payi/types/experiences/__init__.py +0 -2
- payi/types/experiences/property_create_params.py +2 -2
- payi/types/ingest_event_param.py +29 -5
- payi/types/ingest_response.py +7 -7
- payi/types/ingest_units_params.py +28 -4
- payi/types/{budget_create_params.py → limit_create_params.py} +7 -9
- payi/types/limit_history_response.py +34 -0
- payi/types/{budget_list_params.py → limit_list_params.py} +3 -3
- payi/types/limit_reset_params.py +16 -0
- payi/types/{budget_response.py → limit_response.py} +11 -13
- payi/types/{budget_update_params.py → limit_update_params.py} +3 -3
- payi/types/{budgets → limits}/__init__.py +1 -1
- payi/types/{budgets/budget_tags.py → limits/limit_tags.py} +2 -2
- payi/types/{budgets → limits}/tag_create_params.py +1 -1
- payi/types/{budgets → limits}/tag_create_response.py +2 -2
- payi/types/{budgets → limits}/tag_delete_response.py +2 -2
- payi/types/{budgets → limits}/tag_list_response.py +2 -2
- payi/types/{budgets → limits}/tag_remove_params.py +1 -1
- payi/types/{budgets → limits}/tag_remove_response.py +2 -2
- payi/types/{budgets → limits}/tag_update_params.py +1 -1
- payi/types/{budgets → limits}/tag_update_response.py +2 -2
- payi/types/{paged_budget_list.py → paged_limit_list.py} +9 -11
- payi/types/requests/property_create_params.py +2 -2
- payi/types/shared/__init__.py +3 -0
- payi/types/{experiences/csat_response.py → shared/evaluation_response.py} +3 -2
- {payi-0.1.0a33.dist-info → payi-0.1.0a35.dist-info}/METADATA +22 -23
- {payi-0.1.0a33.dist-info → payi-0.1.0a35.dist-info}/RECORD +49 -49
- {payi-0.1.0a33.dist-info → payi-0.1.0a35.dist-info}/licenses/LICENSE +1 -1
- payi/resources/experiences/csat.py +0 -188
- payi/types/budget_history_response.py +0 -38
- payi/types/experiences/csat_create_params.py +0 -14
- {payi-0.1.0a33.dist-info → payi-0.1.0a35.dist-info}/WHEEL +0 -0
payi/_base_client.py
CHANGED
|
@@ -767,6 +767,9 @@ else:
|
|
|
767
767
|
|
|
768
768
|
class SyncHttpxClientWrapper(DefaultHttpxClient):
|
|
769
769
|
def __del__(self) -> None:
|
|
770
|
+
if self.is_closed:
|
|
771
|
+
return
|
|
772
|
+
|
|
770
773
|
try:
|
|
771
774
|
self.close()
|
|
772
775
|
except Exception:
|
|
@@ -1334,6 +1337,9 @@ else:
|
|
|
1334
1337
|
|
|
1335
1338
|
class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):
|
|
1336
1339
|
def __del__(self) -> None:
|
|
1340
|
+
if self.is_closed:
|
|
1341
|
+
return
|
|
1342
|
+
|
|
1337
1343
|
try:
|
|
1338
1344
|
# TODO(someday): support non asyncio runtimes here
|
|
1339
1345
|
asyncio.get_running_loop().create_task(self.aclose())
|
payi/_client.py
CHANGED
|
@@ -32,7 +32,7 @@ from ._base_client import (
|
|
|
32
32
|
SyncAPIClient,
|
|
33
33
|
AsyncAPIClient,
|
|
34
34
|
)
|
|
35
|
-
from .resources.
|
|
35
|
+
from .resources.limits import limits
|
|
36
36
|
from .resources.requests import requests
|
|
37
37
|
from .resources.categories import categories
|
|
38
38
|
from .resources.experiences import experiences
|
|
@@ -41,7 +41,7 @@ __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Payi", "As
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
class Payi(SyncAPIClient):
|
|
44
|
-
|
|
44
|
+
limits: limits.LimitsResource
|
|
45
45
|
ingest: ingest.IngestResource
|
|
46
46
|
categories: categories.CategoriesResource
|
|
47
47
|
experiences: experiences.ExperiencesResource
|
|
@@ -105,7 +105,7 @@ class Payi(SyncAPIClient):
|
|
|
105
105
|
_strict_response_validation=_strict_response_validation,
|
|
106
106
|
)
|
|
107
107
|
|
|
108
|
-
self.
|
|
108
|
+
self.limits = limits.LimitsResource(self)
|
|
109
109
|
self.ingest = ingest.IngestResource(self)
|
|
110
110
|
self.categories = categories.CategoriesResource(self)
|
|
111
111
|
self.experiences = experiences.ExperiencesResource(self)
|
|
@@ -221,7 +221,7 @@ class Payi(SyncAPIClient):
|
|
|
221
221
|
|
|
222
222
|
|
|
223
223
|
class AsyncPayi(AsyncAPIClient):
|
|
224
|
-
|
|
224
|
+
limits: limits.AsyncLimitsResource
|
|
225
225
|
ingest: ingest.AsyncIngestResource
|
|
226
226
|
categories: categories.AsyncCategoriesResource
|
|
227
227
|
experiences: experiences.AsyncExperiencesResource
|
|
@@ -285,7 +285,7 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
285
285
|
_strict_response_validation=_strict_response_validation,
|
|
286
286
|
)
|
|
287
287
|
|
|
288
|
-
self.
|
|
288
|
+
self.limits = limits.AsyncLimitsResource(self)
|
|
289
289
|
self.ingest = ingest.AsyncIngestResource(self)
|
|
290
290
|
self.categories = categories.AsyncCategoriesResource(self)
|
|
291
291
|
self.experiences = experiences.AsyncExperiencesResource(self)
|
|
@@ -402,7 +402,7 @@ class AsyncPayi(AsyncAPIClient):
|
|
|
402
402
|
|
|
403
403
|
class PayiWithRawResponse:
|
|
404
404
|
def __init__(self, client: Payi) -> None:
|
|
405
|
-
self.
|
|
405
|
+
self.limits = limits.LimitsResourceWithRawResponse(client.limits)
|
|
406
406
|
self.ingest = ingest.IngestResourceWithRawResponse(client.ingest)
|
|
407
407
|
self.categories = categories.CategoriesResourceWithRawResponse(client.categories)
|
|
408
408
|
self.experiences = experiences.ExperiencesResourceWithRawResponse(client.experiences)
|
|
@@ -413,7 +413,7 @@ class PayiWithRawResponse:
|
|
|
413
413
|
|
|
414
414
|
class AsyncPayiWithRawResponse:
|
|
415
415
|
def __init__(self, client: AsyncPayi) -> None:
|
|
416
|
-
self.
|
|
416
|
+
self.limits = limits.AsyncLimitsResourceWithRawResponse(client.limits)
|
|
417
417
|
self.ingest = ingest.AsyncIngestResourceWithRawResponse(client.ingest)
|
|
418
418
|
self.categories = categories.AsyncCategoriesResourceWithRawResponse(client.categories)
|
|
419
419
|
self.experiences = experiences.AsyncExperiencesResourceWithRawResponse(client.experiences)
|
|
@@ -424,7 +424,7 @@ class AsyncPayiWithRawResponse:
|
|
|
424
424
|
|
|
425
425
|
class PayiWithStreamedResponse:
|
|
426
426
|
def __init__(self, client: Payi) -> None:
|
|
427
|
-
self.
|
|
427
|
+
self.limits = limits.LimitsResourceWithStreamingResponse(client.limits)
|
|
428
428
|
self.ingest = ingest.IngestResourceWithStreamingResponse(client.ingest)
|
|
429
429
|
self.categories = categories.CategoriesResourceWithStreamingResponse(client.categories)
|
|
430
430
|
self.experiences = experiences.ExperiencesResourceWithStreamingResponse(client.experiences)
|
|
@@ -435,7 +435,7 @@ class PayiWithStreamedResponse:
|
|
|
435
435
|
|
|
436
436
|
class AsyncPayiWithStreamedResponse:
|
|
437
437
|
def __init__(self, client: AsyncPayi) -> None:
|
|
438
|
-
self.
|
|
438
|
+
self.limits = limits.AsyncLimitsResourceWithStreamingResponse(client.limits)
|
|
439
439
|
self.ingest = ingest.AsyncIngestResourceWithStreamingResponse(client.ingest)
|
|
440
440
|
self.categories = categories.AsyncCategoriesResourceWithStreamingResponse(client.categories)
|
|
441
441
|
self.experiences = experiences.AsyncExperiencesResourceWithStreamingResponse(client.experiences)
|
payi/_models.py
CHANGED
|
@@ -488,7 +488,11 @@ def construct_type(*, value: object, type_: object) -> object:
|
|
|
488
488
|
_, items_type = get_args(type_) # Dict[_, items_type]
|
|
489
489
|
return {key: construct_type(value=item, type_=items_type) for key, item in value.items()}
|
|
490
490
|
|
|
491
|
-
if
|
|
491
|
+
if (
|
|
492
|
+
not is_literal_type(type_)
|
|
493
|
+
and inspect.isclass(origin)
|
|
494
|
+
and (issubclass(origin, BaseModel) or issubclass(origin, GenericModel))
|
|
495
|
+
):
|
|
492
496
|
if is_list(value):
|
|
493
497
|
return [cast(Any, type_).construct(**entry) if is_mapping(entry) else entry for entry in value]
|
|
494
498
|
|
payi/_version.py
CHANGED
payi/lib/helpers.py
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
from typing import Dict, List, Union
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
def
|
|
6
|
-
if not isinstance(
|
|
7
|
-
raise TypeError("
|
|
5
|
+
def create_limit_header_from_ids(limit_ids: List[str]) -> Dict[str, str]:
|
|
6
|
+
if not isinstance(limit_ids, list): # type: ignore
|
|
7
|
+
raise TypeError("limit_ids must be a list")
|
|
8
8
|
|
|
9
|
-
valid_ids = [id.strip() for id in
|
|
9
|
+
valid_ids = [id.strip() for id in limit_ids if isinstance(id, str) and id.strip()] # type: ignore
|
|
10
10
|
|
|
11
|
-
return {"xProxy-
|
|
11
|
+
return {"xProxy-Limit-IDs": ",".join(valid_ids)} if valid_ids else {}
|
|
12
12
|
|
|
13
13
|
def create_request_header_from_tags(request_tags: List[str]) -> Dict[str, str]:
|
|
14
14
|
if not isinstance(request_tags, list): # type: ignore
|
|
@@ -19,20 +19,23 @@ def create_request_header_from_tags(request_tags: List[str]) -> Dict[str, str]:
|
|
|
19
19
|
return {"xProxy-Request-Tags": ",".join(valid_tags)} if valid_tags else {}
|
|
20
20
|
|
|
21
21
|
def create_headers(
|
|
22
|
-
|
|
22
|
+
limit_ids: Union[List[str], None] = None,
|
|
23
23
|
request_tags: Union[List[str], None] = None,
|
|
24
24
|
user_id: Union[str, None] = None,
|
|
25
25
|
experience_id: Union[str, None] = None,
|
|
26
|
+
experience_name: Union[str, None] = None,
|
|
26
27
|
) -> Dict[str, str]:
|
|
27
28
|
headers: Dict[str, str] = {}
|
|
28
29
|
|
|
29
|
-
if
|
|
30
|
-
headers.update(
|
|
30
|
+
if limit_ids:
|
|
31
|
+
headers.update(create_limit_header_from_ids(limit_ids))
|
|
31
32
|
if request_tags:
|
|
32
33
|
headers.update(create_request_header_from_tags(request_tags))
|
|
33
34
|
if user_id:
|
|
34
35
|
headers.update({"xProxy-User-ID": user_id})
|
|
35
36
|
if experience_id:
|
|
36
37
|
headers.update({"xProxy-Experience-Id": experience_id})
|
|
38
|
+
if experience_name:
|
|
39
|
+
headers.update({"xProxy-Experience-Name": experience_name})
|
|
37
40
|
|
|
38
41
|
return headers
|
payi/resources/__init__.py
CHANGED
|
@@ -8,13 +8,13 @@ from .ingest import (
|
|
|
8
8
|
IngestResourceWithStreamingResponse,
|
|
9
9
|
AsyncIngestResourceWithStreamingResponse,
|
|
10
10
|
)
|
|
11
|
-
from .
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
from .limits import (
|
|
12
|
+
LimitsResource,
|
|
13
|
+
AsyncLimitsResource,
|
|
14
|
+
LimitsResourceWithRawResponse,
|
|
15
|
+
AsyncLimitsResourceWithRawResponse,
|
|
16
|
+
LimitsResourceWithStreamingResponse,
|
|
17
|
+
AsyncLimitsResourceWithStreamingResponse,
|
|
18
18
|
)
|
|
19
19
|
from .requests import (
|
|
20
20
|
RequestsResource,
|
|
@@ -58,12 +58,12 @@ from .price_modifiers import (
|
|
|
58
58
|
)
|
|
59
59
|
|
|
60
60
|
__all__ = [
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
61
|
+
"LimitsResource",
|
|
62
|
+
"AsyncLimitsResource",
|
|
63
|
+
"LimitsResourceWithRawResponse",
|
|
64
|
+
"AsyncLimitsResourceWithRawResponse",
|
|
65
|
+
"LimitsResourceWithStreamingResponse",
|
|
66
|
+
"AsyncLimitsResourceWithStreamingResponse",
|
|
67
67
|
"IngestResource",
|
|
68
68
|
"AsyncIngestResource",
|
|
69
69
|
"IngestResourceWithRawResponse",
|
payi/resources/billing_models.py
CHANGED
|
@@ -52,7 +52,7 @@ class BillingModelsResource(SyncAPIResource):
|
|
|
52
52
|
self,
|
|
53
53
|
*,
|
|
54
54
|
name: str,
|
|
55
|
-
type: Literal["
|
|
55
|
+
type: Literal["costplus", "subscription", "hybrid"],
|
|
56
56
|
default_price_modifier: Optional[float] | NotGiven = NOT_GIVEN,
|
|
57
57
|
prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
|
|
58
58
|
prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
|
|
@@ -128,7 +128,7 @@ class BillingModelsResource(SyncAPIResource):
|
|
|
128
128
|
self,
|
|
129
129
|
billing_model_id: str,
|
|
130
130
|
*,
|
|
131
|
-
type: Literal["
|
|
131
|
+
type: Literal["costplus", "subscription", "hybrid"],
|
|
132
132
|
default_price_modifier: Optional[float] | NotGiven = NOT_GIVEN,
|
|
133
133
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
134
134
|
prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
|
|
@@ -246,7 +246,7 @@ class AsyncBillingModelsResource(AsyncAPIResource):
|
|
|
246
246
|
self,
|
|
247
247
|
*,
|
|
248
248
|
name: str,
|
|
249
|
-
type: Literal["
|
|
249
|
+
type: Literal["costplus", "subscription", "hybrid"],
|
|
250
250
|
default_price_modifier: Optional[float] | NotGiven = NOT_GIVEN,
|
|
251
251
|
prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
|
|
252
252
|
prepaid_max: Optional[float] | NotGiven = NOT_GIVEN,
|
|
@@ -322,7 +322,7 @@ class AsyncBillingModelsResource(AsyncAPIResource):
|
|
|
322
322
|
self,
|
|
323
323
|
billing_model_id: str,
|
|
324
324
|
*,
|
|
325
|
-
type: Literal["
|
|
325
|
+
type: Literal["costplus", "subscription", "hybrid"],
|
|
326
326
|
default_price_modifier: Optional[float] | NotGiven = NOT_GIVEN,
|
|
327
327
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
328
328
|
prepaid_amount: Optional[float] | NotGiven = NOT_GIVEN,
|
|
@@ -1,13 +1,5 @@
|
|
|
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
|
-
)
|
|
11
3
|
from .types import (
|
|
12
4
|
TypesResource,
|
|
13
5
|
AsyncTypesResource,
|
|
@@ -40,12 +32,6 @@ __all__ = [
|
|
|
40
32
|
"AsyncTypesResourceWithRawResponse",
|
|
41
33
|
"TypesResourceWithStreamingResponse",
|
|
42
34
|
"AsyncTypesResourceWithStreamingResponse",
|
|
43
|
-
"CsatResource",
|
|
44
|
-
"AsyncCsatResource",
|
|
45
|
-
"CsatResourceWithRawResponse",
|
|
46
|
-
"AsyncCsatResourceWithRawResponse",
|
|
47
|
-
"CsatResourceWithStreamingResponse",
|
|
48
|
-
"AsyncCsatResourceWithStreamingResponse",
|
|
49
35
|
"PropertiesResource",
|
|
50
36
|
"AsyncPropertiesResource",
|
|
51
37
|
"PropertiesResourceWithRawResponse",
|
|
@@ -4,14 +4,6 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import httpx
|
|
6
6
|
|
|
7
|
-
from .csat import (
|
|
8
|
-
CsatResource,
|
|
9
|
-
AsyncCsatResource,
|
|
10
|
-
CsatResourceWithRawResponse,
|
|
11
|
-
AsyncCsatResourceWithRawResponse,
|
|
12
|
-
CsatResourceWithStreamingResponse,
|
|
13
|
-
AsyncCsatResourceWithStreamingResponse,
|
|
14
|
-
)
|
|
15
7
|
from .types import (
|
|
16
8
|
TypesResource,
|
|
17
9
|
AsyncTypesResource,
|
|
@@ -48,10 +40,6 @@ class ExperiencesResource(SyncAPIResource):
|
|
|
48
40
|
def types(self) -> TypesResource:
|
|
49
41
|
return TypesResource(self._client)
|
|
50
42
|
|
|
51
|
-
@cached_property
|
|
52
|
-
def csat(self) -> CsatResource:
|
|
53
|
-
return CsatResource(self._client)
|
|
54
|
-
|
|
55
43
|
@cached_property
|
|
56
44
|
def properties(self) -> PropertiesResource:
|
|
57
45
|
return PropertiesResource(self._client)
|
|
@@ -180,10 +168,6 @@ class AsyncExperiencesResource(AsyncAPIResource):
|
|
|
180
168
|
def types(self) -> AsyncTypesResource:
|
|
181
169
|
return AsyncTypesResource(self._client)
|
|
182
170
|
|
|
183
|
-
@cached_property
|
|
184
|
-
def csat(self) -> AsyncCsatResource:
|
|
185
|
-
return AsyncCsatResource(self._client)
|
|
186
|
-
|
|
187
171
|
@cached_property
|
|
188
172
|
def properties(self) -> AsyncPropertiesResource:
|
|
189
173
|
return AsyncPropertiesResource(self._client)
|
|
@@ -325,10 +309,6 @@ class ExperiencesResourceWithRawResponse:
|
|
|
325
309
|
def types(self) -> TypesResourceWithRawResponse:
|
|
326
310
|
return TypesResourceWithRawResponse(self._experiences.types)
|
|
327
311
|
|
|
328
|
-
@cached_property
|
|
329
|
-
def csat(self) -> CsatResourceWithRawResponse:
|
|
330
|
-
return CsatResourceWithRawResponse(self._experiences.csat)
|
|
331
|
-
|
|
332
312
|
@cached_property
|
|
333
313
|
def properties(self) -> PropertiesResourceWithRawResponse:
|
|
334
314
|
return PropertiesResourceWithRawResponse(self._experiences.properties)
|
|
@@ -352,10 +332,6 @@ class AsyncExperiencesResourceWithRawResponse:
|
|
|
352
332
|
def types(self) -> AsyncTypesResourceWithRawResponse:
|
|
353
333
|
return AsyncTypesResourceWithRawResponse(self._experiences.types)
|
|
354
334
|
|
|
355
|
-
@cached_property
|
|
356
|
-
def csat(self) -> AsyncCsatResourceWithRawResponse:
|
|
357
|
-
return AsyncCsatResourceWithRawResponse(self._experiences.csat)
|
|
358
|
-
|
|
359
335
|
@cached_property
|
|
360
336
|
def properties(self) -> AsyncPropertiesResourceWithRawResponse:
|
|
361
337
|
return AsyncPropertiesResourceWithRawResponse(self._experiences.properties)
|
|
@@ -379,10 +355,6 @@ class ExperiencesResourceWithStreamingResponse:
|
|
|
379
355
|
def types(self) -> TypesResourceWithStreamingResponse:
|
|
380
356
|
return TypesResourceWithStreamingResponse(self._experiences.types)
|
|
381
357
|
|
|
382
|
-
@cached_property
|
|
383
|
-
def csat(self) -> CsatResourceWithStreamingResponse:
|
|
384
|
-
return CsatResourceWithStreamingResponse(self._experiences.csat)
|
|
385
|
-
|
|
386
358
|
@cached_property
|
|
387
359
|
def properties(self) -> PropertiesResourceWithStreamingResponse:
|
|
388
360
|
return PropertiesResourceWithStreamingResponse(self._experiences.properties)
|
|
@@ -406,10 +378,6 @@ class AsyncExperiencesResourceWithStreamingResponse:
|
|
|
406
378
|
def types(self) -> AsyncTypesResourceWithStreamingResponse:
|
|
407
379
|
return AsyncTypesResourceWithStreamingResponse(self._experiences.types)
|
|
408
380
|
|
|
409
|
-
@cached_property
|
|
410
|
-
def csat(self) -> AsyncCsatResourceWithStreamingResponse:
|
|
411
|
-
return AsyncCsatResourceWithStreamingResponse(self._experiences.csat)
|
|
412
|
-
|
|
413
381
|
@cached_property
|
|
414
382
|
def properties(self) -> AsyncPropertiesResourceWithStreamingResponse:
|
|
415
383
|
return AsyncPropertiesResourceWithStreamingResponse(self._experiences.properties)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict
|
|
5
|
+
from typing import Dict
|
|
6
6
|
|
|
7
7
|
import httpx
|
|
8
8
|
|
|
@@ -50,7 +50,7 @@ class PropertiesResource(SyncAPIResource):
|
|
|
50
50
|
self,
|
|
51
51
|
experience_id: str,
|
|
52
52
|
*,
|
|
53
|
-
properties:
|
|
53
|
+
properties: Dict[str, str],
|
|
54
54
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
55
55
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
56
56
|
extra_headers: Headers | None = None,
|
|
@@ -59,7 +59,7 @@ class PropertiesResource(SyncAPIResource):
|
|
|
59
59
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
60
60
|
) -> ExperienceInstanceResponse:
|
|
61
61
|
"""
|
|
62
|
-
Update
|
|
62
|
+
Update Experience properties
|
|
63
63
|
|
|
64
64
|
Args:
|
|
65
65
|
extra_headers: Send extra headers
|
|
@@ -106,7 +106,7 @@ class AsyncPropertiesResource(AsyncAPIResource):
|
|
|
106
106
|
self,
|
|
107
107
|
experience_id: str,
|
|
108
108
|
*,
|
|
109
|
-
properties:
|
|
109
|
+
properties: Dict[str, str],
|
|
110
110
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
111
111
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
112
112
|
extra_headers: Headers | None = None,
|
|
@@ -115,7 +115,7 @@ class AsyncPropertiesResource(AsyncAPIResource):
|
|
|
115
115
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
116
116
|
) -> ExperienceInstanceResponse:
|
|
117
117
|
"""
|
|
118
|
-
Update
|
|
118
|
+
Update Experience properties
|
|
119
119
|
|
|
120
120
|
Args:
|
|
121
121
|
extra_headers: Send extra headers
|
payi/resources/ingest.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict, Union, Iterable, Optional
|
|
5
|
+
from typing import Dict, List, Union, Iterable, Optional
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
@@ -93,10 +93,17 @@ class IngestResource(SyncAPIResource):
|
|
|
93
93
|
units: Dict[str, ingest_units_params.Units],
|
|
94
94
|
end_to_end_latency_ms: Optional[int] | NotGiven = NOT_GIVEN,
|
|
95
95
|
event_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
96
|
+
experience_properties: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
96
97
|
http_status_code: Optional[int] | NotGiven = NOT_GIVEN,
|
|
97
|
-
|
|
98
|
+
properties: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
99
|
+
provider_request_headers: Optional[Iterable[ingest_units_params.ProviderRequestHeader]] | NotGiven = NOT_GIVEN,
|
|
100
|
+
provider_request_json: Optional[str] | NotGiven = NOT_GIVEN,
|
|
101
|
+
provider_response_headers: Optional[Iterable[ingest_units_params.ProviderResponseHeader]]
|
|
102
|
+
| NotGiven = NOT_GIVEN,
|
|
103
|
+
provider_response_json: Union[str, List[str], None] | NotGiven = NOT_GIVEN,
|
|
104
|
+
provider_uri: Optional[str] | NotGiven = NOT_GIVEN,
|
|
98
105
|
time_to_first_token_ms: Optional[int] | NotGiven = NOT_GIVEN,
|
|
99
|
-
|
|
106
|
+
limit_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
|
|
100
107
|
request_tags: Union[list[str], None] | NotGiven = NOT_GIVEN,
|
|
101
108
|
experience_id: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
102
109
|
experience_name: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
@@ -122,7 +129,7 @@ class IngestResource(SyncAPIResource):
|
|
|
122
129
|
|
|
123
130
|
event_timestamp: (str, datetime, None): The timestamp of the event. Defaults to None.
|
|
124
131
|
|
|
125
|
-
|
|
132
|
+
limit_ids (list[str], optional): The limit IDs to associate with the request. Defaults to None.
|
|
126
133
|
|
|
127
134
|
request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
|
|
128
135
|
|
|
@@ -143,13 +150,13 @@ class IngestResource(SyncAPIResource):
|
|
|
143
150
|
valid_ids_str: str | NotGiven = NOT_GIVEN
|
|
144
151
|
valid_tags_str: str | NotGiven = NOT_GIVEN
|
|
145
152
|
|
|
146
|
-
if
|
|
153
|
+
if limit_ids is None or isinstance(limit_ids, NotGiven):
|
|
147
154
|
valid_ids_str = NOT_GIVEN
|
|
148
|
-
elif not isinstance(
|
|
149
|
-
raise TypeError("
|
|
155
|
+
elif not isinstance(limit_ids, list): # type: ignore
|
|
156
|
+
raise TypeError("limit_ids must be a list")
|
|
150
157
|
else:
|
|
151
|
-
# Proceed with the list comprehension if
|
|
152
|
-
valid_ids = [id.strip() for id in
|
|
158
|
+
# Proceed with the list comprehension if limit_ids is not NotGiven
|
|
159
|
+
valid_ids = [id.strip() for id in limit_ids if id.strip()]
|
|
153
160
|
valid_ids_str = ",".join(valid_ids) if valid_ids else NOT_GIVEN
|
|
154
161
|
|
|
155
162
|
if request_tags is None or isinstance(request_tags, NotGiven):
|
|
@@ -157,7 +164,7 @@ class IngestResource(SyncAPIResource):
|
|
|
157
164
|
elif not isinstance(request_tags, list): # type: ignore
|
|
158
165
|
raise TypeError("request_tags must be a list")
|
|
159
166
|
else:
|
|
160
|
-
# Proceed with the list comprehension if
|
|
167
|
+
# Proceed with the list comprehension if request_tags is not NotGiven
|
|
161
168
|
valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
|
|
162
169
|
valid_tags_str = ",".join(valid_tags) if valid_tags else NOT_GIVEN
|
|
163
170
|
|
|
@@ -173,7 +180,7 @@ class IngestResource(SyncAPIResource):
|
|
|
173
180
|
extra_headers = {
|
|
174
181
|
**strip_not_given(
|
|
175
182
|
{
|
|
176
|
-
"xProxy-
|
|
183
|
+
"xProxy-Limit-IDs": valid_ids_str,
|
|
177
184
|
"xProxy-Request-Tags": valid_tags_str,
|
|
178
185
|
"xProxy-Experience-Id": experience_id,
|
|
179
186
|
"xProxy-Experience-Name": experience_name,
|
|
@@ -191,8 +198,14 @@ class IngestResource(SyncAPIResource):
|
|
|
191
198
|
"units": units,
|
|
192
199
|
"end_to_end_latency_ms": end_to_end_latency_ms,
|
|
193
200
|
"event_timestamp": event_timestamp,
|
|
201
|
+
"experience_properties": experience_properties,
|
|
194
202
|
"http_status_code": http_status_code,
|
|
195
|
-
"
|
|
203
|
+
"properties": properties,
|
|
204
|
+
"provider_request_headers": provider_request_headers,
|
|
205
|
+
"provider_request_json": provider_request_json,
|
|
206
|
+
"provider_response_headers": provider_response_headers,
|
|
207
|
+
"provider_response_json": provider_response_json,
|
|
208
|
+
"provider_uri": provider_uri,
|
|
196
209
|
"time_to_first_token_ms": time_to_first_token_ms,
|
|
197
210
|
},
|
|
198
211
|
ingest_units_params.IngestUnitsParams,
|
|
@@ -266,10 +279,17 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
266
279
|
units: Dict[str, ingest_units_params.Units],
|
|
267
280
|
end_to_end_latency_ms: Optional[int] | NotGiven = NOT_GIVEN,
|
|
268
281
|
event_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
282
|
+
experience_properties: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
269
283
|
http_status_code: Optional[int] | NotGiven = NOT_GIVEN,
|
|
270
|
-
|
|
284
|
+
properties: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
285
|
+
provider_request_headers: Optional[Iterable[ingest_units_params.ProviderRequestHeader]] | NotGiven = NOT_GIVEN,
|
|
286
|
+
provider_request_json: Optional[str] | NotGiven = NOT_GIVEN,
|
|
287
|
+
provider_response_headers: Optional[Iterable[ingest_units_params.ProviderResponseHeader]]
|
|
288
|
+
| NotGiven = NOT_GIVEN,
|
|
289
|
+
provider_response_json: Union[str, List[str], None] | NotGiven = NOT_GIVEN,
|
|
290
|
+
provider_uri: Optional[str] | NotGiven = NOT_GIVEN,
|
|
271
291
|
time_to_first_token_ms: Optional[int] | NotGiven = NOT_GIVEN,
|
|
272
|
-
|
|
292
|
+
limit_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
|
|
273
293
|
request_tags: Union[list[str], None] | NotGiven = NOT_GIVEN,
|
|
274
294
|
experience_name: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
275
295
|
experience_id: Union[str, None] | NotGiven = NOT_GIVEN,
|
|
@@ -294,7 +314,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
294
314
|
|
|
295
315
|
event_timestamp: (datetime, None): The timestamp of the event. Defaults to None.
|
|
296
316
|
|
|
297
|
-
|
|
317
|
+
limit_ids (list[str], optional): The limit IDs to associate with the request. Defaults to None.
|
|
298
318
|
|
|
299
319
|
request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
|
|
300
320
|
|
|
@@ -315,13 +335,13 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
315
335
|
valid_ids_str: str | NotGiven = NOT_GIVEN
|
|
316
336
|
valid_tags_str: str | NotGiven = NOT_GIVEN
|
|
317
337
|
|
|
318
|
-
if
|
|
338
|
+
if limit_ids is None or isinstance(limit_ids, NotGiven):
|
|
319
339
|
valid_ids_str = NOT_GIVEN
|
|
320
|
-
elif not isinstance(
|
|
321
|
-
raise TypeError("
|
|
340
|
+
elif not isinstance(limit_ids, list): # type: ignore
|
|
341
|
+
raise TypeError("limit_ids must be a list")
|
|
322
342
|
else:
|
|
323
|
-
# Proceed with the list comprehension if
|
|
324
|
-
valid_ids = [id.strip() for id in
|
|
343
|
+
# Proceed with the list comprehension if limit_ids is not NotGiven
|
|
344
|
+
valid_ids = [id.strip() for id in limit_ids if id.strip()]
|
|
325
345
|
valid_ids_str = ",".join(valid_ids) if valid_ids else NOT_GIVEN
|
|
326
346
|
|
|
327
347
|
if request_tags is None or isinstance(request_tags, NotGiven):
|
|
@@ -329,7 +349,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
329
349
|
elif not isinstance(request_tags, list): # type: ignore
|
|
330
350
|
raise TypeError("request_tags must be a list")
|
|
331
351
|
else:
|
|
332
|
-
# Proceed with the list comprehension if
|
|
352
|
+
# Proceed with the list comprehension if request_tags is not NotGiven
|
|
333
353
|
valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
|
|
334
354
|
valid_tags_str = ",".join(valid_tags) if valid_tags else NOT_GIVEN
|
|
335
355
|
|
|
@@ -345,7 +365,7 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
345
365
|
extra_headers = {
|
|
346
366
|
**strip_not_given(
|
|
347
367
|
{
|
|
348
|
-
"xProxy-
|
|
368
|
+
"xProxy-Limit-IDs": valid_ids_str,
|
|
349
369
|
"xProxy-Request-Tags": valid_tags_str,
|
|
350
370
|
"xProxy-Experience-Name": experience_name,
|
|
351
371
|
"xProxy-Experience-Id": experience_id,
|
|
@@ -363,8 +383,14 @@ class AsyncIngestResource(AsyncAPIResource):
|
|
|
363
383
|
"units": units,
|
|
364
384
|
"end_to_end_latency_ms": end_to_end_latency_ms,
|
|
365
385
|
"event_timestamp": event_timestamp,
|
|
386
|
+
"experience_properties": experience_properties,
|
|
366
387
|
"http_status_code": http_status_code,
|
|
367
|
-
"
|
|
388
|
+
"properties": properties,
|
|
389
|
+
"provider_request_headers": provider_request_headers,
|
|
390
|
+
"provider_request_json": provider_request_json,
|
|
391
|
+
"provider_response_headers": provider_response_headers,
|
|
392
|
+
"provider_response_json": provider_response_json,
|
|
393
|
+
"provider_uri": provider_uri,
|
|
368
394
|
"time_to_first_token_ms": time_to_first_token_ms,
|
|
369
395
|
},
|
|
370
396
|
ingest_units_params.IngestUnitsParams,
|
|
@@ -8,13 +8,13 @@ from .tags import (
|
|
|
8
8
|
TagsResourceWithStreamingResponse,
|
|
9
9
|
AsyncTagsResourceWithStreamingResponse,
|
|
10
10
|
)
|
|
11
|
-
from .
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
from .limits import (
|
|
12
|
+
LimitsResource,
|
|
13
|
+
AsyncLimitsResource,
|
|
14
|
+
LimitsResourceWithRawResponse,
|
|
15
|
+
AsyncLimitsResourceWithRawResponse,
|
|
16
|
+
LimitsResourceWithStreamingResponse,
|
|
17
|
+
AsyncLimitsResourceWithStreamingResponse,
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
__all__ = [
|
|
@@ -24,10 +24,10 @@ __all__ = [
|
|
|
24
24
|
"AsyncTagsResourceWithRawResponse",
|
|
25
25
|
"TagsResourceWithStreamingResponse",
|
|
26
26
|
"AsyncTagsResourceWithStreamingResponse",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
27
|
+
"LimitsResource",
|
|
28
|
+
"AsyncLimitsResource",
|
|
29
|
+
"LimitsResourceWithRawResponse",
|
|
30
|
+
"AsyncLimitsResourceWithRawResponse",
|
|
31
|
+
"LimitsResourceWithStreamingResponse",
|
|
32
|
+
"AsyncLimitsResourceWithStreamingResponse",
|
|
33
33
|
]
|