payi 0.1.0a25__py3-none-any.whl → 0.1.0a27__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.

Files changed (44) hide show
  1. payi/_base_client.py +13 -3
  2. payi/_client.py +24 -8
  3. payi/_response.py +3 -0
  4. payi/_version.py +1 -1
  5. payi/resources/__init__.py +42 -14
  6. payi/resources/billing_models.py +492 -0
  7. payi/resources/budgets/budgets.py +4 -4
  8. payi/resources/categories/resources.py +9 -9
  9. payi/resources/{evaluations/experiences.py → csat.py} +49 -49
  10. payi/resources/ingest.py +23 -11
  11. payi/resources/price_modifiers.py +353 -0
  12. payi/types/__init__.py +10 -1
  13. payi/types/billing_model.py +29 -0
  14. payi/types/billing_model_create_params.py +20 -0
  15. payi/types/billing_model_list_response.py +10 -0
  16. payi/types/billing_model_update_params.py +20 -0
  17. payi/types/budget_create_params.py +2 -2
  18. payi/types/budget_response.py +2 -2
  19. payi/types/bulk_ingest_response.py +7 -0
  20. payi/types/categories/resource_create_params.py +10 -4
  21. payi/types/category_resource_response.py +10 -4
  22. payi/types/cost_data.py +0 -1
  23. payi/types/{shared/evaluation_response.py → csat.py} +3 -4
  24. payi/types/csat_create_params.py +14 -0
  25. payi/types/experience_instance.py +0 -1
  26. payi/types/experiences/experience_type.py +0 -1
  27. payi/types/ingest_event_param.py +14 -6
  28. payi/types/ingest_response.py +7 -1
  29. payi/types/ingest_units_params.py +13 -6
  30. payi/types/paged_budget_list.py +2 -2
  31. payi/types/price_modifier.py +26 -0
  32. payi/types/price_modifier_create_params.py +17 -0
  33. payi/types/price_modifier_retrieve_response.py +10 -0
  34. payi/types/price_modifier_update_params.py +17 -0
  35. payi/types/requests_data.py +2 -1
  36. payi/types/shared/__init__.py +0 -1
  37. payi/types/total_cost_data.py +0 -1
  38. {payi-0.1.0a25.dist-info → payi-0.1.0a27.dist-info}/METADATA +5 -1
  39. {payi-0.1.0a25.dist-info → payi-0.1.0a27.dist-info}/RECORD +41 -33
  40. payi/resources/evaluations/__init__.py +0 -47
  41. payi/resources/evaluations/evaluations.py +0 -134
  42. payi/resources/evaluations/requests.py +0 -200
  43. {payi-0.1.0a25.dist-info → payi-0.1.0a27.dist-info}/WHEEL +0 -0
  44. {payi-0.1.0a25.dist-info → payi-0.1.0a27.dist-info}/licenses/LICENSE +0 -0
@@ -6,51 +6,51 @@ from typing import Optional
6
6
 
7
7
  import httpx
8
8
 
