Skip to content

Commit 72b1a9c

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#10)
1 parent bb4d4a6 commit 72b1a9c

File tree

8 files changed

+321
-2
lines changed

8 files changed

+321
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 13
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6c051801071707e025c582891048beeb3c06d10d13c852f8401a71604b81ac5d.yml
1+
configured_endpoints: 14
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-44ff52d3676ae12480b775507fe3af8a229d94d6490297ad319f4e37ffef437d.yml

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ Methods:
7676

7777
- <code title="get /api/where/stops-for-route/{routeID}.json">client.stops_for_route.<a href="./src/onebusaway/resources/stops_for_route.py">list</a>(route_id, \*\*<a href="src/onebusaway/types/stops_for_route_list_params.py">params</a>) -> <a href="./src/onebusaway/types/stops_for_route_list_response.py">StopsForRouteListResponse</a></code>
7878

79+
# Stop
80+
81+
Types:
82+
83+
```python
84+
from onebusaway.types import StopRetrieveResponse
85+
```
86+
87+
Methods:
88+
89+
- <code title="get /api/where/stop/{stopID}.json">client.stop.<a href="./src/onebusaway/resources/stop.py">retrieve</a>(stop_id) -> <a href="./src/onebusaway/types/stop_retrieve_response.py">StopRetrieveResponse</a></code>
90+
7991
# Route
8092

8193
Types:

