Skip to content

Commit 028b445

Browse files
committed
feat(api): updates (#13)
1 parent cbecaf8 commit 028b445

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3943
-299
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 73
1+
configured_endpoints: 74

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,27 @@ if response.my_field is None:
278278
print('Got json like {"my_field": null}.')
279279
```
280280

281+
### Accessing raw response data (e.g. headers)
282+
283+
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call.
284+
285+
```py
286+
from orb import Orb
287+
288+
client = Orb()
289+
response = client.customers.with_raw_response.create(
290+
email="string",
291+
name="string",
292+
)
293+
294+
print(response.headers.get('X-My-Header'))
295+
296+
customer = response.parse() # get the object that `customers.create()` would have returned
297+
print(customer.id)
298+
```
299+
300+
These methods return an [`APIResponse`](https://github.com/orbcorp/orb-python/src/orb/_response.py) object.
301+
281302
### Configuring the HTTP client
282303

283304
You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:

api.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,14 @@ Methods:
220220
Types:
221221

222222
```python
223-
from orb.types import ItemListResponse, ItemFetchResponse
223+
from orb.types import Item
224224
```
225225

226226
Methods:
227227

228-
- <code title="get /items">client.items.<a href="./src/orb/resources/items.py">list</a>(\*\*<a href="src/orb/types/item_list_params.py">params</a>) -> <a href="./src/orb/types/item_list_response.py">SyncPage[ItemListResponse]</a></code>
229-
- <code title="get /items/{item_id}">client.items.<a href="./src/orb/resources/items.py">fetch</a>(item_id) -> <a href="./src/orb/types/item_fetch_response.py">ItemFetchResponse</a></code>
228+
- <code title="post /items">client.items.<a href="./src/orb/resources/items.py">create</a>(\*\*<a href="src/orb/types/item_create_params.py">params</a>) -> <a href="./src/orb/types/item.py">Item</a></code>
229+
- <code title="get /items">client.items.<a href="./src/orb/resources/items.py">list</a>(\*\*<a href="src/orb/types/item_list_params.py">params</a>) -> <a href="./src/orb/types/item.py">SyncPage[Item]</a></code>
230+
- <code title="get /items/{item_id}">client.items.<a href="./src/orb/resources/items.py">fetch</a>(item_id) -> <a href="./src/orb/types/item.py">Item</a></code>
230231

231232
# Metrics
232233

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ format = { chain = [
5858

5959
typecheck = { chain = [
6060
"typecheck:pyright",
61-
"typecheck:verify-types",
6261
"typecheck:mypy"
6362
]}
6463
"typecheck:pyright" = "pyright"

src/orb/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
ResourceTooLarge,
3333
APIConnectionError,
3434
AuthenticationError,
35+
ConstraintViolation,
3536
FeatureNotAvailable,
3637
InternalServerError,
3738
PermissionDeniedError,
@@ -65,6 +66,7 @@
6566
"UnprocessableEntityError",
6667
"RateLimitError",
6768
"InternalServerError",
69+
"ConstraintViolation",
6870
"DuplicateResourceCreation",
6971
"RequestValidationError",
7072
"OrbAuthenticationError",

0 commit comments

Comments
 (0)