Skip to content

Commit 3beb328

Browse files
committed
feat(api): update via SDK Studio
1 parent 0ad9c15 commit 3beb328

33 files changed

+302
-638
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ client = OneBusAway(
3535
api_key=os.environ.get("ONEBUSAWAY_API_KEY"),
3636
)
3737

38-
current_time_retrieve_response = client.api.where.current_time.retrieve()
38+
current_time_retrieve_response = client.current_time.retrieve()
3939
```
4040

4141
While you can provide an `api_key` keyword argument,
@@ -59,7 +59,7 @@ client = AsyncOneBusAway(
5959

6060

6161
async def main() -> None:
62-
current_time_retrieve_response = await client.api.where.current_time.retrieve()
62+
current_time_retrieve_response = await client.current_time.retrieve()
6363

6464

6565
asyncio.run(main())
@@ -92,7 +92,7 @@ from open_transit import OneBusAway
9292
client = OneBusAway()
9393

9494
try:
95-
client.api.where.current_time.retrieve()
95+
client.current_time.retrieve()
9696
except open_transit.APIConnectionError as e:
9797
print("The server could not be reached")
9898
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -135,7 +135,7 @@ client = OneBusAway(
135135
)
136136

137137
# Or, configure per-request:
138-
client.with_options(max_retries=5).api.where.current_time.retrieve()
138+
client.with_options(max_retries=5).current_time.retrieve()
139139
```
140140

141141
### Timeouts
@@ -158,7 +158,7 @@ client = OneBusAway(
158158
)
159159

160160
# Override per-request:
161-
client.with_options(timeout=5.0).api.where.current_time.retrieve()
161+
client.with_options(timeout=5.0).current_time.retrieve()
162162
```
163163

164164
On timeout, an `APITimeoutError` is thrown.
@@ -197,10 +197,10 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
197197
from open_transit import OneBusAway
198198

199199
client = OneBusAway()
200-
response = client.api.where.current_time.with_raw_response.retrieve()
200+
response = client.current_time.with_raw_response.retrieve()
201201
print(response.headers.get('X-My-Header'))
202202

203-
current_time = response.parse() # get the object that `api.where.current_time.retrieve()` would have returned
203+
current_time = response.parse() # get the object that `current_time.retrieve()` would have returned
204204
print(current_time)
205205
```
206206

@@ -215,7 +215,7 @@ The above interface eagerly reads the full response body when you make the reque
215215
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
216216

217217
```python
218-
with client.api.where.current_time.with_streaming_response.retrieve() as response:
218+
with client.current_time.with_streaming_response.retrieve() as response:
219219
print(response.headers.get("X-My-Header"))
220220

221221
for line in response.iter_lines():

api.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,78 +4,74 @@
44
from open_transit.types import ResponseWrapper
55
```
66

7-
# API
8-
9-
## Where
10-
11-
### AgenciesWithCoverage
7+
# AgenciesWithCoverage
128

139
Types:
1410

1511
```python
16-
from open_transit.types.api.where import AgenciesWithCoverageListResponse
12+
from open_transit.types import AgenciesWithCoverageListResponse
1713
```
1814

1915
Methods:
2016

21-
- <code title="get /api/where/agencies-with-coverage.json">client.api.where.agencies_with_coverage.<a href="./src/open_transit/resources/api/where/agencies_with_coverage.py">list</a>() -> <a href="./src/open_transit/types/api/where/agencies_with_coverage_list_response.py">AgenciesWithCoverageListResponse</a></code>
17+
- <code title="get /api/where/agencies-with-coverage.json">client.agencies_with_coverage.<a href="./src/open_transit/resources/agencies_with_coverage.py">list</a>() -> <a href="./src/open_transit/types/agencies_with_coverage_list_response.py">AgenciesWithCoverageListResponse</a></code>
2218

23-
### Config
19+
# Config
2420

2521
Types:
2622

2723
```python
28-
from open_transit.types.api.where import ConfigRetrieveResponse
24+
from open_transit.types import ConfigRetrieveResponse
2925
```
3026

3127
Methods:
3228

33-
- <code title="get /api/where/config.json">client.api.where.config.<a href="./src/open_transit/resources/api/where/config.py">retrieve</a>() -> <a href="./src/open_transit/types/api/where/config_retrieve_response.py">ConfigRetrieveResponse</a></code>
29+
- <code title="get /api/where/config.json">client.config.<a href="./src/open_transit/resources/config.py">retrieve</a>() -> <a href="./src/open_transit/types/config_retrieve_response.py">ConfigRetrieveResponse</a></code>
3430