src/onebusaway/_client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class OnebusawaySDK(SyncAPIClient):
5252
current_time: resources.CurrentTimeResource
5353
stops_for_location: resources.StopsForLocationResource
5454
stops_for_route: resources.StopsForRouteResource
55+
stop: resources.StopResource
5556
route: resources.RouteResource
5657
arrival_and_departure: resources.ArrivalAndDepartureResource
5758
trip: resources.TripResource
@@ -121,6 +122,7 @@ def __init__(
121122
self.current_time = resources.CurrentTimeResource(self)
122123
self.stops_for_location = resources.StopsForLocationResource(self)
123124
self.stops_for_route = resources.StopsForRouteResource(self)
125+
self.stop = resources.StopResource(self)
124126
self.route = resources.RouteResource(self)
125127
self.arrival_and_departure = resources.ArrivalAndDepartureResource(self)
126128
self.trip = resources.TripResource(self)
@@ -250,6 +252,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
250252
current_time: resources.AsyncCurrentTimeResource
251253
stops_for_location: resources.AsyncStopsForLocationResource
252254
stops_for_route: resources.AsyncStopsForRouteResource
255+
stop: resources.AsyncStopResource
253256
route: resources.AsyncRouteResource
254257
arrival_and_departure: resources.AsyncArrivalAndDepartureResource
255258
trip: resources.AsyncTripResource
@@ -319,6 +322,7 @@ def __init__(
319322
self.current_time = resources.AsyncCurrentTimeResource(self)
320323
self.stops_for_location = resources.AsyncStopsForLocationResource(self)
321324
self.stops_for_route = resources.AsyncStopsForRouteResource(self)
325+
self.stop = resources.AsyncStopResource(self)
322326
self.route = resources.AsyncRouteResource(self)
323327
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self)
324328
self.trip = resources.AsyncTripResource(self)
@@ -451,6 +455,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
451455
self.current_time = resources.CurrentTimeResourceWithRawResponse(client.current_time)
452456
self.stops_for_location = resources.StopsForLocationResourceWithRawResponse(client.stops_for_location)
453457
self.stops_for_route = resources.StopsForRouteResourceWithRawResponse(client.stops_for_route)
458+
self.stop = resources.StopResourceWithRawResponse(client.stop)
454459
self.route = resources.RouteResourceWithRawResponse(client.route)
455460
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure)
456461
self.trip = resources.TripResourceWithRawResponse(client.trip)
@@ -469,6 +474,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
469474
self.current_time = resources.AsyncCurrentTimeResourceWithRawResponse(client.current_time)
470475
self.stops_for_location = resources.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location)
471476
self.stops_for_route = resources.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route)
477+
self.stop = resources.AsyncStopResourceWithRawResponse(client.stop)
472478
self.route = resources.AsyncRouteResourceWithRawResponse(client.route)
473479
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse(
474480
client.arrival_and_departure
@@ -489,6 +495,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
489495
self.current_time = resources.CurrentTimeResourceWithStreamingResponse(client.current_time)
490496
self.stops_for_location = resources.StopsForLocationResourceWithStreamingResponse(client.stops_for_location)
491497
self.stops_for_route = resources.StopsForRouteResourceWithStreamingResponse(client.stops_for_route)
498+
self.stop = resources.StopResourceWithStreamingResponse(client.stop)
492499
self.route = resources.RouteResourceWithStreamingResponse(client.route)
493500
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse(
494501
client.arrival_and_departure
@@ -511,6 +518,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
511518
client.stops_for_location
512519
)
513520
self.stops_for_route = resources.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route)
521+
self.stop = resources.AsyncStopResourceWithStreamingResponse(client.stop)
514522
self.route = resources.AsyncRouteResourceWithStreamingResponse(client.route)
515523
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithStreamingResponse(
516524
client.arrival_and_departure

src/onebusaway/resources/__init__.py

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

3+
from .stop import (
4+
StopResource,
5+
AsyncStopResource,
6+
StopResourceWithRawResponse,
7+
AsyncStopResourceWithRawResponse,
8+
StopResourceWithStreamingResponse,
9+
AsyncStopResourceWithStreamingResponse,
10+
)
311
from .trip import (
412
TripResource,
513
AsyncTripResource,
@@ -134,6 +142,12 @@
134142
"AsyncStopsForRouteResourceWithRawResponse",
135143
"StopsForRouteResourceWithStreamingResponse",
136144
"AsyncStopsForRouteResourceWithStreamingResponse",
145+
"StopResource",
146+
"AsyncStopResource",
147+
"StopResourceWithRawResponse",
148+
"AsyncStopResourceWithRawResponse",
149+
"StopResourceWithStreamingResponse",
150+
"AsyncStopResourceWithStreamingResponse",
137151
"RouteResource",
138152
"AsyncRouteResource",
139153
"RouteResourceWithRawResponse",

src/onebusaway/resources/stop.py

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
import httpx
6+
7+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
8+
from .._compat import cached_property
9+
from .._resource import SyncAPIResource, AsyncAPIResource
10+
from .._response import (
11+
to_raw_response_wrapper,
12+
to_streamed_response_wrapper,
13+
async_to_raw_response_wrapper,
14+
async_to_streamed_response_wrapper,
15+
)
16+
from .._base_client import make_request_options
17+
from ..types.stop_retrieve_response import StopRetrieveResponse
18+
19+
__all__ = ["StopResource", "AsyncStopResource"]
20+
21+
22+
class StopResource(SyncAPIResource):
23+
@cached_property
24+
def with_raw_response(self) -> StopResourceWithRawResponse:
25+
return StopResourceWithRawResponse(self)
26+
27+
@cached_property
28+
def with_streaming_response(self) -> StopResourceWithStreamingResponse:
29+
return StopResourceWithStreamingResponse(self)
30+
31+
def retrieve(
32+
self,
33+
stop_id: str,
34+
*,
35+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
36+
# The extra values given here take precedence over values defined on the client or passed to this method.
37+
extra_headers: Headers | None = None,
38+
extra_query: Query | None = None,
39+
extra_body: Body | None = None,
40+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
41+
) -> StopRetrieveResponse:
42+
"""
43+
Get details of a specific stop
44+
45+
Args:
46+
extra_headers: Send extra headers
47+
48+
extra_query: Add additional query parameters to the request
49+
50+
extra_body: Add additional JSON properties to the request
51+
52+
timeout: Override the client-level default timeout for this request, in seconds
53+
"""
54+
if not stop_id:
55+
raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}")
56+
return self._get(
57+
f"/api/where/stop/stopID.json",
58+
options=make_request_options(
59+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
60+
),
61+
cast_to=StopRetrieveResponse,
62+
)
63+
64+
65+
class AsyncStopResource(AsyncAPIResource):
66+
@cached_property
67+
def with_raw_response(self) -> AsyncStopResourceWithRawResponse:
68+
return AsyncStopResourceWithRawResponse(self)
69+
70+
@cached_property
71+
def with_streaming_response(self) -> AsyncStopResourceWithStreamingResponse:
72+
return AsyncStopResourceWithStreamingResponse(self)
73+
74+
async def retrieve(
75+
self,
76+
stop_id: str,
77+
*,
78+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
79+
# The extra values given here take precedence over values defined on the client or passed to this method.
80+
extra_headers: Headers | None = None,
81+
extra_query: Query | None = None,
82+
extra_body: Body | None = None,
83+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
84+
) -> StopRetrieveResponse:
85+
"""
86+
Get details of a specific stop
87+
88+
Args:
89+
extra_headers: Send extra headers
90+
91+
extra_query: Add additional query parameters to the request
92+
93+
extra_body: Add additional JSON properties to the request
94+
95+
timeout: Override the client-level default timeout for this request, in seconds
96+
"""
97+
if not stop_id:
98+
raise ValueError(f"Expected a non-empty value for `stop_id` but received {stop_id!r}")
99+
return await self._get(
100+
f"/api/where/stop/stopID.json",
101+
options=make_request_options(
102+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
103+
),
104+
cast_to=StopRetrieveResponse,
105+
)
106+
107+
108+
class StopResourceWithRawResponse:
109+
def __init__(self, stop: StopResource) -> None:
110+
self._stop = stop
111+
112+
self.retrieve = to_raw_response_wrapper(
113+
stop.retrieve,
114+
)
115+
116+
117+
class AsyncStopResourceWithRawResponse:
118+
def __init__(self, stop: AsyncStopResource) -> None:
119+
self._stop = stop
120+
121+
self.retrieve = async_to_raw_response_wrapper(
122+
stop.retrieve,
123+
)
124+
125+
126+
class StopResourceWithStreamingResponse:
127+
def __init__(self, stop: StopResource) -> None:
128+
self._stop = stop
129+
130+
self.retrieve = to_streamed_response_wrapper(
131+
stop.retrieve,
132+
)
133+
134+
135+
class AsyncStopResourceWithStreamingResponse:
136+
def __init__(self, stop: AsyncStopResource) -> None:
137+
self._stop = stop
138+
139+
self.retrieve = async_to_streamed_response_wrapper(
140+
stop.retrieve,
141+
)

src/onebusaway/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from .shared import References as References, ResponseWrapper as ResponseWrapper
6+
from .stop_retrieve_response import StopRetrieveResponse as StopRetrieveResponse
67
from .trip_retrieve_response import TripRetrieveResponse as TripRetrieveResponse
78
from .route_retrieve_response import RouteRetrieveResponse as RouteRetrieveResponse
89
from .agency_retrieve_response import AgencyRetrieveResponse as AgencyRetrieveResponse
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Optional
4+
5+
from pydantic import Field as FieldInfo
6+
7+
from .._models import BaseModel
8+
from .shared.references import References
9+
from .shared.response_wrapper import ResponseWrapper
10+
11+
__all__ = ["StopRetrieveResponse", "StopRetrieveResponseData", "StopRetrieveResponseDataEntry"]
12+
13+
14+
class StopRetrieveResponseDataEntry(BaseModel):
15+
id: str
16+
17+
code: str
18+
19+
lat: float
20+
21+
lon: float
22+
23+
name: str
24+
25+
direction: Optional[str] = None
26+
27+
location_type: Optional[int] = FieldInfo(alias="locationType", default=None)
28+
29+
parent: Optional[str] = None
30+
31+
route_ids: Optional[List[str]] = FieldInfo(alias="routeIds", default=None)
32+
33+
static_route_ids: Optional[List[str]] = FieldInfo(alias="staticRouteIds", default=None)
34+
35+
wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None)
36+
37+
38+
class StopRetrieveResponseData(BaseModel):
39+
entry: StopRetrieveResponseDataEntry
40+
41+
references: References
42+
43+
44+
class StopRetrieveResponse(ResponseWrapper):
45+
data: Optional[StopRetrieveResponseData] = None

0 commit comments

Comments
 (0)