Skip to content

Commit 54e9f2a

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#22)
1 parent d4367ba commit 54e9f2a

9 files changed

Lines changed: 495 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 15
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-ac10a054ead5e711bd033b417891c1769d631135029ca5bd91e6584420403ee2.yml
1+
configured_endpoints: 16
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-92606a4bcfb26210a95a7f86b55fb258977f97c375cd3b1f6035ed81a53f2e2c.yml

api.md

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

2929
- <code title="get /api/where/agency/{agencyID}.json">client.agency.<a href="./src/onebusaway/resources/agency.py">retrieve</a>(agency_id) -> <a href="./src/onebusaway/types/agency_retrieve_response.py">AgencyRetrieveResponse</a></code>
3030

31+
# VehiclesForAgency
32+
33+
Types:
34+
35+
```python
36+
from onebusaway.types import VehiclesForAgencyListResponse
37+
```
38+
39+
Methods:
40+
41+
- <code title="get /api/where/vehicles-for-agency/{agencyID}.json">client.vehicles_for_agency.<a href="./src/onebusaway/resources/vehicles_for_agency.py">list</a>(agency_id, \*\*<a href="src/onebusaway/types/vehicles_for_agency_list_params.py">params</a>) -> <a href="./src/onebusaway/types/vehicles_for_agency_list_response.py">VehiclesForAgencyListResponse</a></code>
42+
3143
# Config
3244

3345
Types:

src/onebusaway/_client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
class OnebusawaySDK(SyncAPIClient):
4949
agencies_with_coverage: resources.AgenciesWithCoverageResource
5050
agency: resources.AgencyResource
51+
vehicles_for_agency: resources.VehiclesForAgencyResource
5152
config: resources.ConfigResource
5253
current_time: resources.CurrentTimeResource
5354
stops_for_location: resources.StopsForLocationResource
@@ -119,6 +120,7 @@ def __init__(
119120

120121
self.agencies_with_coverage = resources.AgenciesWithCoverageResource(self)
121122
self.agency = resources.AgencyResource(self)
123+
self.vehicles_for_agency = resources.VehiclesForAgencyResource(self)
122124
self.config = resources.ConfigResource(self)
123125
self.current_time = resources.CurrentTimeResource(self)
124126
self.stops_for_location = resources.StopsForLocationResource(self)
@@ -250,6 +252,7 @@ def _make_status_error(
250252
class AsyncOnebusawaySDK(AsyncAPIClient):
251253
agencies_with_coverage: resources.AsyncAgenciesWithCoverageResource
252254
agency: resources.AsyncAgencyResource
255+
vehicles_for_agency: resources.AsyncVehiclesForAgencyResource
253256
config: resources.AsyncConfigResource
254257
current_time: resources.AsyncCurrentTimeResource
255258
stops_for_location: resources.AsyncStopsForLocationResource
@@ -321,6 +324,7 @@ def __init__(
321324

322325
self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResource(self)
323326
self.agency = resources.AsyncAgencyResource(self)
327+
self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResource(self)
324328
self.config = resources.AsyncConfigResource(self)
325329
self.current_time = resources.AsyncCurrentTimeResource(self)
326330
self.stops_for_location = resources.AsyncStopsForLocationResource(self)
@@ -455,6 +459,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
455459
client.agencies_with_coverage
456460
)
457461
self.agency = resources.AgencyResourceWithRawResponse(client.agency)
462+
self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency)
458463
self.config = resources.ConfigResourceWithRawResponse(client.config)
459464
self.current_time = resources.CurrentTimeResourceWithRawResponse(client.current_time)
460465
self.stops_for_location = resources.StopsForLocationResourceWithRawResponse(client.stops_for_location)
@@ -475,6 +480,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
475480
client.agencies_with_coverage
476481
)
477482
self.agency = resources.AsyncAgencyResourceWithRawResponse(client.agency)
483+
self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency)
478484
self.config = resources.AsyncConfigResourceWithRawResponse(client.config)
479485
self.current_time = resources.AsyncCurrentTimeResourceWithRawResponse(client.current_time)
480486
self.stops_for_location = resources.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location)
@@ -497,6 +503,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
497503
client.agencies_with_coverage
498504
)
499505
self.agency = resources.AgencyResourceWithStreamingResponse(client.agency)
506+
self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency)
500507
self.config = resources.ConfigResourceWithStreamingResponse(client.config)
501508
self.current_time = resources.CurrentTimeResourceWithStreamingResponse(client.current_time)
502509
self.stops_for_location = resources.StopsForLocationResourceWithStreamingResponse(client.stops_for_location)
@@ -519,6 +526,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
519526
client.agencies_with_coverage
520527
)
521528
self.agency = resources.AsyncAgencyResourceWithStreamingResponse(client.agency)
529+
self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithStreamingResponse(
530+
client.vehicles_for_agency
531+
)
522532
self.config = resources.AsyncConfigResourceWithStreamingResponse(client.config)
523533
self.current_time = resources.AsyncCurrentTimeResourceWithStreamingResponse(client.current_time)
524534
self.stops_for_location = resources.AsyncStopsForLocationResourceWithStreamingResponse(

src/onebusaway/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@
9696
StopIDsForAgencyResourceWithStreamingResponse,
9797
AsyncStopIDsForAgencyResourceWithStreamingResponse,
9898
)
99+
from .vehicles_for_agency import (
100+
VehiclesForAgencyResource,
101+
AsyncVehiclesForAgencyResource,
102+
VehiclesForAgencyResourceWithRawResponse,
103+
AsyncVehiclesForAgencyResourceWithRawResponse,
104+
VehiclesForAgencyResourceWithStreamingResponse,
105+
AsyncVehiclesForAgencyResourceWithStreamingResponse,
106+
)
99107
from .arrival_and_departure import (
100108
ArrivalAndDepartureResource,
101109
AsyncArrivalAndDepartureResource,
@@ -126,6 +134,12 @@
126134
"AsyncAgencyResourceWithRawResponse",
127135
"AgencyResourceWithStreamingResponse",
128136
"AsyncAgencyResourceWithStreamingResponse",
137+
"VehiclesForAgencyResource",
138+
"AsyncVehiclesForAgencyResource",
139+
"VehiclesForAgencyResourceWithRawResponse",
140+
"AsyncVehiclesForAgencyResourceWithRawResponse",
141+
"VehiclesForAgencyResourceWithStreamingResponse",
142+
"AsyncVehiclesForAgencyResourceWithStreamingResponse",
129143
"ConfigResource",
130144
"AsyncConfigResource",
131145
"ConfigResourceWithRawResponse",
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
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 vehicles_for_agency_list_params
8+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
9+
from .._utils import (
10+
maybe_transform,
11+
async_maybe_transform,
12+
)
13+
from .._compat import cached_property
14+
from .._resource import SyncAPIResource, AsyncAPIResource
15+
from .._response import (
16+
to_raw_response_wrapper,
17+
to_streamed_response_wrapper,
18+
async_to_raw_response_wrapper,
19+
async_to_streamed_response_wrapper,
20+
)
21+
from .._base_client import make_request_options
22+
from ..types.vehicles_for_agency_list_response import VehiclesForAgencyListResponse
23+
24+
__all__ = ["VehiclesForAgencyResource", "AsyncVehiclesForAgencyResource"]
25+
26+
27+
class VehiclesForAgencyResource(SyncAPIResource):
28+
@cached_property
29+
def with_raw_response(self) -> VehiclesForAgencyResourceWithRawResponse:
30+
return VehiclesForAgencyResourceWithRawResponse(self)
31+
32+
@cached_property
33+
def with_streaming_response(self) -> VehiclesForAgencyResourceWithStreamingResponse:
34+
return VehiclesForAgencyResourceWithStreamingResponse(self)
35+
36+
def list(
37+
self,
38+
agency_id: str,
39+
*,
40+
time: str | NotGiven = NOT_GIVEN,
41+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
42+
# The extra values given here take precedence over values defined on the client or passed to this method.
43+
extra_headers: Headers | None = None,
44+
extra_query: Query | None = None,
45+
extra_body: Body | None = None,
46+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
47+
) -> VehiclesForAgencyListResponse:
48+
"""
49+
Get vehicles for a specific agency
50+
51+
Args:
52+
time: Specific time for querying the status (timestamp format)
53+
54+
extra_headers: Send extra headers
55+
56+
extra_query: Add additional query parameters to the request
57+
58+
extra_body: Add additional JSON properties to the request
59+
60+
timeout: Override the client-level default timeout for this request, in seconds
61+
"""
62+
if not agency_id:
63+
raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}")
64+
return self._get(
65+
f"/api/where/vehicles-for-agency/agencyID.json",
66+
options=make_request_options(
67+
extra_headers=extra_headers,
68+
extra_query=extra_query,
69+
extra_body=extra_body,
70+
timeout=timeout,
71+
query=maybe_transform({"time": time}, vehicles_for_agency_list_params.VehiclesForAgencyListParams),
72+
),
73+
cast_to=VehiclesForAgencyListResponse,
74+
)
75+
76+
77+
class AsyncVehiclesForAgencyResource(AsyncAPIResource):
78+
@cached_property
79+
def with_raw_response(self) -> AsyncVehiclesForAgencyResourceWithRawResponse:
80+
return AsyncVehiclesForAgencyResourceWithRawResponse(self)
81+
82+
@cached_property
83+
def with_streaming_response(self) -> AsyncVehiclesForAgencyResourceWithStreamingResponse:
84+
return AsyncVehiclesForAgencyResourceWithStreamingResponse(self)
85+
86+
async def list(
87+
self,
88+
agency_id: str,
89+
*,
90+
time: str | NotGiven = NOT_GIVEN,
91+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
92+
# The extra values given here take precedence over values defined on the client or passed to this method.
93+
extra_headers: Headers | None = None,
94+
extra_query: Query | None = None,
95+
extra_body: Body | None = None,
96+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
97+
) -> VehiclesForAgencyListResponse:
98+
"""
99+
Get vehicles for a specific agency
100+
101+
Args:
102+
time: Specific time for querying the status (timestamp format)
103+
104+
extra_headers: Send extra headers
105+
106+
extra_query: Add additional query parameters to the request
107+
108+
extra_body: Add additional JSON properties to the request
109+
110+
timeout: Override the client-level default timeout for this request, in seconds
111+
"""
112+
if not agency_id:
113+
raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}")
114+
return await self._get(
115+
f"/api/where/vehicles-for-agency/agencyID.json",
116+
options=make_request_options(
117+
extra_headers=extra_headers,
118+
extra_query=extra_query,
119+
extra_body=extra_body,
120+
timeout=timeout,
121+
query=await async_maybe_transform(
122+
{"time": time}, vehicles_for_agency_list_params.VehiclesForAgencyListParams
123+
),
124+
),
125+
cast_to=VehiclesForAgencyListResponse,
126+
)
127+
128+
129+
class VehiclesForAgencyResourceWithRawResponse:
130+
def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None:
131+
self._vehicles_for_agency = vehicles_for_agency
132+
133+
self.list = to_raw_response_wrapper(
134+
vehicles_for_agency.list,
135+
)
136+
137+
138+
class AsyncVehiclesForAgencyResourceWithRawResponse:
139+
def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None:
140+
self._vehicles_for_agency = vehicles_for_agency
141+
142+
self.list = async_to_raw_response_wrapper(
143+
vehicles_for_agency.list,
144+
)
145+
146+
147+
class VehiclesForAgencyResourceWithStreamingResponse:
148+
def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None:
149+
self._vehicles_for_agency = vehicles_for_agency
150+
151+
self.list = to_streamed_response_wrapper(
152+
vehicles_for_agency.list,
153+
)
154+
155+
156+
class AsyncVehiclesForAgencyResourceWithStreamingResponse:
157+
def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None:
158+
self._vehicles_for_agency = vehicles_for_agency
159+
160+
self.list = async_to_streamed_response_wrapper(
161+
vehicles_for_agency.list,
162+
)

src/onebusaway/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
from .stops_for_route_list_response import StopsForRouteListResponse as StopsForRouteListResponse
1414
from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse
1515
from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse
16+
from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams
1617
from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams
1718
from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams
1819
from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse
20+
from .vehicles_for_agency_list_response import VehiclesForAgencyListResponse as VehiclesForAgencyListResponse
1921
from .stops_for_location_retrieve_params import StopsForLocationRetrieveParams as StopsForLocationRetrieveParams
2022
from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse
2123
from .trips_for_location_retrieve_params import TripsForLocationRetrieveParams as TripsForLocationRetrieveParams
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import TypedDict
6+
7+
__all__ = ["VehiclesForAgencyListParams"]
8+
9+
10+
class VehiclesForAgencyListParams(TypedDict, total=False):
11+
time: str
12+
"""Specific time for querying the status (timestamp format)"""

0 commit comments

Comments
 (0)