Skip to content

Commit 2c0fede

Browse files
Stainless Botstainless-app[bot]
authored andcommitted
feat(api): codegen changes (#367)
1 parent 9cb7f6b commit 2c0fede

File tree

184 files changed

+3064
-4412
lines changed

Some content is hidden

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

184 files changed

+3064
-4412
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 93
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-7ae6544b3567d683dd64c5caff02b49ffc0dc4897d0a91738b0162f36a7ddee7.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-64dd0f92903194da778c07c4d6f30af1dc58586b5870a1c5a2291a420f42e1ae.yml

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ client = AsyncOrb(
5656
api_key=os.environ.get("ORB_API_KEY"),
5757
)
5858

59+
5960
async def main() -> None:
60-
customer = await client.customers.create(
61-
62-
name="My Customer",
63-
)
64-
print(customer.id)
61+
customer = await client.customers.create(
62+
63+
name="My Customer",
64+
)
65+
print(customer.id)
66+
6567

6668
asyncio.run(main())
6769
```
@@ -104,13 +106,15 @@ from orb import AsyncOrb
104106

105107
client = AsyncOrb()
106108

109+
107110
async def main() -> None:
108111
all_coupons = []
109112
# Iterate through items across all pages, issuing requests as needed.
110113
async for coupon in client.coupons.list():
111114
all_coupons.append(coupon)
112115
print(all_coupons)
113116

117+
114118
asyncio.run(main())
115119
```
116120

@@ -131,7 +135,9 @@ Or just work directly with the returned data:
131135
```python
132136
first_page = await client.coupons.list()
133137

134-
print(f"next page cursor: {first_page.pagination_metadata.next_cursor}") # => "next page cursor: ..."
138+
print(
139+
f"next page cursor: {first_page.pagination_metadata.next_cursor}"
140+
) # => "next page cursor: ..."
135141
for coupon in first_page.data:
136142
print(coupon.id)
137143

@@ -204,7 +210,7 @@ try:
204210
)
205211
except orb.APIConnectionError as e:
206212
print("The server could not be reached")
207-
print(e.__cause__) # an underlying Exception, likely raised within httpx.
213+
print(e.__cause__) # an underlying Exception, likely raised within httpx.
208214
except orb.RateLimitError as e:
209215
print("A 429 status code was received; we should back off a bit.")
210216
except orb.APIStatusError as e:
@@ -244,7 +250,7 @@ client = Orb(
244250
)
245251

246252
# Or, configure per-request:
247-
client.with_options(max_retries = 5).customers.create(
253+
client.with_options(max_retries=5).customers.create(
248254
249255
name="My Customer",
250256
)
@@ -270,7 +276,7 @@ client = Orb(
270276
)
271277

272278
# Override per-request:
273-
client.with_options(timeout = 5.0).customers.create(
279+
client.with_options(timeout=5.0).customers.create(
274280
275281
name="My Customer",
276282
)
@@ -343,11 +349,11 @@ As such, `.with_streaming_response` methods return a different [`APIResponse`](h
343349
with client.customers.with_streaming_response.create(
344350
345351
name="My Customer",
346-
) as response :
347-
print(response.headers.get('X-My-Header'))
352+
) as response:
353+
print(response.headers.get("X-My-Header"))
348354

349355
for line in response.iter_lines():
350-
print(line)
356+
print(line)
351357
```
352358

353359
The context manager is required so that the response will reliably be closed.
@@ -401,7 +407,10 @@ from orb import Orb, DefaultHttpxClient
401407
client = Orb(
402408
# Or use the `ORB_BASE_URL` env var
403409
base_url="http://my.test.server.example.com:8083",
404-
http_client=DefaultHttpxClient(proxies="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),
410+
http_client=DefaultHttpxClient(
411+
proxies="http://my.test.proxy.example.com",
412+
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
413+
),
405414
)
406415
```
407416

api.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ Methods:
9999
Types:
100100

101101
```python
102-
from orb.types.customers.credits import LedgerListResponse, LedgerCreateEntryResponse, LedgerCreateEntryByExternalIDResponse, LedgerListByExternalIDResponse
102+
from orb.types.customers.credits import (
103+
LedgerListResponse,
104+
LedgerCreateEntryResponse,
105+
LedgerCreateEntryByExternalIDResponse,
106+
LedgerListByExternalIDResponse,
107+
)
103108
```
104109

105110
Methods:
@@ -114,7 +119,12 @@ Methods:
114119
Types:
115120

116121
```python
117-
from orb.types.customers.credits import TopUpCreateResponse, TopUpListResponse, TopUpCreateByExternalIDResponse, TopUpListByExternalIDResponse
122+
from orb.types.customers.credits import (
123+
TopUpCreateResponse,
124+
TopUpListResponse,
125+
TopUpCreateByExternalIDResponse,
126+
TopUpListByExternalIDResponse,
127+
)
118128
```
119129

120130
Methods:
@@ -144,7 +154,12 @@ Methods:
144154
Types:
145155

146156
```python
147-
from orb.types import EventUpdateResponse, EventDeprecateResponse, EventIngestResponse, EventSearchResponse
157+
from orb.types import (
158+
EventUpdateResponse,
159+
EventDeprecateResponse,
160+
EventIngestResponse,
161+
EventSearchResponse,
162+
)
148163
```
149164

150165
Methods:
@@ -159,7 +174,13 @@ Methods:
159174
Types:
160175

161176
```python
162-
from orb.types.events import BackfillCreateResponse, BackfillListResponse, BackfillCloseResponse, BackfillFetchResponse, BackfillRevertResponse
177+
from orb.types.events import (
178+
BackfillCreateResponse,
179+
BackfillListResponse,
180+
BackfillCloseResponse,
181+
BackfillFetchResponse,
182+
BackfillRevertResponse,
183+
)
163184
```
164185

165186
Methods:
@@ -281,7 +302,13 @@ Methods:
281302
Types:
282303

283304
```python
284-
from orb.types import Subscription, SubscriptionUsage, Subscriptions, SubscriptionFetchCostsResponse, SubscriptionFetchScheduleResponse
305+
from orb.types import (
306+
Subscription,
307+
SubscriptionUsage,
308+
Subscriptions,
309+
SubscriptionFetchCostsResponse,
310+
SubscriptionFetchScheduleResponse,
311+
)
285312
```
286313

287314
Methods:

src/orb/__init__.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
from . import types
4-
from ._version import __version__, __title__
5-
from ._client import Timeout, Transport, RequestOptions, Client, AsyncClient, Stream, AsyncStream, Orb, AsyncOrb
4+
from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes
5+
from ._utils import file_from_path
6+
from ._client import Orb, Client, Stream, Timeout, AsyncOrb, Transport, AsyncClient, AsyncStream, RequestOptions
7+
from ._models import BaseModel
8+
from ._version import __title__, __version__
9+
from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse
10+
from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS
611
from ._exceptions import (
7-
OrbError,
812
APIError,
13+
OrbError,
14+
URLNotFound,
15+
ConflictError,
16+
NotFoundError,
917
APIStatusError,
18+
RateLimitError,
1019
APITimeoutError,
11-
APIConnectionError,
12-
APIResponseValidationError,
1320
BadRequestError,
21+
RequestTooLarge,
22+
TooManyRequests,
23+
ResourceConflict,
24+
ResourceNotFound,
25+
ResourceTooLarge,
26+
APIConnectionError,
1427
AuthenticationError,
15-
PermissionDeniedError,
16-
NotFoundError,
17-
ConflictError,
18-
UnprocessableEntityError,
19-
RateLimitError,
20-
InternalServerError,
2128
ConstraintViolation,
22-
DuplicateResourceCreation,
23-
RequestValidationError,
24-
OrbAuthenticationError,
2529
FeatureNotAvailable,
26-
ResourceNotFound,
27-
URLNotFound,
28-
ResourceConflict,
29-
RequestTooLarge,
30-
ResourceTooLarge,
31-
TooManyRequests,
30+
InternalServerError,
31+
PermissionDeniedError,
32+
OrbAuthenticationError,
3233
OrbInternalServerError,
34+
RequestValidationError,
35+
UnprocessableEntityError,
36+
DuplicateResourceCreation,
37+
APIResponseValidationError,
3338
)
34-
from ._types import NoneType, Transport, ProxiesTypes, NotGiven, NOT_GIVEN
35-
from ._utils import file_from_path
36-
from ._models import BaseModel
37-
from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS
3839
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
3940
from ._utils._logs import setup_logging as _setup_logging
40-
from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse
4141

4242
__all__ = [
4343
"types",
@@ -101,7 +101,7 @@
101101
for __name in __all__:
102102
if not __name.startswith("__"):
103103
try:
104-
setattr(__locals[__name], "__module__", "orb")
104+
__locals[__name].__module__ = "orb"
105105
except (TypeError, AttributeError):
106106
# Some of our exported symbols are builtins which we can't set attributes for.
107107
pass

src/orb/_client.py

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,67 +2,36 @@
22

33
from __future__ import annotations
44

5-
import httpx
6-
7-
import os
8-
9-
from ._streaming import AsyncStream as AsyncStream, Stream as Stream
10-
11-
from ._exceptions import OrbError, APIStatusError
12-
13-
from typing_extensions import override, Self
14-
15-
from typing import Any
16-
17-
from ._utils import is_mapping, get_async_library
18-
19-
from . import _exceptions
20-
215
import os
22-
import asyncio
23-
import warnings
24-
from typing import Optional, Union, Dict, Any, Mapping, overload, cast
25-
from typing_extensions import Literal
6+
from typing import Any, Union, Mapping
7+
from typing_extensions import Self, override
268

279
import httpx
2810

29-
from ._version import __version__
11+
from . import resources, _exceptions
3012
from ._qs import Querystring
31-
from ._utils import (
32-
extract_files,
33-
maybe_transform,
34-
required_args,
35-
deepcopy_minimal,
36-
maybe_coerce_integer,
37-
maybe_coerce_float,
38-
maybe_coerce_boolean,
39-
is_given,
40-
)
4113
from ._types import (
14+
NOT_GIVEN,
4215
Omit,
43-
NotGiven,
4416
Timeout,
17+
NotGiven,
4518
Transport,
4619
ProxiesTypes,
4720
RequestOptions,
48-
Headers,
49-
NoneType,
50-
Query,
51-
Body,
52-
NOT_GIVEN,
5321
)
22+
from ._utils import (
23+
is_given,
24+
is_mapping,
25+
get_async_library,
26+
)
27+
from ._version import __version__
28+
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
29+
from ._exceptions import OrbError, APIStatusError
5430
from ._base_client import (
55-
DEFAULT_CONNECTION_LIMITS,
56-
DEFAULT_TIMEOUT,
5731
DEFAULT_MAX_RETRIES,
58-
ResponseT,
59-
SyncHttpxClientWrapper,
60-
AsyncHttpxClientWrapper,
6132
SyncAPIClient,
6233
AsyncAPIClient,
63-
make_request_options,
6434
)
65-
from . import resources
6635

6736
__all__ = [
6837
"Timeout",

0 commit comments

Comments
 (0)