boltix 0.0.1__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 (177) hide show
  1. boltix-0.0.1/PKG-INFO +200 -0
  2. boltix-0.0.1/pyproject.toml +35 -0
  3. boltix-0.0.1/setup.cfg +4 -0
  4. boltix-0.0.1/src/boltix/README.md +190 -0
  5. boltix-0.0.1/src/boltix/__init__.py +347 -0
  6. boltix-0.0.1/src/boltix/_default_clients.py +30 -0
  7. boltix-0.0.1/src/boltix/audit/__init__.py +4 -0
  8. boltix-0.0.1/src/boltix/audit/client.py +243 -0
  9. boltix-0.0.1/src/boltix/audit/raw_client.py +259 -0
  10. boltix-0.0.1/src/boltix/auth/__init__.py +4 -0
  11. boltix-0.0.1/src/boltix/auth/client.py +321 -0
  12. boltix-0.0.1/src/boltix/auth/raw_client.py +372 -0
  13. boltix-0.0.1/src/boltix/automation/__init__.py +37 -0
  14. boltix-0.0.1/src/boltix/automation/client.py +1646 -0
  15. boltix-0.0.1/src/boltix/automation/raw_client.py +1812 -0
  16. boltix-0.0.1/src/boltix/automation/types/__init__.py +38 -0
  17. boltix-0.0.1/src/boltix/automation/types/create_trigger_input_body_match_type.py +5 -0
  18. boltix-0.0.1/src/boltix/automation/types/update_trigger_input_body_match_type.py +5 -0
  19. boltix-0.0.1/src/boltix/campaigns/__init__.py +4 -0
  20. boltix-0.0.1/src/boltix/campaigns/client.py +934 -0
  21. boltix-0.0.1/src/boltix/campaigns/raw_client.py +1033 -0
  22. boltix-0.0.1/src/boltix/catalog/__init__.py +4 -0
  23. boltix-0.0.1/src/boltix/catalog/client.py +740 -0
  24. boltix-0.0.1/src/boltix/catalog/raw_client.py +824 -0
  25. boltix-0.0.1/src/boltix/channels/__init__.py +34 -0
  26. boltix-0.0.1/src/boltix/channels/client.py +565 -0
  27. boltix-0.0.1/src/boltix/channels/raw_client.py +619 -0
  28. boltix-0.0.1/src/boltix/channels/types/__init__.py +34 -0
  29. boltix-0.0.1/src/boltix/channels/types/update_channel_input_body_status.py +5 -0
  30. boltix-0.0.1/src/boltix/client.py +528 -0
  31. boltix-0.0.1/src/boltix/contacts/__init__.py +4 -0
  32. boltix-0.0.1/src/boltix/contacts/client.py +710 -0
  33. boltix-0.0.1/src/boltix/contacts/raw_client.py +792 -0
  34. boltix-0.0.1/src/boltix/core/__init__.py +127 -0
  35. boltix-0.0.1/src/boltix/core/api_error.py +23 -0
  36. boltix-0.0.1/src/boltix/core/client_wrapper.py +105 -0
  37. boltix-0.0.1/src/boltix/core/datetime_utils.py +70 -0
  38. boltix-0.0.1/src/boltix/core/file.py +67 -0
  39. boltix-0.0.1/src/boltix/core/force_multipart.py +18 -0
  40. boltix-0.0.1/src/boltix/core/http_client.py +839 -0
  41. boltix-0.0.1/src/boltix/core/http_response.py +59 -0
  42. boltix-0.0.1/src/boltix/core/http_sse/__init__.py +42 -0
  43. boltix-0.0.1/src/boltix/core/http_sse/_api.py +148 -0
  44. boltix-0.0.1/src/boltix/core/http_sse/_decoders.py +61 -0
  45. boltix-0.0.1/src/boltix/core/http_sse/_exceptions.py +7 -0
  46. boltix-0.0.1/src/boltix/core/http_sse/_models.py +17 -0
  47. boltix-0.0.1/src/boltix/core/jsonable_encoder.py +120 -0
  48. boltix-0.0.1/src/boltix/core/logging.py +107 -0
  49. boltix-0.0.1/src/boltix/core/parse_error.py +36 -0
  50. boltix-0.0.1/src/boltix/core/pydantic_utilities.py +634 -0
  51. boltix-0.0.1/src/boltix/core/query_encoder.py +58 -0
  52. boltix-0.0.1/src/boltix/core/remove_none_from_dict.py +11 -0
  53. boltix-0.0.1/src/boltix/core/request_options.py +35 -0
  54. boltix-0.0.1/src/boltix/core/serialization.py +276 -0
  55. boltix-0.0.1/src/boltix/environment.py +7 -0
  56. boltix-0.0.1/src/boltix/identity/__init__.py +4 -0
  57. boltix-0.0.1/src/boltix/identity/client.py +354 -0
  58. boltix-0.0.1/src/boltix/identity/raw_client.py +429 -0
  59. boltix-0.0.1/src/boltix/insights/__init__.py +61 -0
  60. boltix-0.0.1/src/boltix/insights/client.py +880 -0
  61. boltix-0.0.1/src/boltix/insights/raw_client.py +957 -0
  62. boltix-0.0.1/src/boltix/insights/types/__init__.py +59 -0
  63. boltix-0.0.1/src/boltix/insights/types/create_panel_input_body_data_source.py +7 -0
  64. boltix-0.0.1/src/boltix/insights/types/create_panel_input_body_display_type.py +5 -0
  65. boltix-0.0.1/src/boltix/insights/types/create_panel_input_body_metric.py +5 -0
  66. boltix-0.0.1/src/boltix/insights/types/create_panel_input_body_size.py +5 -0
  67. boltix-0.0.1/src/boltix/insights/types/update_panel_input_body_data_source.py +7 -0
  68. boltix-0.0.1/src/boltix/insights/types/update_panel_input_body_display_type.py +5 -0
  69. boltix-0.0.1/src/boltix/insights/types/update_panel_input_body_metric.py +5 -0
  70. boltix-0.0.1/src/boltix/insights/types/update_panel_input_body_size.py +5 -0
  71. boltix-0.0.1/src/boltix/intelligence/__init__.py +37 -0
  72. boltix-0.0.1/src/boltix/intelligence/client.py +572 -0
  73. boltix-0.0.1/src/boltix/intelligence/raw_client.py +624 -0
  74. boltix-0.0.1/src/boltix/intelligence/types/__init__.py +38 -0
  75. boltix-0.0.1/src/boltix/intelligence/types/create_context_input_body_context_type.py +5 -0
  76. boltix-0.0.1/src/boltix/intelligence/types/update_context_input_body_context_type.py +5 -0
  77. boltix-0.0.1/src/boltix/media/__init__.py +4 -0
  78. boltix-0.0.1/src/boltix/media/client.py +204 -0
  79. boltix-0.0.1/src/boltix/media/raw_client.py +235 -0
  80. boltix-0.0.1/src/boltix/messages/__init__.py +4 -0
  81. boltix-0.0.1/src/boltix/messages/client.py +318 -0
  82. boltix-0.0.1/src/boltix/messages/raw_client.py +338 -0
  83. boltix-0.0.1/src/boltix/organizations/__init__.py +4 -0
  84. boltix-0.0.1/src/boltix/organizations/client.py +262 -0
  85. boltix-0.0.1/src/boltix/organizations/raw_client.py +313 -0
  86. boltix-0.0.1/src/boltix/routing/__init__.py +49 -0
  87. boltix-0.0.1/src/boltix/routing/client.py +1194 -0
  88. boltix-0.0.1/src/boltix/routing/raw_client.py +1362 -0
  89. boltix-0.0.1/src/boltix/routing/types/__init__.py +47 -0
  90. boltix-0.0.1/src/boltix/routing/types/add_agent_input_body_role.py +5 -0
  91. boltix-0.0.1/src/boltix/routing/types/create_handoff_input_body_source.py +7 -0
  92. boltix-0.0.1/src/boltix/routing/types/create_team_input_body_assignment_strategy.py +7 -0
  93. boltix-0.0.1/src/boltix/routing/types/update_team_input_body_assignment_strategy.py +7 -0
  94. boltix-0.0.1/src/boltix/snippets/__init__.py +4 -0
  95. boltix-0.0.1/src/boltix/snippets/client.py +526 -0
  96. boltix-0.0.1/src/boltix/snippets/raw_client.py +578 -0
  97. boltix-0.0.1/src/boltix/tags/__init__.py +34 -0
  98. boltix-0.0.1/src/boltix/tags/client.py +350 -0
  99. boltix-0.0.1/src/boltix/tags/raw_client.py +406 -0
  100. boltix-0.0.1/src/boltix/tags/types/__init__.py +38 -0
  101. boltix-0.0.1/src/boltix/tags/types/create_tag_input_body_color.py +5 -0
  102. boltix-0.0.1/src/boltix/tags/types/update_tag_input_body_color.py +5 -0
  103. boltix-0.0.1/src/boltix/templates/__init__.py +4 -0
  104. boltix-0.0.1/src/boltix/templates/client.py +854 -0
  105. boltix-0.0.1/src/boltix/templates/raw_client.py +908 -0
  106. boltix-0.0.1/src/boltix/tests/conftest.py +21 -0
  107. boltix-0.0.1/src/boltix/tests/test_aiohttp_autodetect.py +113 -0
  108. boltix-0.0.1/src/boltix/types/__init__.py +218 -0
  109. boltix-0.0.1/src/boltix/types/action_response.py +71 -0
  110. boltix-0.0.1/src/boltix/types/add_recipients_output_body.py +30 -0
  111. boltix-0.0.1/src/boltix/types/agent_response.py +60 -0
  112. boltix-0.0.1/src/boltix/types/automation_config_response.py +129 -0
  113. boltix-0.0.1/src/boltix/types/automation_trigger_response.py +115 -0
  114. boltix-0.0.1/src/boltix/types/automation_workflow_response.py +130 -0
  115. boltix-0.0.1/src/boltix/types/campaign_response.py +135 -0
  116. boltix-0.0.1/src/boltix/types/channel_response.py +101 -0
  117. boltix-0.0.1/src/boltix/types/channel_response_status.py +5 -0
  118. boltix-0.0.1/src/boltix/types/chart_data_point_response.py +27 -0
  119. boltix-0.0.1/src/boltix/types/contact_response.py +98 -0
  120. boltix-0.0.1/src/boltix/types/create_download_url_output_body.py +34 -0
  121. boltix-0.0.1/src/boltix/types/create_upload_url_output_body.py +39 -0
  122. boltix-0.0.1/src/boltix/types/error_detail.py +32 -0
  123. boltix-0.0.1/src/boltix/types/error_model.py +55 -0
  124. boltix-0.0.1/src/boltix/types/event_response.py +66 -0
  125. boltix-0.0.1/src/boltix/types/handoff_response.py +135 -0
  126. boltix-0.0.1/src/boltix/types/identity_account_response.py +85 -0
  127. boltix-0.0.1/src/boltix/types/intelligence_context_response.py +92 -0
  128. boltix-0.0.1/src/boltix/types/intelligence_context_response_context_type.py +5 -0
  129. boltix-0.0.1/src/boltix/types/list_accounts_output_body.py +30 -0
  130. boltix-0.0.1/src/boltix/types/list_actions_output_body.py +30 -0
  131. boltix-0.0.1/src/boltix/types/list_agents_output_body.py +30 -0
  132. boltix-0.0.1/src/boltix/types/list_campaigns_output_body.py +30 -0
  133. boltix-0.0.1/src/boltix/types/list_channels_output_body.py +30 -0
  134. boltix-0.0.1/src/boltix/types/list_contacts_output_body.py +30 -0
  135. boltix-0.0.1/src/boltix/types/list_contexts_output_body.py +30 -0
  136. boltix-0.0.1/src/boltix/types/list_events_output_body.py +30 -0
  137. boltix-0.0.1/src/boltix/types/list_handoffs_output_body.py +30 -0
  138. boltix-0.0.1/src/boltix/types/list_messages_output_body.py +30 -0
  139. boltix-0.0.1/src/boltix/types/list_organizations_output_body.py +30 -0
  140. boltix-0.0.1/src/boltix/types/list_panels_output_body.py +30 -0
  141. boltix-0.0.1/src/boltix/types/list_products_output_body.py +30 -0
  142. boltix-0.0.1/src/boltix/types/list_recipients_output_body.py +30 -0
  143. boltix-0.0.1/src/boltix/types/list_snippets_output_body.py +30 -0
  144. boltix-0.0.1/src/boltix/types/list_stores_output_body.py +30 -0
  145. boltix-0.0.1/src/boltix/types/list_tags_output_body.py +30 -0
  146. boltix-0.0.1/src/boltix/types/list_teams_output_body.py +30 -0
  147. boltix-0.0.1/src/boltix/types/list_templates_output_body.py +30 -0
  148. boltix-0.0.1/src/boltix/types/list_triggers_output_body.py +30 -0
  149. boltix-0.0.1/src/boltix/types/list_webhooks_output_body.py +30 -0
  150. boltix-0.0.1/src/boltix/types/list_workflows_output_body.py +30 -0
  151. boltix-0.0.1/src/boltix/types/login_output_body.py +45 -0
  152. boltix-0.0.1/src/boltix/types/message_response.py +126 -0
  153. boltix-0.0.1/src/boltix/types/organization_response.py +55 -0
  154. boltix-0.0.1/src/boltix/types/panel_data_response.py +45 -0
  155. boltix-0.0.1/src/boltix/types/panel_filter_input.py +33 -0
  156. boltix-0.0.1/src/boltix/types/panel_filter_input_operator.py +7 -0
  157. boltix-0.0.1/src/boltix/types/panel_filter_response.py +32 -0
  158. boltix-0.0.1/src/boltix/types/panel_response.py +151 -0
  159. boltix-0.0.1/src/boltix/types/product_response.py +100 -0
  160. boltix-0.0.1/src/boltix/types/recipient_input.py +37 -0
  161. boltix-0.0.1/src/boltix/types/recipient_response.py +85 -0
  162. boltix-0.0.1/src/boltix/types/refresh_output_body.py +39 -0
  163. boltix-0.0.1/src/boltix/types/register_output_body.py +30 -0
  164. boltix-0.0.1/src/boltix/types/snippet_response.py +81 -0
  165. boltix-0.0.1/src/boltix/types/store_response.py +70 -0
  166. boltix-0.0.1/src/boltix/types/tag_response.py +50 -0
  167. boltix-0.0.1/src/boltix/types/team_response.py +80 -0
  168. boltix-0.0.1/src/boltix/types/template_response.py +127 -0
  169. boltix-0.0.1/src/boltix/types/webhook_response.py +67 -0
  170. boltix-0.0.1/src/boltix/webhooks/__init__.py +4 -0
  171. boltix-0.0.1/src/boltix/webhooks/client.py +1078 -0
  172. boltix-0.0.1/src/boltix/webhooks/raw_client.py +1202 -0
  173. boltix-0.0.1/src/boltix.egg-info/PKG-INFO +200 -0
  174. boltix-0.0.1/src/boltix.egg-info/SOURCES.txt +175 -0
  175. boltix-0.0.1/src/boltix.egg-info/dependency_links.txt +1 -0
  176. boltix-0.0.1/src/boltix.egg-info/requires.txt +3 -0
  177. boltix-0.0.1/src/boltix.egg-info/top_level.txt +1 -0