35-
### CurrentTime
31+
# CurrentTime
3632

3733
Types:
3834

3935
```python
40-
from open_transit.types.api.where import CurrentTimeRetrieveResponse
36+
from open_transit.types import CurrentTimeRetrieveResponse
4137
```
4238

4339
Methods:
4440

45-
- <code title="get /api/where/current-time.json">client.api.where.current_time.<a href="./src/open_transit/resources/api/where/current_time.py">retrieve</a>() -> <a href="./src/open_transit/types/api/where/current_time_retrieve_response.py">CurrentTimeRetrieveResponse</a></code>
41+
- <code title="get /api/where/current-time.json">client.current_time.<a href="./src/open_transit/resources/current_time.py">retrieve</a>() -> <a href="./src/open_transit/types/current_time_retrieve_response.py">CurrentTimeRetrieveResponse</a></code>
4642

47-
### StopsForLocation
43+
# StopsForLocation
4844

4945
Types:
5046

5147
```python
52-
from open_transit.types.api.where import StopsForLocationListResponse
48+
from open_transit.types import StopsForLocationListResponse
5349
```
5450

5551
Methods:
5652

57-
- <code title="get /api/where/stops-for-location.json">client.api.where.stops_for_location.<a href="./src/open_transit/resources/api/where/stops_for_location.py">list</a>(\*\*<a href="src/open_transit/types/api/where/stops_for_location_list_params.py">params</a>) -> <a href="./src/open_transit/types/api/where/stops_for_location_list_response.py">StopsForLocationListResponse</a></code>
53+
- <code title="get /api/where/stops-for-location.json">client.stops_for_location.<a href="./src/open_transit/resources/stops_for_location.py">list</a>(\*\*<a href="src/open_transit/types/stops_for_location_list_params.py">params</a>) -> <a href="./src/open_transit/types/stops_for_location_list_response.py">StopsForLocationListResponse</a></code>
5854

59-
### ArrivalAndDepartureForStop
55+
# ArrivalAndDepartureForStop
6056

6157
Types:
6258

6359
```python
64-
from open_transit.types.api.where import ArrivalAndDepartureForStopRetrieveResponse
60+
from open_transit.types import ArrivalAndDepartureForStopRetrieveResponse
6561
```
6662

6763
Methods:
6864

69-
- <code title="get /api/where/arrival-and-departure-for-stop/{stopID}.json">client.api.where.arrival_and_departure_for_stop.<a href="./src/open_transit/resources/api/where/arrival_and_departure_for_stop.py">retrieve</a>(stop_id, \*\*<a href="src/open_transit/types/api/where/arrival_and_departure_for_stop_retrieve_params.py">params</a>) -> <a href="./src/open_transit/types/api/where/arrival_and_departure_for_stop_retrieve_response.py">ArrivalAndDepartureForStopRetrieveResponse</a></code>
65+
- <code title="get /api/where/arrival-and-departure-for-stop/{stopID}.json">client.arrival_and_departure_for_stop.<a href="./src/open_transit/resources/arrival_and_departure_for_stop.py">retrieve</a>(stop_id, \*\*<a href="src/open_transit/types/arrival_and_departure_for_stop_retrieve_params.py">params</a>) -> <a href="./src/open_transit/types/arrival_and_departure_for_stop_retrieve_response.py">ArrivalAndDepartureForStopRetrieveResponse</a></code>
7066

71-
### ArrivalsAndDeparturesForStop
67+
# ArrivalsAndDeparturesForStop
7268

7369
Types:
7470

7571
```python
76-
from open_transit.types.api.where import ArrivalsAndDeparturesForStopListResponse
72+
from open_transit.types import ArrivalsAndDeparturesForStopListResponse
7773
```
7874

7975
Methods:
8076

81-
- <code title="get /api/where/arrivals-and-departures-for-stop/{stopID}.json">client.api.where.arrivals_and_departures_for_stop.<a href="./src/open_transit/resources/api/where/arrivals_and_departures_for_stop.py">list</a>(stop_id) -> <a href="./src/open_transit/types/api/where/arrivals_and_departures_for_stop_list_response.py">ArrivalsAndDeparturesForStopListResponse</a></code>
77+
- <code title="get /api/where/arrivals-and-departures-for-stop/{stopID}.json">client.arrivals_and_departures_for_stop.<a href="./src/open_transit/resources/arrivals_and_departures_for_stop.py">list</a>(stop_id) -> <a href="./src/open_transit/types/arrivals_and_departures_for_stop_list_response.py">ArrivalsAndDeparturesForStopListResponse</a></code>