9
- from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10
- from ..._utils import (
9
+ from ..types import csat_create_params
10
+ from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
11
+ from .._utils import (
11
12
  maybe_transform,
12
13
  async_maybe_transform,
13
14
  )
14
- from ..._compat import cached_property
15
- from ..._resource import SyncAPIResource, AsyncAPIResource
16
- from ..._response import (
15
+ from .._compat import cached_property
16
+ from .._resource import SyncAPIResource, AsyncAPIResource
17
+ from .._response import (
17
18
  to_raw_response_wrapper,
18
19
  to_streamed_response_wrapper,
19
20
  async_to_raw_response_wrapper,
20
21
  async_to_streamed_response_wrapper,
21
22
  )
22
- from ..._base_client import make_request_options
23
- from ...types.evaluations import experience_create_params
24
- from ...types.shared.evaluation_response import EvaluationResponse
23
+ from ..types.csat import Csat
24
+ from .._base_client import make_request_options
25
25
 
26
- __all__ = ["ExperiencesResource", "AsyncExperiencesResource"]
26
+ __all__ = ["CsatResource", "AsyncCsatResource"]
27
27
 
28
28
 
29
- class ExperiencesResource(SyncAPIResource):
29
+ class CsatResource(SyncAPIResource):
30
30
  @cached_property
31
- def with_raw_response(self) -> ExperiencesResourceWithRawResponse:
31
+ def with_raw_response(self) -> CsatResourceWithRawResponse:
32
32
  """
33
33
  This property can be used as a prefix for any HTTP method call to return the
34
34
  the raw response object instead of the parsed content.
35
35
 
36
36
  For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
37
37
  """
38
- return ExperiencesResourceWithRawResponse(self)
38
+ return CsatResourceWithRawResponse(self)
39
39
 
40
40
  @cached_property
41
- def with_streaming_response(self) -> ExperiencesResourceWithStreamingResponse:
41
+ def with_streaming_response(self) -> CsatResourceWithStreamingResponse:
42
42
  """
43
43
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
44
44
 
45
45
  For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
46
46
  """
47
- return ExperiencesResourceWithStreamingResponse(self)
47
+ return CsatResourceWithStreamingResponse(self)
48
48
 
49
49
  def create(
50
50
  self,
51
51
  experience_id: str,
52
52
  *,
53
- evaluation: int,
53
+ csat_rating: int,
54
54
  user_id: Optional[str] | NotGiven = NOT_GIVEN,
55
55
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
56
56
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -58,9 +58,9 @@ class ExperiencesResource(SyncAPIResource):
58
58
  extra_query: Query | None = None,
59
59
  extra_body: Body | None = None,
60
60
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
61
- ) -> EvaluationResponse:
61
+ ) -> Csat:
62
62
  """
63
- Create an Evaluation for an Experience
63
+ Created a CSAT rating for an Experience
64
64
 
65
65
  Args:
66
66
  extra_headers: Send extra headers
@@ -74,46 +74,46 @@ class ExperiencesResource(SyncAPIResource):
74
74
  if not experience_id:
75
75
  raise ValueError(f"Expected a non-empty value for `experience_id` but received {experience_id!r}")
76
76
  return self._post(
77
- f"/api/v1/evaluations/experiences/{experience_id}",
77
+ f"/api/v1/csat/experiences/{experience_id}",
78
78
  body=maybe_transform(
79
79
  {
80
- "evaluation": evaluation,
80
+ "csat_rating": csat_rating,
81
81
  "user_id": user_id,
82
82
  },
83
- experience_create_params.ExperienceCreateParams,
83
+ csat_create_params.CsatCreateParams,
84
84
  ),
85
85
  options=make_request_options(
86
86
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
87
87
  ),
88
- cast_to=EvaluationResponse,
88
+ cast_to=Csat,
89
89
  )
90
90
 
91
91
 
92
- class AsyncExperiencesResource(AsyncAPIResource):
92
+ class AsyncCsatResource(AsyncAPIResource):
93
93
  @cached_property
94
- def with_raw_response(self) -> AsyncExperiencesResourceWithRawResponse:
94
+ def with_raw_response(self) -> AsyncCsatResourceWithRawResponse:
95
95
  """
96
96
  This property can be used as a prefix for any HTTP method call to return the
97
97
  the raw response object instead of the parsed content.
98
98
 
99
99
  For more information, see https://www.github.com/Pay-i/pay-i-python#accessing-raw-response-data-eg-headers
100
100
  """
101
- return AsyncExperiencesResourceWithRawResponse(self)
101
+ return AsyncCsatResourceWithRawResponse(self)
102
102
 
103
103
  @cached_property
104
- def with_streaming_response(self) -> AsyncExperiencesResourceWithStreamingResponse:
104
+ def with_streaming_response(self) -> AsyncCsatResourceWithStreamingResponse:
105
105
  """
106
106
  An alternative to `.with_raw_response` that doesn't eagerly read the response body.
107
107
 
108
108
  For more information, see https://www.github.com/Pay-i/pay-i-python#with_streaming_response
109
109
  """
110
- return AsyncExperiencesResourceWithStreamingResponse(self)
110
+ return AsyncCsatResourceWithStreamingResponse(self)
111
111
 
112
112
  async def create(
113
113
  self,
114
114
  experience_id: str,
115
115
  *,
116
- evaluation: int,
116
+ csat_rating: int,
117
117
  user_id: Optional[str] | NotGiven = NOT_GIVEN,
118
118
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
119
119
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -121,9 +121,9 @@ class AsyncExperiencesResource(AsyncAPIResource):
121
121
  extra_query: Query | None = None,
122
122
  extra_body: Body | None = None,
123
123
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
124
- ) -> EvaluationResponse:
124
+ ) -> Csat:
125
125
  """
126
- Create an Evaluation for an Experience
126
+ Created a CSAT rating for an Experience
127
127
 
128
128
  Args:
129
129
  extra_headers: Send extra headers
@@ -137,52 +137,52 @@ class AsyncExperiencesResource(AsyncAPIResource):
137
137
  if not experience_id:
138
138
  raise ValueError(f"Expected a non-empty value for `experience_id` but received {experience_id!r}")
139
139
  return await self._post(
140
- f"/api/v1/evaluations/experiences/{experience_id}",
140
+ f"/api/v1/csat/experiences/{experience_id}",
141
141
  body=await async_maybe_transform(
142
142
  {
143
- "evaluation": evaluation,
143
+ "csat_rating": csat_rating,
144
144
  "user_id": user_id,
145
145
  },
146
- experience_create_params.ExperienceCreateParams,
146
+ csat_create_params.CsatCreateParams,
147
147
  ),
148
148
  options=make_request_options(
149
149
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
150
150
  ),
151
- cast_to=EvaluationResponse,
151
+ cast_to=Csat,
152
152
  )
153
153
 
154
154
 
155
- class ExperiencesResourceWithRawResponse:
156
- def __init__(self, experiences: ExperiencesResource) -> None:
157
- self._experiences = experiences
155
+ class CsatResourceWithRawResponse:
156
+ def __init__(self, csat: CsatResource) -> None:
157
+ self._csat = csat
158
158
 
159
159
  self.create = to_raw_response_wrapper(
160
- experiences.create,
160
+ csat.create,
161
161
  )
162
162
 
163
163
 
164
- class AsyncExperiencesResourceWithRawResponse:
165
- def __init__(self, experiences: AsyncExperiencesResource) -> None:
166
- self._experiences = experiences
164
+ class AsyncCsatResourceWithRawResponse:
165
+ def __init__(self, csat: AsyncCsatResource) -> None:
166
+ self._csat = csat
167
167
 
168
168
  self.create = async_to_raw_response_wrapper(
169
- experiences.create,
169
+ csat.create,
170
170
  )
171
171
 
172
172
 
173
- class ExperiencesResourceWithStreamingResponse:
174
- def __init__(self, experiences: ExperiencesResource) -> None:
175
- self._experiences = experiences
173
+ class CsatResourceWithStreamingResponse:
174
+ def __init__(self, csat: CsatResource) -> None:
175
+ self._csat = csat
176
176
 
177
177
  self.create = to_streamed_response_wrapper(
178
- experiences.create,
178
+ csat.create,
179
179
  )
180
180
 
181
181
 
182
- class AsyncExperiencesResourceWithStreamingResponse:
183
- def __init__(self, experiences: AsyncExperiencesResource) -> None:
184
- self._experiences = experiences
182
+ class AsyncCsatResourceWithStreamingResponse:
183
+ def __init__(self, csat: AsyncCsatResource) -> None:
184
+ self._csat = csat
185
185
 
186
186
  self.create = async_to_streamed_response_wrapper(
187
- experiences.create,
187
+ csat.create,
188
188
  )
payi/resources/ingest.py CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Union, Iterable
5
+ from typing import Dict, Union, Iterable, Optional
6
6
  from datetime import datetime
7
7
 
8
8
  import httpx
@@ -89,13 +89,14 @@ class IngestResource(SyncAPIResource):
89
89
  self,
90
90
  *,
91
91
  category: str,
92
- input: int,
93
- output: int,
94
92
  resource: str,
93
+ units: Dict[str, ingest_units_params.Units],
95
94
  event_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
95
+ provisioned_resource_name: Optional[str] | NotGiven = NOT_GIVEN,
96
96
  budget_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
97
97
  request_tags: Union[list[str], None] | NotGiven = NOT_GIVEN,
98
98
  experience_id: Union[str, None] | NotGiven = NOT_GIVEN,
99
+ experience_name: Union[str, None] | NotGiven = NOT_GIVEN,
99
100
  user_id: Union[str, None] | NotGiven = NOT_GIVEN,
100
101
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
101
102
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -122,6 +123,8 @@ class IngestResource(SyncAPIResource):
122
123
 
123
124
  request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
124
125
 
126
+ experience_name (str, optional): The experience name
127
+
125
128
  experience_id (str, optional): The experience instance id
126
129
 
127
130
  user_id (str, optional): The user id
@@ -155,6 +158,9 @@ class IngestResource(SyncAPIResource):
155
158
  valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
156
159
  valid_tags_str = ",".join(valid_tags) if valid_tags else NOT_GIVEN
157
160
 
161
+ if experience_name is None or isinstance(experience_name, NotGiven):
162
+ experience_name = NOT_GIVEN
163
+
158
164
  if experience_id is None or isinstance(experience_id, NotGiven):
159
165
  experience_id = NOT_GIVEN
160
166
 
@@ -167,6 +173,7 @@ class IngestResource(SyncAPIResource):
167
173
  "xProxy-Budget-IDs": valid_ids_str,
168
174
  "xProxy-Request-Tags": valid_tags_str,
169
175
  "xProxy-Experience-Id": experience_id,
176
+ "xProxy-Experience-Name": experience_name,
170
177
  "xProxy-User-ID": user_id,
171
178
  }