boltix-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,200 @@
1
+ Metadata-Version: 2.4
2
+ Name: boltix
3
+ Version: 0.0.1
4
+ Summary: Boltix API Python SDK
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: httpx>=0.21.2
8
+ Requires-Dist: pydantic>=1.9.2
9
+ Requires-Dist: typing_extensions>=4.0.0
10
+
11
+ # Boltix Python Library
12
+
13
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=Boltix%2FPython)
14
+ [![pypi](https://img.shields.io/pypi/v/boltix)](https://pypi.python.org/pypi/boltix)
15
+
16
+ The Boltix Python library provides convenient access to the Boltix APIs from Python.
17
+
18
+ ## Table of Contents
19
+
20
+ - [Installation](#installation)
21
+ - [Reference](#reference)
22
+ - [Usage](#usage)
23
+ - [Environments](#environments)
24
+ - [Async Client](#async-client)
25
+ - [Exception Handling](#exception-handling)
26
+ - [Advanced](#advanced)
27
+ - [Access Raw Response Data](#access-raw-response-data)
28
+ - [Retries](#retries)
29
+ - [Timeouts](#timeouts)
30
+ - [Custom Client](#custom-client)
31
+ - [Contributing](#contributing)
32
+
33
+ ## Installation
34
+
35
+ ```sh
36
+ pip install boltix
37
+ ```
38
+
39
+ ## Reference
40
+
41
+ A full reference for this library is available [here](./reference.md).
42
+
43
+ ## Usage
44
+
45
+ Instantiate and use the client with the following:
46
+
47
+ ```python
48
+ from boltix import BoltixApi
49
+
50
+ client = BoltixApi(
51
+ token="<token>",
52
+ )
53
+
54
+ client.identity.create_account(
55
+ email="email",
56
+ password="password",
57
+ )
58
+ ```
59
+
60
+ ## Environments
61
+
62
+ This SDK allows you to configure different environments for API requests.
63
+
64
+ ```python
65
+ from boltix import BoltixApi
66
+ from boltix.environment import BoltixApiEnvironment
67
+
68
+ client = BoltixApi(
69
+ environment=BoltixApiEnvironment.PRODUCTION,
70
+ )
71
+ ```
72
+
73
+ ## Async Client
74
+
75
+ The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
76
+
77
+ ```python
78
+ import asyncio
79
+
80
+ from boltix import AsyncBoltixApi
81
+
82
+ client = AsyncBoltixApi(
83
+ token="<token>",
84
+ )
85
+
86
+
87
+ async def main() -> None:
88
+ await client.identity.create_account(
89
+ email="email",
90
+ password="password",
91
+ )
92
+
93
+
94
+ asyncio.run(main())
95
+ ```
96
+
97
+ ## Exception Handling
98
+
99
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
100
+ will be thrown.
101
+
102
+ ```python
103
+ from boltix.core.api_error import ApiError
104
+
105
+ try:
106
+ client.identity.create_account(...)
107
+ except ApiError as e:
108
+ print(e.status_code)
109
+ print(e.body)
110
+ ```
111
+
112
+ ## Advanced
113
+
114
+ ### Access Raw Response Data
115
+
116
+ The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
117
+ The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
118
+
119
+ ```python
120
+ from boltix import BoltixApi
121
+
122
+ client = BoltixApi(...)
123
+ response = client.identity.with_raw_response.create_account(...)
124
+ print(response.headers) # access the response headers
125
+ print(response.status_code) # access the response status code
126
+ print(response.data) # access the underlying object
127
+ ```
128
+
129
+ ### Retries
130
+
131
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
132
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
133
+ retry limit (default: 2).
134
+
135
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
136
+
137
+ **`legacy`** (current default): retries on
138
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
139
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
140
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
141
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
142
+
143
+ **`recommended`**: retries on
144
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
145
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
146
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
147
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
148
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
149
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
150
+
151
+ Use the `max_retries` request option to configure this behavior.
152
+
153
+ ```python
154
+ client.identity.create_account(..., request_options={
155
+ "max_retries": 1
156
+ })
157
+ ```
158
+
159
+ ### Timeouts
160
+
161
+ The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
162
+
163
+ ```python
164
+ from boltix import BoltixApi
165
+
166
+ client = BoltixApi(..., timeout=20.0)
167
+
168
+ # Override timeout for a specific method
169
+ client.identity.create_account(..., request_options={
170
+ "timeout_in_seconds": 1
171
+ })
172
+ ```
173
+
174
+ ### Custom Client
175
+
176
+ You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
177
+ and transports.
178
+
179
+ ```python
180
+ import httpx
181
+ from boltix import BoltixApi
182
+
183
+ client = BoltixApi(
184
+ ...,
185
+ httpx_client=httpx.Client(
186
+ proxy="http://my.test.proxy.example.com",
187
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
188
+ ),
189
+ )
190
+ ```
191
+
192
+ ## Contributing
193
+
194
+ While we value open-source contributions to this SDK, this library is generated programmatically.
195
+ Additions made directly to this library would have to be moved over to our generation code,
196
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
197
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
198
+ an issue first to discuss with us!
199
+
200
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,35 @@
1
+ # Packaging for the Boltix Python SDK.
2
+ #
3
+ # This file is HAND-WRITTEN and lives OUTSIDE `src/` on purpose: Fern's
4
+ # fern-python-sdk generator (run via `make sdk-generate`) wipes and rewrites its
5
+ # output directory, which is `src/boltix/` (see fern/generators.yml). The
6
+ # generator does not emit packaging metadata when targeting local-file-system,
7
+ # so we provide a setuptools src-layout config here.
8
+ #
9
+ # The version is a placeholder (`0.0.0`); the tag-triggered publish workflow
10
+ # (.github/workflows/sdk-publish.yml) stamps the real release version into this
11
+ # file transiently before running `python -m build` and never commits the bump.
12
+ # The package name `boltix` is also a placeholder to be confirmed before the
13
+ # first real PyPI publish (publishing is gated behind SDK_PUBLISH_ENABLED).
14
+
15
+ [build-system]
16
+ requires = ["setuptools>=61.0", "wheel"]
17
+ build-backend = "setuptools.build_meta"
18
+
19
+ [project]
20
+ name = "boltix"
21
+ version = "0.0.1"
22
+ description = "Boltix API Python SDK"
23
+ readme = "src/boltix/README.md"
24
+ requires-python = ">=3.8"
25
+ dependencies = [
26
+ "httpx>=0.21.2",
27
+ "pydantic>=1.9.2",
28
+ "typing_extensions>=4.0.0",
29
+ ]
30
+
31
+ [tool.setuptools.packages.find]
32
+ where = ["src"]
33
+
34
+ [tool.setuptools.package-data]
35
+ "*" = ["py.typed", "*.pyi"]
boltix-0.0.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,190 @@
1
+ # Boltix Python Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=Boltix%2FPython)
4
+ [![pypi](https://img.shields.io/pypi/v/boltix)](https://pypi.python.org/pypi/boltix)
5
+
6
+ The Boltix Python library provides convenient access to the Boltix APIs from Python.
7
+
8
+ ## Table of Contents
9
+
10
+ - [Installation](#installation)
11
+ - [Reference](#reference)
12
+ - [Usage](#usage)
13
+ - [Environments](#environments)
14
+ - [Async Client](#async-client)
15
+ - [Exception Handling](#exception-handling)
16
+ - [Advanced](#advanced)
17
+ - [Access Raw Response Data](#access-raw-response-data)
18
+ - [Retries](#retries)
19
+ - [Timeouts](#timeouts)
20
+ - [Custom Client](#custom-client)
21
+ - [Contributing](#contributing)
22
+
23
+ ## Installation
24
+
25
+ ```sh
26
+ pip install boltix
27
+ ```
28
+
29
+ ## Reference
30
+
31
+ A full reference for this library is available [here](./reference.md).
32
+
33
+ ## Usage
34
+
35
+ Instantiate and use the client with the following:
36
+
37
+ ```python
38
+ from boltix import BoltixApi
39
+
40
+ client = BoltixApi(
41
+ token="<token>",
42
+ )
43
+
44
+ client.identity.create_account(
45
+ email="email",
46
+ password="password",
47
+ )
48
+ ```
49
+
50
+ ## Environments
51
+
52
+ This SDK allows you to configure different environments for API requests.
53
+
54
+ ```python
55
+ from boltix import BoltixApi
56
+ from boltix.environment import BoltixApiEnvironment
57
+
58
+ client = BoltixApi(
59
+ environment=BoltixApiEnvironment.PRODUCTION,
60
+ )
61
+ ```
62
+
63
+ ## Async Client
64
+
65
+ The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
66
+
67
+ ```python
68
+ import asyncio
69
+
70
+ from boltix import AsyncBoltixApi
71
+
72
+ client = AsyncBoltixApi(
73
+ token="<token>",
74
+ )
75
+
76
+
77
+ async def main() -> None:
78
+ await client.identity.create_account(
79
+ email="email",
80
+ password="password",
81
+ )
82
+
83
+
84
+ asyncio.run(main())
85
+ ```
86
+
87
+ ## Exception Handling
88
+
89
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
90
+ will be thrown.
91
+
92
+ ```python
93
+ from boltix.core.api_error import ApiError
94
+
95
+ try:
96
+ client.identity.create_account(...)
97
+ except ApiError as e:
98
+ print(e.status_code)
99
+ print(e.body)
100
+ ```
101
+
102
+ ## Advanced
103
+
104
+ ### Access Raw Response Data
105
+
106
+ The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
107
+ The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
108
+
109
+ ```python
110
+ from boltix import BoltixApi
111
+
112
+ client = BoltixApi(...)
113
+ response = client.identity.with_raw_response.create_account(...)
114
+ print(response.headers) # access the response headers
115
+ print(response.status_code) # access the response status code
116
+ print(response.data) # access the underlying object
117
+ ```
118
+
119
+ ### Retries
120
+
121
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
122
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
123
+ retry limit (default: 2).
124
+
125
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
126
+
127
+ **`legacy`** (current default): retries on
128
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
129
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
130
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
131
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
132
+
133
+ **`recommended`**: retries on
134
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
135
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
136
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
137
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
138
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
139
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
140
+
141
+ Use the `max_retries` request option to configure this behavior.
142
+
143
+ ```python
144
+ client.identity.create_account(..., request_options={
145
+ "max_retries": 1
146
+ })
147
+ ```
148
+
149
+ ### Timeouts
150
+
151
+ The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
152
+
153
+ ```python
154
+ from boltix import BoltixApi
155
+
156
+ client = BoltixApi(..., timeout=20.0)
157
+
158
+ # Override timeout for a specific method
159
+ client.identity.create_account(..., request_options={
160
+ "timeout_in_seconds": 1
161
+ })
162
+ ```
163
+
164
+ ### Custom Client
165
+
166
+ You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
167
+ and transports.
168
+
169
+ ```python
170
+ import httpx
171
+ from boltix import BoltixApi
172
+
173
+ client = BoltixApi(
174
+ ...,
175
+ httpx_client=httpx.Client(
176
+ proxy="http://my.test.proxy.example.com",
177
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
178
+ ),
179
+ )
180
+ ```
181
+
182
+ ## Contributing
183
+
184
+ While we value open-source contributions to this SDK, this library is generated programmatically.
185
+ Additions made directly to this library would have to be moved over to our generation code,
186
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
187
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
188
+ an issue first to discuss with us!
189
+
190
+ On the other hand, contributions to the README are always very welcome!