src/open_transit/_client.py

Lines changed: 76 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@
4646

4747

4848
class OneBusAway(SyncAPIClient):
49-
api: resources.APIResource
49+
agencies_with_coverage: resources.AgenciesWithCoverageResource
50+
config: resources.ConfigResource
51+
current_time: resources.CurrentTimeResource
52+
stops_for_location: resources.StopsForLocationResource
53+
arrival_and_departure_for_stop: resources.ArrivalAndDepartureForStopResource
54+
arrivals_and_departures_for_stop: resources.ArrivalsAndDeparturesForStopResource
5055
with_raw_response: OneBusAwayWithRawResponse
5156
with_streaming_response: OneBusAwayWithStreamedResponse
5257

@@ -104,7 +109,12 @@ def __init__(
104109
_strict_response_validation=_strict_response_validation,
105110
)
106111

107-
self.api = resources.APIResource(self)
112+
self.agencies_with_coverage = resources.AgenciesWithCoverageResource(self)
113+
self.config = resources.ConfigResource(self)
114+
self.current_time = resources.CurrentTimeResource(self)
115+
self.stops_for_location = resources.StopsForLocationResource(self)
116+
self.arrival_and_departure_for_stop = resources.ArrivalAndDepartureForStopResource(self)
117+
self.arrivals_and_departures_for_stop = resources.ArrivalsAndDeparturesForStopResource(self)
108118
self.with_raw_response = OneBusAwayWithRawResponse(self)
109119
self.with_streaming_response = OneBusAwayWithStreamedResponse(self)
110120

