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
payi/_base_client.py CHANGED
@@ -143,6 +143,12 @@ class PageInfo:
143
143
  self.url = url
144
144
  self.params = params
145
145
 
146
+ @override
147
+ def __repr__(self) -> str:
148
+ if self.url:
149
+ return f"{self.__class__.__name__}(url={self.url})"
150
+ return f"{self.__class__.__name__}(params={self.params})"
151
+
146
152
 
147
153
  class BasePage(GenericModel, Generic[_T]):
148
154
  """
@@ -412,7 +418,10 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
412
418
  if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers:
413
419
  headers[idempotency_header] = options.idempotency_key or self._idempotency_key()
414
420
 
415
- headers.setdefault("x-stainless-retry-count", str(retries_taken))
421
+ # Don't set the retry count header if it was already set or removed by the caller. We check
422
+ # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case.
423
+ if "x-stainless-retry-count" not in (header.lower() for header in custom_headers):
424
+ headers["x-stainless-retry-count"] = str(retries_taken)
416
425
 
417
426
  return headers
418
427
 
@@ -686,7 +695,8 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
686
695
  if retry_after is not None and 0 < retry_after <= 60:
687
696
  return retry_after
688
697
 
689
- nb_retries = max_retries - remaining_retries
698
+ # Also cap retry count to 1000 to avoid any potential overflows with `pow`
699
+ nb_retries = min(max_retries - remaining_retries, 1000)
690
700
 
691
701
  # Apply exponential backoff, but not more than the max.
692
702
  sleep_seconds = min(INITIAL_RETRY_DELAY * pow(2.0, nb_retries), MAX_RETRY_DELAY)
@@ -1565,7 +1575,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1565
1575
  except Exception as err:
1566
1576
  log.debug("Encountered Exception", exc_info=True)
1567
1577
 
1568
- if retries_taken > 0:
1578
+ if remaining_retries > 0:
1569
1579
  return await self._retry_request(
1570
1580
  input_options,
1571
1581
  cast_to,
payi/_client.py CHANGED
@@ -50,7 +50,9 @@ class Payi(SyncAPIClient):
50
50
  ingest: resources.IngestResource
51
51
  categories: resources.CategoriesResource
52
52
  experiences: resources.ExperiencesResource
53
- evaluations: resources.EvaluationsResource
53
+ csat: resources.CsatResource
54
+ billing_models: resources.BillingModelsResource
55
+ price_modifiers: resources.PriceModifiersResource
54
56
  with_raw_response: PayiWithRawResponse
55
57
  with_streaming_response: PayiWithStreamedResponse
56
58
 
@@ -112,7 +114,9 @@ class Payi(SyncAPIClient):
112
114
  self.ingest = resources.IngestResource(self)
113
115
  self.categories = resources.CategoriesResource(self)
114
116
  self.experiences = resources.ExperiencesResource(self)
115
- self.evaluations = resources.EvaluationsResource(self)
117
+ self.csat = resources.CsatResource(self)
118
+ self.billing_models = resources.BillingModelsResource(self)
119
+ self.price_modifiers = resources.PriceModifiersResource(self)
116
120
  self.with_raw_response = PayiWithRawResponse(self)
117
121
  self.with_streaming_response = PayiWithStreamedResponse(self)
118
122
 
@@ -226,7 +230,9 @@ class AsyncPayi(AsyncAPIClient):
226
230
  ingest: resources.AsyncIngestResource
227
231
  categories: resources.AsyncCategoriesResource
228
232
  experiences: resources.AsyncExperiencesResource
229
- evaluations: resources.AsyncEvaluationsResource
233
+ csat: resources.AsyncCsatResource
234
+ billing_models: resources.AsyncBillingModelsResource
235
+ price_modifiers: resources.AsyncPriceModifiersResource
230
236
  with_raw_response: AsyncPayiWithRawResponse
231
237
  with_streaming_response: AsyncPayiWithStreamedResponse
232
238
 
@@ -288,7 +294,9 @@ class AsyncPayi(AsyncAPIClient):
288
294
  self.ingest = resources.AsyncIngestResource(self)
289
295
  self.categories = resources.AsyncCategoriesResource(self)
290
296
  self.experiences = resources.AsyncExperiencesResource(self)
291
- self.evaluations = resources.AsyncEvaluationsResource(self)
297
+ self.csat = resources.AsyncCsatResource(self)
298
+ self.billing_models = resources.AsyncBillingModelsResource(self)
299
+ self.price_modifiers = resources.AsyncPriceModifiersResource(self)
292
300
  self.with_raw_response = AsyncPayiWithRawResponse(self)
293
301
  self.with_streaming_response = AsyncPayiWithStreamedResponse(self)
294
302
 
@@ -403,7 +411,9 @@ class PayiWithRawResponse:
403
411
  self.ingest = resources.IngestResourceWithRawResponse(client.ingest)
404
412
  self.categories = resources.CategoriesResourceWithRawResponse(client.categories)
405
413
  self.experiences = resources.ExperiencesResourceWithRawResponse(client.experiences)
406
- self.evaluations = resources.EvaluationsResourceWithRawResponse(client.evaluations)
414
+ self.csat = resources.CsatResourceWithRawResponse(client.csat)
415
+ self.billing_models = resources.BillingModelsResourceWithRawResponse(client.billing_models)
416
+ self.price_modifiers = resources.PriceModifiersResourceWithRawResponse(client.price_modifiers)
407
417
 
408
418
 
409
419
  class AsyncPayiWithRawResponse:
@@ -412,7 +422,9 @@ class AsyncPayiWithRawResponse:
412
422
  self.ingest = resources.AsyncIngestResourceWithRawResponse(client.ingest)
413
423
  self.categories = resources.AsyncCategoriesResourceWithRawResponse(client.categories)
414
424
  self.experiences = resources.AsyncExperiencesResourceWithRawResponse(client.experiences)
415
- self.evaluations = resources.AsyncEvaluationsResourceWithRawResponse(client.evaluations)
425
+ self.csat = resources.AsyncCsatResourceWithRawResponse(client.csat)
426
+ self.billing_models = resources.AsyncBillingModelsResourceWithRawResponse(client.billing_models)
427
+ self.price_modifiers = resources.AsyncPriceModifiersResourceWithRawResponse(client.price_modifiers)
416
428
 
417
429
 
418
430
  class PayiWithStreamedResponse:
@@ -421,7 +433,9 @@ class PayiWithStreamedResponse:
421
433
  self.ingest = resources.IngestResourceWithStreamingResponse(client.ingest)
422
434
  self.categories = resources.CategoriesResourceWithStreamingResponse(client.categories)
423
435
  self.experiences = resources.ExperiencesResourceWithStreamingResponse(client.experiences)
424
- self.evaluations = resources.EvaluationsResourceWithStreamingResponse(client.evaluations)
436
+ self.csat = resources.CsatResourceWithStreamingResponse(client.csat)
437
+ self.billing_models = resources.BillingModelsResourceWithStreamingResponse(client.billing_models)
438
+ self.price_modifiers = resources.PriceModifiersResourceWithStreamingResponse(client.price_modifiers)
425
439
 
426
440
 
427
441
  class AsyncPayiWithStreamedResponse:
@@ -430,7 +444,9 @@ class AsyncPayiWithStreamedResponse:
430
444
  self.ingest = resources.AsyncIngestResourceWithStreamingResponse(client.ingest)
431
445
  self.categories = resources.AsyncCategoriesResourceWithStreamingResponse(client.categories)
432
446
  self.experiences = resources.AsyncExperiencesResourceWithStreamingResponse(client.experiences)
433
- self.evaluations = resources.AsyncEvaluationsResourceWithStreamingResponse(client.evaluations)
447
+ self.csat = resources.AsyncCsatResourceWithStreamingResponse(client.csat)
448
+ self.billing_models = resources.AsyncBillingModelsResourceWithStreamingResponse(client.billing_models)
449
+ self.price_modifiers = resources.AsyncPriceModifiersResourceWithStreamingResponse(client.price_modifiers)
434
450
 
435
451
 
436
452
  Client = Payi
payi/_response.py CHANGED
@@ -192,6 +192,9 @@ class BaseAPIResponse(Generic[R]):
192
192
  if cast_to == float:
193
193
  return cast(R, float(response.text))
194
194
 
195
+ if cast_to == bool:
196
+ return cast(R, response.text.lower() == "true")
197
+
195
198
  origin = get_origin(cast_to) or cast_to
196
199
 
197
200
  if origin == APIResponse:
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.25" # x-release-please-version
4
+ __version__ = "0.1.0-alpha.27" # x-release-please-version
@@ -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,
@@ -24,14 +32,6 @@ from .categories import (
24
32
  CategoriesResourceWithStreamingResponse,
25
33
  AsyncCategoriesResourceWithStreamingResponse,
26
34
  )
27
- from .evaluations import (
28
- EvaluationsResource,
29
- AsyncEvaluationsResource,
30
- EvaluationsResourceWithRawResponse,
31
- AsyncEvaluationsResourceWithRawResponse,
32
- EvaluationsResourceWithStreamingResponse,
33
- AsyncEvaluationsResourceWithStreamingResponse,
34
- )
35
35
  from .experiences import (
36
36
  ExperiencesResource,
37
37
  AsyncExperiencesResource,
@@ -40,6 +40,22 @@ from .experiences import (
40
40
  ExperiencesResourceWithStreamingResponse,
41
41
  AsyncExperiencesResourceWithStreamingResponse,
42
42
  )
43
+ from .billing_models import (
44
+ BillingModelsResource,
45
+ AsyncBillingModelsResource,
46
+ BillingModelsResourceWithRawResponse,
47
+ AsyncBillingModelsResourceWithRawResponse,
48
+ BillingModelsResourceWithStreamingResponse,
49
+ AsyncBillingModelsResourceWithStreamingResponse,
50
+ )
51
+ from .price_modifiers import (
52
+ PriceModifiersResource,
53
+ AsyncPriceModifiersResource,
54
+ PriceModifiersResourceWithRawResponse,
55
+ AsyncPriceModifiersResourceWithRawResponse,
56
+ PriceModifiersResourceWithStreamingResponse,
57
+ AsyncPriceModifiersResourceWithStreamingResponse,
58
+ )
43
59
 
44
60
  __all__ = [
45
61
  "BudgetsResource",
@@ -66,10 +82,22 @@ __all__ = [
66
82
  "AsyncExperiencesResourceWithRawResponse",
67
83
  "ExperiencesResourceWithStreamingResponse",
68
84
  "AsyncExperiencesResourceWithStreamingResponse",
69
- "EvaluationsResource",
70
- "AsyncEvaluationsResource",
71
- "EvaluationsResourceWithRawResponse",
72
- "AsyncEvaluationsResourceWithRawResponse",
73
- "EvaluationsResourceWithStreamingResponse",
74
- "AsyncEvaluationsResourceWithStreamingResponse",
85
+ "CsatResource",
86
+ "AsyncCsatResource",
87
+ "CsatResourceWithRawResponse",
88
+ "AsyncCsatResourceWithRawResponse",
89
+ "CsatResourceWithStreamingResponse",
90
+ "AsyncCsatResourceWithStreamingResponse",
91
+ "BillingModelsResource",
92
+ "AsyncBillingModelsResource",
93
+ "BillingModelsResourceWithRawResponse",
94
+ "AsyncBillingModelsResourceWithRawResponse",
95
+ "BillingModelsResourceWithStreamingResponse",
96
+ "AsyncBillingModelsResourceWithStreamingResponse",
97
+ "PriceModifiersResource",
98
+ "AsyncPriceModifiersResource",
99
+ "PriceModifiersResourceWithRawResponse",
100
+ "AsyncPriceModifiersResourceWithRawResponse",
101
+ "PriceModifiersResourceWithStreamingResponse",
102
+ "AsyncPriceModifiersResourceWithStreamingResponse",
75
103
  ]