paid-python 1.0.0a0__tar.gz → 1.0.0a1__tar.gz

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.
Files changed (186) hide show
  1. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/PKG-INFO +22 -8
  2. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/README.md +21 -7
  3. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/pyproject.toml +1 -1
  4. paid_python-1.0.0a1/src/paid/__init__.py +102 -0
  5. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/client.py +16 -22
  6. paid_python-1.0.0a1/src/paid/contacts/client.py +826 -0
  7. paid_python-1.0.0a1/src/paid/contacts/raw_client.py +1460 -0
  8. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/client_wrapper.py +8 -10
  9. paid_python-1.0.0a1/src/paid/customers/client.py +910 -0
  10. paid_python-1.0.0a1/src/paid/customers/raw_client.py +1552 -0
  11. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/environment.py +1 -1
  12. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/errors/bad_request_error.py +2 -2
  13. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/errors/forbidden_error.py +2 -2
  14. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/errors/internal_server_error.py +2 -2
  15. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/errors/not_found_error.py +2 -2
  16. paid_python-1.0.0a1/src/paid/invoices/client.py +369 -0
  17. {paid_python-1.0.0a0/src/paid/plans → paid_python-1.0.0a1/src/paid/invoices}/raw_client.py +310 -201
  18. paid_python-1.0.0a1/src/paid/orders/client.py +700 -0
  19. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/orders/raw_client.py +551 -538
  20. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/products/client.py +129 -265
  21. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/products/raw_client.py +563 -233
  22. paid_python-1.0.0a1/src/paid/signals/__init__.py +4 -0
  23. paid_python-1.0.0a1/src/paid/signals/client.py +130 -0
  24. paid_python-1.0.0a1/src/paid/signals/raw_client.py +190 -0
  25. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/autoinstrumentation.py +12 -6
  26. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/context_manager.py +2 -6
  27. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/distributed_tracing.py +3 -3
  28. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/signal.py +3 -3
  29. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
  30. paid_python-1.0.0a1/src/paid/types/__init__.py +81 -0
  31. paid_python-1.0.0a1/src/paid/types/attribution.py +8 -0
  32. paid_python-1.0.0a0/src/paid/types/agent_attribute.py → paid_python-1.0.0a1/src/paid/types/bulk_signals_response.py +4 -5
  33. paid_python-1.0.0a0/src/paid/types/contact_create_for_customer.py → paid_python-1.0.0a1/src/paid/types/contact.py +10 -13
  34. paid_python-1.0.0a0/src/paid/types/address.py → paid_python-1.0.0a1/src/paid/types/contact_billing_address.py +6 -7
  35. paid_python-1.0.0a0/src/paid/types/cost_amount.py → paid_python-1.0.0a1/src/paid/types/contact_list_response.py +5 -14
  36. paid_python-1.0.0a1/src/paid/types/customer.py +39 -0
  37. paid_python-1.0.0a1/src/paid/types/customer_attribution.py +8 -0
  38. paid_python-1.0.0a1/src/paid/types/customer_billing_address.py +26 -0
  39. paid_python-1.0.0a0/src/paid/types/usage_summary_order.py → paid_python-1.0.0a1/src/paid/types/customer_by_external_id.py +3 -5
  40. paid_python-1.0.0a0/src/paid/types/usage_summary_order_line.py → paid_python-1.0.0a1/src/paid/types/customer_by_id.py +3 -5
  41. paid_python-1.0.0a1/src/paid/types/customer_creation_state.py +5 -0
  42. paid_python-1.0.0a1/src/paid/types/customer_list_response.py +22 -0
  43. paid_python-1.0.0a1/src/paid/types/empty_response.py +17 -0
  44. paid_python-1.0.0a0/src/paid/types/error.py → paid_python-1.0.0a1/src/paid/types/error_response.py +4 -7
  45. paid_python-1.0.0a1/src/paid/types/invoice.py +57 -0
  46. paid_python-1.0.0a1/src/paid/types/invoice_line.py +42 -0
  47. paid_python-1.0.0a1/src/paid/types/invoice_line_payment_status.py +7 -0
  48. paid_python-1.0.0a1/src/paid/types/invoice_lines_response.py +22 -0
  49. paid_python-1.0.0a1/src/paid/types/invoice_list_response.py +22 -0
  50. paid_python-1.0.0a1/src/paid/types/invoice_payment_status.py +5 -0
  51. paid_python-1.0.0a1/src/paid/types/invoice_source.py +5 -0
  52. paid_python-1.0.0a1/src/paid/types/invoice_status.py +7 -0
  53. paid_python-1.0.0a1/src/paid/types/invoice_tax_status.py +7 -0
  54. paid_python-1.0.0a1/src/paid/types/order.py +50 -0
  55. paid_python-1.0.0a1/src/paid/types/order_creation_state.py +5 -0
  56. paid_python-1.0.0a0/src/paid/types/agent_price_point_tiers.py → paid_python-1.0.0a1/src/paid/types/order_line.py +8 -4
  57. paid_python-1.0.0a1/src/paid/types/order_lines_response.py +22 -0
  58. paid_python-1.0.0a1/src/paid/types/order_list_response.py +22 -0
  59. paid_python-1.0.0a1/src/paid/types/pagination.py +24 -0
  60. paid_python-1.0.0a0/src/paid/types/agent.py → paid_python-1.0.0a1/src/paid/types/product.py +8 -8
  61. paid_python-1.0.0a0/src/paid/types/tier.py → paid_python-1.0.0a1/src/paid/types/product_by_external_id.py +5 -4
  62. paid_python-1.0.0a0/src/paid/types/traces_response.py → paid_python-1.0.0a1/src/paid/types/product_by_id.py +5 -7
  63. paid_python-1.0.0a1/src/paid/types/product_list_response.py +22 -0
  64. paid_python-1.0.0a0/src/paid/types/price_point.py → paid_python-1.0.0a1/src/paid/types/signal.py +8 -6
  65. paid_python-1.0.0a0/src/paid/types/contact.py → paid_python-1.0.0a1/src/paid/types/update_contact_request.py +5 -17
  66. paid_python-1.0.0a1/src/paid/types/update_customer_request.py +38 -0
  67. paid_python-1.0.0a0/src/paid/types/product_update.py → paid_python-1.0.0a1/src/paid/types/update_product_request.py +2 -12
  68. paid_python-1.0.0a0/src/paid/__init__.py +0 -163
  69. paid_python-1.0.0a0/src/paid/agents/client.py +0 -880
  70. paid_python-1.0.0a0/src/paid/agents/raw_client.py +0 -785
  71. paid_python-1.0.0a0/src/paid/contacts/client.py +0 -544
  72. paid_python-1.0.0a0/src/paid/contacts/raw_client.py +0 -532
  73. paid_python-1.0.0a0/src/paid/customers/__init__.py +0 -7
  74. paid_python-1.0.0a0/src/paid/customers/client.py +0 -1630
  75. paid_python-1.0.0a0/src/paid/customers/raw_client.py +0 -1950
  76. paid_python-1.0.0a0/src/paid/customers/types/__init__.py +0 -8
  77. paid_python-1.0.0a0/src/paid/customers/types/customers_check_entitlement_request_view.py +0 -5
  78. paid_python-1.0.0a0/src/paid/customers/types/customers_check_entitlement_response.py +0 -22
  79. paid_python-1.0.0a0/src/paid/orders/__init__.py +0 -7
  80. paid_python-1.0.0a0/src/paid/orders/client.py +0 -892
  81. paid_python-1.0.0a0/src/paid/orders/lines/client.py +0 -144
  82. paid_python-1.0.0a0/src/paid/orders/lines/raw_client.py +0 -129
  83. paid_python-1.0.0a0/src/paid/plans/client.py +0 -403
  84. paid_python-1.0.0a0/src/paid/products/__init__.py +0 -7
  85. paid_python-1.0.0a0/src/paid/products/types/__init__.py +0 -7
  86. paid_python-1.0.0a0/src/paid/products/types/product_create_type.py +0 -5
  87. paid_python-1.0.0a0/src/paid/traces/client.py +0 -218
  88. paid_python-1.0.0a0/src/paid/traces/raw_client.py +0 -226
  89. paid_python-1.0.0a0/src/paid/types/__init__.py +0 -133
  90. paid_python-1.0.0a0/src/paid/types/agent_price_point.py +0 -27
  91. paid_python-1.0.0a0/src/paid/types/agent_update.py +0 -29
  92. paid_python-1.0.0a0/src/paid/types/api_error.py +0 -29
  93. paid_python-1.0.0a0/src/paid/types/billing_frequency.py +0 -5
  94. paid_python-1.0.0a0/src/paid/types/cancel_renewal_response.py +0 -49
  95. paid_python-1.0.0a0/src/paid/types/charge_type.py +0 -5
  96. paid_python-1.0.0a0/src/paid/types/cost_trace.py +0 -55
  97. paid_python-1.0.0a0/src/paid/types/cost_traces_response.py +0 -26
  98. paid_python-1.0.0a0/src/paid/types/creation_source.py +0 -5
  99. paid_python-1.0.0a0/src/paid/types/creation_state.py +0 -5
  100. paid_python-1.0.0a0/src/paid/types/customer.py +0 -46
  101. paid_python-1.0.0a0/src/paid/types/customer_update.py +0 -40
  102. paid_python-1.0.0a0/src/paid/types/entitlement_usage.py +0 -48
  103. paid_python-1.0.0a0/src/paid/types/invoice.py +0 -75
  104. paid_python-1.0.0a0/src/paid/types/invoice_status.py +0 -5
  105. paid_python-1.0.0a0/src/paid/types/order.py +0 -49
  106. paid_python-1.0.0a0/src/paid/types/order_line.py +0 -45
  107. paid_python-1.0.0a0/src/paid/types/order_line_attribute.py +0 -27
  108. paid_python-1.0.0a0/src/paid/types/order_line_attribute_create_one.py +0 -5
  109. paid_python-1.0.0a0/src/paid/types/order_line_attribute_pricing.py +0 -33
  110. paid_python-1.0.0a0/src/paid/types/order_line_create.py +0 -72
  111. paid_python-1.0.0a0/src/paid/types/pagination_meta.py +0 -84
  112. paid_python-1.0.0a0/src/paid/types/payment_method.py +0 -58
  113. paid_python-1.0.0a0/src/paid/types/payment_method_card.py +0 -49
  114. paid_python-1.0.0a0/src/paid/types/payment_method_type.py +0 -5
  115. paid_python-1.0.0a0/src/paid/types/payment_method_us_bank_account.py +0 -36
  116. paid_python-1.0.0a0/src/paid/types/payment_method_us_bank_account_account_type.py +0 -5
  117. paid_python-1.0.0a0/src/paid/types/plan.py +0 -81
  118. paid_python-1.0.0a0/src/paid/types/plan_group.py +0 -60
  119. paid_python-1.0.0a0/src/paid/types/plan_plan_products_item.py +0 -41
  120. paid_python-1.0.0a0/src/paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
  121. paid_python-1.0.0a0/src/paid/types/plan_with_features.py +0 -69
  122. paid_python-1.0.0a0/src/paid/types/plan_with_features_features_item.py +0 -34
  123. paid_python-1.0.0a0/src/paid/types/pricing.py +0 -31
  124. paid_python-1.0.0a0/src/paid/types/pricing_model_type.py +0 -7
  125. paid_python-1.0.0a0/src/paid/types/product.py +0 -56
  126. paid_python-1.0.0a0/src/paid/types/product_type.py +0 -5
  127. paid_python-1.0.0a0/src/paid/types/product_update_type.py +0 -5
  128. paid_python-1.0.0a0/src/paid/types/proration_attribute_update.py +0 -44
  129. paid_python-1.0.0a0/src/paid/types/proration_detail.py +0 -49
  130. paid_python-1.0.0a0/src/paid/types/proration_upgrade_response.py +0 -73
  131. paid_python-1.0.0a0/src/paid/types/salutation.py +0 -5
  132. paid_python-1.0.0a0/src/paid/types/signal.py +0 -53
  133. paid_python-1.0.0a0/src/paid/types/signal_v_2.py +0 -56
  134. paid_python-1.0.0a0/src/paid/types/tax_exempt_status.py +0 -5
  135. paid_python-1.0.0a0/src/paid/types/trace.py +0 -69
  136. paid_python-1.0.0a0/src/paid/types/usage_pagination_meta.py +0 -43
  137. paid_python-1.0.0a0/src/paid/types/usage_summaries_response.py +0 -26
  138. paid_python-1.0.0a0/src/paid/types/usage_summary.py +0 -121
  139. paid_python-1.0.0a0/src/paid/usage/__init__.py +0 -7
  140. paid_python-1.0.0a0/src/paid/usage/client.py +0 -321
  141. paid_python-1.0.0a0/src/paid/usage/raw_client.py +0 -387
  142. paid_python-1.0.0a0/src/paid/usage/types/__init__.py +0 -7
  143. paid_python-1.0.0a0/src/paid/usage/types/usage_check_usage_response.py +0 -53
  144. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/LICENSE +0 -0
  145. {paid_python-1.0.0a0/src/paid/agents → paid_python-1.0.0a1/src/paid/contacts}/__init__.py +0 -0
  146. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/__init__.py +0 -0
  147. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/api_error.py +0 -0
  148. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/datetime_utils.py +0 -0
  149. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/file.py +0 -0
  150. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/force_multipart.py +0 -0
  151. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/http_client.py +0 -0
  152. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/http_response.py +0 -0
  153. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/jsonable_encoder.py +0 -0
  154. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/pydantic_utilities.py +0 -0
  155. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/query_encoder.py +0 -0
  156. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/remove_none_from_dict.py +0 -0
  157. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/request_options.py +0 -0
  158. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/core/serialization.py +0 -0
  159. {paid_python-1.0.0a0/src/paid/contacts → paid_python-1.0.0a1/src/paid/customers}/__init__.py +0 -0
  160. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/errors/__init__.py +0 -0
  161. {paid_python-1.0.0a0/src/paid/orders/lines → paid_python-1.0.0a1/src/paid/invoices}/__init__.py +0 -0
  162. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/logger.py +0 -0
  163. {paid_python-1.0.0a0/src/paid/plans → paid_python-1.0.0a1/src/paid/orders}/__init__.py +0 -0
  164. {paid_python-1.0.0a0/src/paid/traces → paid_python-1.0.0a1/src/paid/products}/__init__.py +0 -0
  165. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/py.typed +0 -0
  166. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/__init__.py +0 -0
  167. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/context_data.py +0 -0
  168. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/tracing.py +0 -0
  169. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/__init__.py +0 -0
  170. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/anthropic/__init__.py +0 -0
  171. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/anthropic/anthropicWrapper.py +0 -0
  172. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/bedrock/__init__.py +0 -0
  173. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/bedrock/bedrockWrapper.py +0 -0
  174. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/gemini/__init__.py +0 -0
  175. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/gemini/geminiWrapper.py +0 -0
  176. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/langchain/__init__.py +0 -0
  177. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/langchain/paidLangChainCallback.py +0 -0
  178. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/llamaindex/__init__.py +0 -0
  179. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/llamaindex/llamaIndexWrapper.py +0 -0
  180. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/mistral/__init__.py +0 -0
  181. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/mistral/mistralWrapper.py +0 -0
  182. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/openai/__init__.py +0 -0
  183. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/openai/openAiWrapper.py +0 -0
  184. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/openai_agents/__init__.py +0 -0
  185. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/tracing/wrappers/utils.py +0 -0
  186. {paid_python-1.0.0a0 → paid_python-1.0.0a1}/src/paid/version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: paid-python