@@ -221,7 +231,12 @@ def _make_status_error(
221231

222232

223233
class AsyncOneBusAway(AsyncAPIClient):
224-
api: resources.AsyncAPIResource
234+
agencies_with_coverage: resources.AsyncAgenciesWithCoverageResource
235+
config: resources.AsyncConfigResource
236+
current_time: resources.AsyncCurrentTimeResource
237+
stops_for_location: resources.AsyncStopsForLocationResource
238+
arrival_and_departure_for_stop: resources.AsyncArrivalAndDepartureForStopResource
239+
arrivals_and_departures_for_stop: resources.AsyncArrivalsAndDeparturesForStopResource
225240
with_raw_response: AsyncOneBusAwayWithRawResponse
226241
with_streaming_response: AsyncOneBusAwayWithStreamedResponse
227242

@@ -279,7 +294,12 @@ def __init__(
279294
_strict_response_validation=_strict_response_validation,
280295
)
281296

282-
self.api = resources.AsyncAPIResource(self)
297+
self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResource(self)
298+
self.config = resources.AsyncConfigResource(self)
299+
self.current_time = resources.AsyncCurrentTimeResource(self)
300+
self.stops_for_location = resources.AsyncStopsForLocationResource(self)
301+
self.arrival_and_departure_for_stop = resources.AsyncArrivalAndDepartureForStopResource(self)
302+
self.arrivals_and_departures_for_stop = resources.AsyncArrivalsAndDeparturesForStopResource(self)
283303
self.with_raw_response = AsyncOneBusAwayWithRawResponse(self)
284304
self.with_streaming_response = AsyncOneBusAwayWithStreamedResponse(self)
285305

@@ -397,22 +417,70 @@ def _make_status_error(
397417

398418
class OneBusAwayWithRawResponse:
399419
def __init__(self, client: OneBusAway) -> None:
400-
self.api = resources.APIResourceWithRawResponse(client.api)
420+
self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithRawResponse(
421+
client.agencies_with_coverage
422+
)
423+
self.config = resources.ConfigResourceWithRawResponse(client.config)
424+
self.current_time = resources.CurrentTimeResourceWithRawResponse(client.current_time)
425+
self.stops_for_location = resources.StopsForLocationResourceWithRawResponse(client.stops_for_location)
426+
self.arrival_and_departure_for_stop = resources.ArrivalAndDepartureForStopResourceWithRawResponse(
427+
client.arrival_and_departure_for_stop
428+
)
429+
self.arrivals_and_departures_for_stop = resources.ArrivalsAndDeparturesForStopResourceWithRawResponse(
430+
client.arrivals_and_departures_for_stop
431+
)
401432

402433

403434
class AsyncOneBusAwayWithRawResponse:
404435
def __init__(self, client: AsyncOneBusAway) -> None:
405-
self.api = resources.AsyncAPIResourceWithRawResponse(client.api)
436+
self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithRawResponse(
437+
client.agencies_with_coverage
438+
)
439+
self.config = resources.AsyncConfigResourceWithRawResponse(client.config)
440+
self.current_time = resources.AsyncCurrentTimeResourceWithRawResponse(client.current_time)
441+
self.stops_for_location = resources.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location)
442+
self.arrival_and_departure_for_stop = resources.AsyncArrivalAndDepartureForStopResourceWithRawResponse(
443+
client.arrival_and_departure_for_stop
444+
)
445+
self.arrivals_and_departures_for_stop = resources.AsyncArrivalsAndDeparturesForStopResourceWithRawResponse(
446+
client.arrivals_and_departures_for_stop
447+
)
406448

407449

408450
class OneBusAwayWithStreamedResponse:
409451
def __init__(self, client: OneBusAway) -> None:
410-
self.api = resources.APIResourceWithStreamingResponse(client.api)
452+
self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithStreamingResponse(
453+
client.agencies_with_coverage
454+
)
455+
self.config = resources.ConfigResourceWithStreamingResponse(client.config)
456+
self.current_time = resources.CurrentTimeResourceWithStreamingResponse(client.current_time)
457+
self.stops_for_location = resources.StopsForLocationResourceWithStreamingResponse(client.stops_for_location)
458+
self.arrival_and_departure_for_stop = resources.ArrivalAndDepartureForStopResourceWithStreamingResponse(
459+
client.arrival_and_departure_for_stop
460+
)
461+
self.arrivals_and_departures_for_stop = resources.ArrivalsAndDeparturesForStopResourceWithStreamingResponse(
462+
client.arrivals_and_departures_for_stop
463+
)
411464

412465

413466
class AsyncOneBusAwayWithStreamedResponse:
414467
def __init__(self, client: AsyncOneBusAway) -> None:
415-
self.api = resources.AsyncAPIResourceWithStreamingResponse(client.api)
468+
self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithStreamingResponse(
469+
client.agencies_with_coverage
470+
)
471+
self.config = resources.AsyncConfigResourceWithStreamingResponse(client.config)
472+
self.current_time = resources.AsyncCurrentTimeResourceWithStreamingResponse(client.current_time)
473+
self.stops_for_location = resources.AsyncStopsForLocationResourceWithStreamingResponse(
474+
client.stops_for_location
475+
)
476+
self.arrival_and_departure_for_stop = resources.AsyncArrivalAndDepartureForStopResourceWithStreamingResponse(
477+
client.arrival_and_departure_for_stop
478+
)
479+
self.arrivals_and_departures_for_stop = (
480+
resources.AsyncArrivalsAndDeparturesForStopResourceWithStreamingResponse(
481+
client.arrivals_and_departures_for_stop
482+
)
483+
)
416484

417485

418486
Client = OneBusAway
Lines changed: 83 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,89 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from .api import (
4-
APIResource,
5-
AsyncAPIResource,
6-
APIResourceWithRawResponse,
7-
AsyncAPIResourceWithRawResponse,
8-
APIResourceWithStreamingResponse,
9-
AsyncAPIResourceWithStreamingResponse,
3+
from .config import (
4+
ConfigResource,
5+
AsyncConfigResource,
6+
ConfigResourceWithRawResponse,
7+
AsyncConfigResourceWithRawResponse,
8+
ConfigResourceWithStreamingResponse,
9+
AsyncConfigResourceWithStreamingResponse,
10+
)
11+
from .current_time import (
12+
CurrentTimeResource,
13+
AsyncCurrentTimeResource,
14+
CurrentTimeResourceWithRawResponse,
15+
AsyncCurrentTimeResourceWithRawResponse,
16+
CurrentTimeResourceWithStreamingResponse,
17+
AsyncCurrentTimeResourceWithStreamingResponse,
18+
)
19+
from .stops_for_location import (
20+
StopsForLocationResource,
21+
AsyncStopsForLocationResource,
22+
StopsForLocationResourceWithRawResponse,
23+
AsyncStopsForLocationResourceWithRawResponse,
24+
StopsForLocationResourceWithStreamingResponse,
25+
AsyncStopsForLocationResourceWithStreamingResponse,
26+
)
27+
from .agencies_with_coverage import (
28+
AgenciesWithCoverageResource,
29+
AsyncAgenciesWithCoverageResource,
30+
AgenciesWithCoverageResourceWithRawResponse,
31+
AsyncAgenciesWithCoverageResourceWithRawResponse,
32+
AgenciesWithCoverageResourceWithStreamingResponse,
33+
AsyncAgenciesWithCoverageResourceWithStreamingResponse,
34+
)
35+
from .arrival_and_departure_for_stop import (
36+
ArrivalAndDepartureForStopResource,
37+
AsyncArrivalAndDepartureForStopResource,
38+
ArrivalAndDepartureForStopResourceWithRawResponse,
39+
AsyncArrivalAndDepartureForStopResourceWithRawResponse,
40+
ArrivalAndDepartureForStopResourceWithStreamingResponse,
41+
AsyncArrivalAndDepartureForStopResourceWithStreamingResponse,
42+
)
43+
from .arrivals_and_departures_for_stop import (
44+
ArrivalsAndDeparturesForStopResource,
45+
AsyncArrivalsAndDeparturesForStopResource,
46+
ArrivalsAndDeparturesForStopResourceWithRawResponse,
47+
AsyncArrivalsAndDeparturesForStopResourceWithRawResponse,
48+
ArrivalsAndDeparturesForStopResourceWithStreamingResponse,
49+
AsyncArrivalsAndDeparturesForStopResourceWithStreamingResponse,
1050
)
1151

1252
__all__ = [
13-
"APIResource",
14-
"AsyncAPIResource",
15-
"APIResourceWithRawResponse",
16-
"AsyncAPIResourceWithRawResponse",
17-
"APIResourceWithStreamingResponse",
18-
"AsyncAPIResourceWithStreamingResponse",
53+
"AgenciesWithCoverageResource",
54+
"AsyncAgenciesWithCoverageResource",
55+
"AgenciesWithCoverageResourceWithRawResponse",
56+
"AsyncAgenciesWithCoverageResourceWithRawResponse",
57+
"AgenciesWithCoverageResourceWithStreamingResponse",
58+
"AsyncAgenciesWithCoverageResourceWithStreamingResponse",
59+
"ConfigResource",
60+
"AsyncConfigResource",
61+
"ConfigResourceWithRawResponse",
62+
"AsyncConfigResourceWithRawResponse",
63+
"ConfigResourceWithStreamingResponse",
64+
"AsyncConfigResourceWithStreamingResponse",
65+
"CurrentTimeResource",
66+
"AsyncCurrentTimeResource",
67+
"CurrentTimeResourceWithRawResponse",
68+
"AsyncCurrentTimeResourceWithRawResponse",
69+
"CurrentTimeResourceWithStreamingResponse",
70+
"AsyncCurrentTimeResourceWithStreamingResponse",
71+
"StopsForLocationResource",
72+
"AsyncStopsForLocationResource",
73+
"StopsForLocationResourceWithRawResponse",
74+
"AsyncStopsForLocationResourceWithRawResponse",
75+
"StopsForLocationResourceWithStreamingResponse",
76+
"AsyncStopsForLocationResourceWithStreamingResponse",
77+
"ArrivalAndDepartureForStopResource",
78+
"AsyncArrivalAndDepartureForStopResource",
79+
"ArrivalAndDepartureForStopResourceWithRawResponse",
80+
"AsyncArrivalAndDepartureForStopResourceWithRawResponse",
81+
"ArrivalAndDepartureForStopResourceWithStreamingResponse",
82+
"AsyncArrivalAndDepartureForStopResourceWithStreamingResponse",
83+
"ArrivalsAndDeparturesForStopResource",
84+
"AsyncArrivalsAndDeparturesForStopResource",
85+
"ArrivalsAndDeparturesForStopResourceWithRawResponse",
86+
"AsyncArrivalsAndDeparturesForStopResourceWithRawResponse",
87+
"ArrivalsAndDeparturesForStopResourceWithStreamingResponse",
88+
"AsyncArrivalsAndDeparturesForStopResourceWithStreamingResponse",
1989
]

0 commit comments

Comments
 (0)