172
179
  ),
@@ -177,10 +184,10 @@ class IngestResource(SyncAPIResource):
177
184
  body=maybe_transform(
178
185
  {
179
186
  "category": category,
180
- "input": input,
181
- "output": output,
182
187
  "resource": resource,
188
+ "units": units,
183
189
  "event_timestamp": event_timestamp,
190
+ "provisioned_resource_name": provisioned_resource_name,
184
191
  },
185
192
  ingest_units_params.IngestUnitsParams,
186
193
  ),
@@ -249,16 +256,15 @@ class AsyncIngestResource(AsyncAPIResource):
249
256
  self,
250
257
  *,
251
258
  category: str,
252
- input: int,
253
- output: int,
254
259
  resource: str,
260
+ units: Dict[str, ingest_units_params.Units],
255
261
  event_timestamp: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
262
+ provisioned_resource_name: Optional[str] | NotGiven = NOT_GIVEN,
256
263
  budget_ids: Union[list[str], None] | NotGiven = NOT_GIVEN,
257
264
  request_tags: Union[list[str], None] | NotGiven = NOT_GIVEN,
265
+ experience_name: Union[str, None] | NotGiven = NOT_GIVEN,
258
266
  experience_id: Union[str, None] | NotGiven = NOT_GIVEN,
259
267
  user_id: Union[str, None] | NotGiven = NOT_GIVEN,
260
-
261
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
262
268
  # The extra values given here take precedence over values defined on the client or passed to this method.
263
269
  extra_headers: Headers | None = None,
264
270
  extra_query: Query | None = None,
@@ -283,6 +289,8 @@ class AsyncIngestResource(AsyncAPIResource):
283
289
 
284
290
  request_tags (list[str], optional): The request tags to associate with the request. Defaults to None.
285
291
 
292
+ experience_name (str, optional): The experience name
293
+
286
294
  experience_id (str, optional): The experience instance id
287
295
 
288
296
  user_id (str, optional): The user id
@@ -316,6 +324,9 @@ class AsyncIngestResource(AsyncAPIResource):
316
324
  valid_tags = [tag.strip() for tag in request_tags if tag.strip()]
317
325
  valid_tags_str = ",".join(valid_tags) if valid_tags else NOT_GIVEN
318
326
 
327
+ if experience_name is None or isinstance(experience_name, NotGiven):
328
+ experience_name = NOT_GIVEN
329
+
319
330
  if experience_id is None or isinstance(experience_id, NotGiven):
320
331
  experience_id = NOT_GIVEN
321
332
 
@@ -327,6 +338,7 @@ class AsyncIngestResource(AsyncAPIResource):
327
338
  {
328
339
  "xProxy-Budget-IDs": valid_ids_str,
329
340
  "xProxy-Request-Tags": valid_tags_str,
341
+ "xProxy-Experience-Name": experience_name,
330
342
  "xProxy-Experience-Id": experience_id,
331
343
  "xProxy-User-ID": user_id,
332
344
  }
@@ -338,10 +350,10 @@ class AsyncIngestResource(AsyncAPIResource):
338
350
  body=await async_maybe_transform(
339
351
  {
340
352
  "category": category,
341
- "input": input,
342
- "output": output,
343
353
  "resource": resource,
354
+ "units": units,
344
355
  "event_timestamp": event_timestamp,
356
+ "provisioned_resource_name": provisioned_resource_name,
345
357
  },
346
358
  ingest_units_params.IngestUnitsParams,
347
359
  ),