3
- Version: 1.0.0a0
3
+ Version: 1.0.0a1
4
4
  Summary:
5
5
  Requires-Python: >=3.9,<3.14
6
6
  Classifier: Intended Audience :: Developers
@@ -78,7 +78,7 @@ from paid import Paid
78
78
 
79
79
  client = Paid(token="API_KEY")
80
80
 
81
- client.customers.create(
81
+ client.customers.create_a_new_customer(
82
82
  name="name"
83
83
  )
84
84
  ```
@@ -89,7 +89,7 @@ The SDK provides Python classes for all request and response types. These are au
89
89
 
90
90
  ```python
91
91
  # Example of creating a customer
92
- response = client.customers.create(
92
+ response = client.customers.create_a_new_customer(
93
93
  name="John Doe",
94
94
  )
95
95
 
@@ -103,13 +103,21 @@ print(response.email)
103
103
  When the API returns a non-success status code (4xx or 5xx response), the SDK will raise an appropriate error.
104
104
 
105
105
  ```python
106
+ from paid import BadRequestError, NotFoundError
107
+ from paid.core.api_error import ApiError
108
+
106
109
  try:
107
- client.customers.create(...)
108
- except paid.Error as e:
110
+ client.customers.create_a_new_customer(name="John Doe")
111
+ except BadRequestError as e:
112
+ print(e.status_code) # 400
113
+ print(e.body) # ErrorResponse with error details
114
+ except NotFoundError as e:
115
+ print(e.status_code) # 404
116
+ print(e.body)
117
+ except ApiError as e:
118
+ # Catch-all for other API errors
109
119
  print(e.status_code)
110
- print(e.message)
111
120
  print(e.body)
112
- print(e.raw_response)
113
121
  ```
114
122
 
115
123
  ## Logging
@@ -154,6 +162,7 @@ export PAID_ENABLED=false
154
162
  ```
155
163
 
156
164
  This is useful for:
165
+
157
166
  - Development/testing environments where tracing isn't needed
158
167
  - Temporarily disabling tracing without modifying code
159
168
  - Feature flagging in different deployment environments
@@ -215,11 +224,13 @@ Both approaches:
215
224
  - Support the same parameters: `external_customer_id`, `external_product_id`, `tracing_token`, `store_prompt`, `metadata`
216
225
 
217
226
  * Note - if it happens that you're calling `paid_tracing` from non-main thread, then it's advised to initialize from main thread:
227
+
218
228
  ```python
219
229
  from paid.tracing import initialize_tracing
220
230
  initialize_tracing()
221
231
  ```
222
- * `initialize_tracing` also accepts optional arguments like OTEL collector endpoint and api key if you want to reroute your tracing somewhere else :)
232
+
233
+ - `initialize_tracing` also accepts optional arguments like OTEL collector endpoint and api key if you want to reroute your tracing somewhere else :)
223
234
 
224
235
  ### Using the Paid wrappers
225
236
 
@@ -302,6 +313,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
302
313
 
303
314
  process_event(incoming_event)
304
315
  ```
316
+
305
317
  </Tab>
306
318
 
307
319
  <Tab title="Python - Context Manager">
@@ -336,6 +348,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
336
348
  ):
337
349
  process_event(incoming_event)
338
350
  ```
351
+
339
352
  </Tab>
340
353
 
341
354
  <Tab title="Node.js">
@@ -772,6 +785,7 @@ await do_work()
772
785
  ### Paid OTEL Tracer Provider
773
786
 
774
787
  If you would like to use the Paid OTEL tracer provider:
788
+
775
789
  ```python
776
790
  from paid.tracing import get_paid_tracer_provider
777
791
  paid_tracer_provider = get_paid_tracer_provider()
@@ -41,7 +41,7 @@ from paid import Paid
41
41
 
42
42
  client = Paid(token="API_KEY")
43
43
 
44
- client.customers.create(
44
+ client.customers.create_a_new_customer(
45
45
  name="name"
46
46
  )
47
47
  ```
@@ -52,7 +52,7 @@ The SDK provides Python classes for all request and response types. These are au
52
52
 
53
53
  ```python
54
54
  # Example of creating a customer
55
- response = client.customers.create(
55
+ response = client.customers.create_a_new_customer(
56
56
  name="John Doe",
57
57
  )
58
58
 
@@ -66,13 +66,21 @@ print(response.email)
66
66
  When the API returns a non-success status code (4xx or 5xx response), the SDK will raise an appropriate error.
67
67
 
68
68
  ```python
69
+ from paid import BadRequestError, NotFoundError
70
+ from paid.core.api_error import ApiError
71
+
69
72
  try:
70
- client.customers.create(...)
71
- except paid.Error as e:
73
+ client.customers.create_a_new_customer(name="John Doe")
74
+ except BadRequestError as e:
75
+ print(e.status_code) # 400
76
+ print(e.body) # ErrorResponse with error details
77
+ except NotFoundError as e:
78
+ print(e.status_code) # 404
79
+ print(e.body)
80
+ except ApiError as e:
81
+ # Catch-all for other API errors
72
82
  print(e.status_code)
73
- print(e.message)
74
83
  print(e.body)
75
- print(e.raw_response)
76
84
  ```
77
85
 
78
86
  ## Logging
@@ -117,6 +125,7 @@ export PAID_ENABLED=false
117
125
  ```
118
126
 
119
127
  This is useful for:
128
+
120
129
  - Development/testing environments where tracing isn't needed
121
130
  - Temporarily disabling tracing without modifying code
122
131
  - Feature flagging in different deployment environments
@@ -178,11 +187,13 @@ Both approaches:
178
187
  - Support the same parameters: `external_customer_id`, `external_product_id`, `tracing_token`, `store_prompt`, `metadata`
179
188
 
180
189
  * Note - if it happens that you're calling `paid_tracing` from non-main thread, then it's advised to initialize from main thread:
190
+
181
191
  ```python
182
192
  from paid.tracing import initialize_tracing
183
193
  initialize_tracing()
184
194
  ```
185
- * `initialize_tracing` also accepts optional arguments like OTEL collector endpoint and api key if you want to reroute your tracing somewhere else :)
195
+
196
+ - `initialize_tracing` also accepts optional arguments like OTEL collector endpoint and api key if you want to reroute your tracing somewhere else :)
186
197
 
187
198
  ### Using the Paid wrappers
188
199
 
@@ -265,6 +276,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
265
276
 
266
277
  process_event(incoming_event)
267
278
  ```
279
+
268
280
  </Tab>
269
281
 
270
282
  <Tab title="Python - Context Manager">
@@ -299,6 +311,7 @@ You can attach custom metadata to your traces by passing a `metadata` dictionary
299
311
  ):
300
312
  process_event(incoming_event)
301
313
  ```
314
+
302
315
  </Tab>
303
316
 
304
317
  <Tab title="Node.js">
@@ -735,6 +748,7 @@ await do_work()
735
748
  ### Paid OTEL Tracer Provider
736
749
 
737
750
  If you would like to use the Paid OTEL tracer provider:
751
+
738
752
  ```python
739
753
  from paid.tracing import get_paid_tracer_provider
740
754
  paid_tracer_provider = get_paid_tracer_provider()
@@ -3,7 +3,7 @@ name = "paid-python"
3
3
 
4
4
  [tool.poetry]
5
5
  name = "paid-python"
6
- version = "1.0.0-alpha0"
6
+ version = "1.0.0-alpha1"
7
7
  description = ""
8
8
  readme = "README.md"
9
9
  authors = []
@@ -0,0 +1,102 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .types import (
6
+ Attribution,
7
+ BulkSignalsResponse,
8
+ Contact,
9
+ ContactBillingAddress,
10
+ ContactListResponse,
11
+ Customer,
12
+ CustomerAttribution,
13
+ CustomerBillingAddress,
14
+ CustomerByExternalId,
15
+ CustomerById,
16
+ CustomerCreationState,
17
+ CustomerListResponse,
18
+ EmptyResponse,
19
+ ErrorResponse,
20
+ Invoice,
21
+ InvoiceLine,
22
+ InvoiceLinePaymentStatus,
23
+ InvoiceLinesResponse,
24
+ InvoiceListResponse,
25
+ InvoicePaymentStatus,
26
+ InvoiceSource,
27
+ InvoiceStatus,
28
+ InvoiceTaxStatus,
29
+ Order,
30
+ OrderCreationState,
31
+ OrderLine,
32
+ OrderLinesResponse,
33
+ OrderListResponse,
34
+ Pagination,
35
+ Product,
36
+ ProductByExternalId,
37
+ ProductById,
38
+ ProductListResponse,
39
+ Signal,
40
+ UpdateContactRequest,
41
+ UpdateCustomerRequest,
42
+ UpdateProductRequest,
43
+ )
44
+ from .errors import BadRequestError, ForbiddenError, InternalServerError, NotFoundError
45
+ from . import contacts, customers, invoices, orders, products, signals
46
+ from .client import AsyncPaid, Paid
47
+ from .environment import PaidEnvironment
48
+ from .version import __version__
49
+
50
+ __all__ = [
51
+ "AsyncPaid",
52
+ "Attribution",
53
+ "BadRequestError",
54
+ "BulkSignalsResponse",
55
+ "Contact",
56
+ "ContactBillingAddress",
57
+ "ContactListResponse",
58
+ "Customer",
59
+ "CustomerAttribution",
60
+ "CustomerBillingAddress",
61
+ "CustomerByExternalId",
62
+ "CustomerById",
63
+ "CustomerCreationState",
64
+ "CustomerListResponse",
65
+ "EmptyResponse",
66
+ "ErrorResponse",
67
+ "ForbiddenError",
68
+ "InternalServerError",
69
+ "Invoice",
70
+ "InvoiceLine",
71
+ "InvoiceLinePaymentStatus",
72
+ "InvoiceLinesResponse",
73
+ "InvoiceListResponse",
74
+ "InvoicePaymentStatus",
75
+ "InvoiceSource",
76
+ "InvoiceStatus",
77
+ "InvoiceTaxStatus",
78
+ "NotFoundError",
79
+ "Order",
80
+ "OrderCreationState",
81
+ "OrderLine",
82
+ "OrderLinesResponse",
83
+ "OrderListResponse",
84
+ "Pagination",
85
+ "Paid",
86
+ "PaidEnvironment",
87
+ "Product",
88
+ "ProductByExternalId",
89
+ "ProductById",
90
+ "ProductListResponse",
91
+ "Signal",
92
+ "UpdateContactRequest",
93
+ "UpdateCustomerRequest",
94
+ "UpdateProductRequest",
95
+ "__version__",
96
+ "contacts",
97
+ "customers",
98
+ "invoices",
99
+ "orders",
100
+ "products",
101
+ "signals",
102
+ ]
@@ -3,16 +3,14 @@
3
3
  import typing
4
4
 
5
5
  import httpx
6
- from .agents.client import AgentsClient, AsyncAgentsClient
7
6
  from .contacts.client import AsyncContactsClient, ContactsClient
8
7
  from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
8
  from .customers.client import AsyncCustomersClient, CustomersClient
10
9
  from .environment import PaidEnvironment
10
+ from .invoices.client import AsyncInvoicesClient, InvoicesClient
11
11
  from .orders.client import AsyncOrdersClient, OrdersClient
12
- from .plans.client import AsyncPlansClient, PlansClient
13
12
  from .products.client import AsyncProductsClient, ProductsClient
14
- from .traces.client import AsyncTracesClient, TracesClient
15
- from .usage.client import AsyncUsageClient, UsageClient
13
+ from .signals.client import AsyncSignalsClient, SignalsClient
16
14
 
17
15
 
18
16
  class Paid:
@@ -29,11 +27,11 @@ class Paid:
29
27
 
30
28
 
31
29
 
32
- Defaults to PaidEnvironment.PRODUCTION
30
+ Defaults to PaidEnvironment.DEFAULT
33
31
 
34
32
 
35
33
 
36
- token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
34
+ token : typing.Union[str, typing.Callable[[], str]]
37
35
  timeout : typing.Optional[float]
38
36
  The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
39
37
 
@@ -56,8 +54,8 @@ class Paid:
56
54
  self,
57
55
  *,
58
56
  base_url: typing.Optional[str] = None,
59
- environment: PaidEnvironment = PaidEnvironment.PRODUCTION,
60
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
57
+ environment: PaidEnvironment = PaidEnvironment.DEFAULT,
58
+ token: typing.Union[str, typing.Callable[[], str]],
61
59
  timeout: typing.Optional[float] = None,
62
60
  follow_redirects: typing.Optional[bool] = True,
63
61
  httpx_client: typing.Optional[httpx.Client] = None,
@@ -75,14 +73,12 @@ class Paid:
75
73
  else httpx.Client(timeout=_defaulted_timeout),
76
74
  timeout=_defaulted_timeout,
77
75
  )
78
- self.customers = CustomersClient(client_wrapper=self._client_wrapper)
79
- self.agents = AgentsClient(client_wrapper=self._client_wrapper)
80
76
  self.products = ProductsClient(client_wrapper=self._client_wrapper)
77
+ self.customers = CustomersClient(client_wrapper=self._client_wrapper)
81
78
  self.contacts = ContactsClient(client_wrapper=self._client_wrapper)
82
79
  self.orders = OrdersClient(client_wrapper=self._client_wrapper)
83
- self.plans = PlansClient(client_wrapper=self._client_wrapper)
84
- self.usage = UsageClient(client_wrapper=self._client_wrapper)
85
- self.traces = TracesClient(client_wrapper=self._client_wrapper)
80
+ self.invoices = InvoicesClient(client_wrapper=self._client_wrapper)
81
+ self.signals = SignalsClient(client_wrapper=self._client_wrapper)
86
82
 
87
83
 
88
84
  class AsyncPaid:
@@ -99,11 +95,11 @@ class AsyncPaid:
99
95
 
100
96
 
101
97
 
102
- Defaults to PaidEnvironment.PRODUCTION
98
+ Defaults to PaidEnvironment.DEFAULT
103
99
 
104
100
 
105
101
 
106
- token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
102
+ token : typing.Union[str, typing.Callable[[], str]]
107
103
  timeout : typing.Optional[float]
108
104
  The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
109
105
 
@@ -126,8 +122,8 @@ class AsyncPaid:
126
122
  self,
127
123
  *,
128
124
  base_url: typing.Optional[str] = None,
129
- environment: PaidEnvironment = PaidEnvironment.PRODUCTION,
130
- token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
125
+ environment: PaidEnvironment = PaidEnvironment.DEFAULT,
126
+ token: typing.Union[str, typing.Callable[[], str]],
131
127
  timeout: typing.Optional[float] = None,
132
128
  follow_redirects: typing.Optional[bool] = True,
133
129
  httpx_client: typing.Optional[httpx.AsyncClient] = None,
@@ -145,14 +141,12 @@ class AsyncPaid:
145
141
  else httpx.AsyncClient(timeout=_defaulted_timeout),
146
142
  timeout=_defaulted_timeout,
147
143
  )
148
- self.customers = AsyncCustomersClient(client_wrapper=self._client_wrapper)
149
- self.agents = AsyncAgentsClient(client_wrapper=self._client_wrapper)
150
144
  self.products = AsyncProductsClient(client_wrapper=self._client_wrapper)
145
+ self.customers = AsyncCustomersClient(client_wrapper=self._client_wrapper)
151
146
  self.contacts = AsyncContactsClient(client_wrapper=self._client_wrapper)
152
147
  self.orders = AsyncOrdersClient(client_wrapper=self._client_wrapper)
153
- self.plans = AsyncPlansClient(client_wrapper=self._client_wrapper)
154
- self.usage = AsyncUsageClient(client_wrapper=self._client_wrapper)
155
- self.traces = AsyncTracesClient(client_wrapper=self._client_wrapper)
148
+ self.invoices = AsyncInvoicesClient(client_wrapper=self._client_wrapper)
149
+ self.signals = AsyncSignalsClient(client_wrapper=self._client_wrapper)
156
150
 
157
151
 
158
152
  def _get_base_url(*, base_url: typing.Optional[str] = None, environment: PaidEnvironment) -> str: