Skip to content

Commit 171d1b7

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#15)
1 parent 7c0ef70 commit 171d1b7

File tree

8 files changed

+301
-2
lines changed

8 files changed

+301
-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: 14
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-44ff52d3676ae12480b775507fe3af8a229d94d6490297ad319f4e37ffef437d.yml
1+
configured_endpoints: 15
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-735f145c4ce18bd5a2c869289186f175513bfa496507de7ff0734f9242adf427.yml

api.md

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

8989
- <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>
9090

91+
# StopIDsForAgency
92+
93+
Types:
94+
95+
```python
96+
from onebusaway.types import StopIDsForAgencyListResponse
97+
```
98+
99+
Methods:
100+
101+
- <code title="get /api/where/stop-ids-for-agency/{agencyID}.json">client.stop_ids_for_agency.<a href="./src/onebusaway/resources/stop_ids_for_agency.py">list</a>(agency_id) -> <a href="./src/onebusaway/types/stop_ids_for_agency_list_response.py">StopIDsForAgencyListResponse</a></code>
102+
91103
# Route
92104

93105
Types:

src/onebusaway/_client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class OnebusawaySDK(SyncAPIClient):
5353
stops_for_location: resources.StopsForLocationResource
5454
stops_for_route: resources.StopsForRouteResource
5555
stop: resources.StopResource
56+
stop_ids_for_agency: resources.StopIDsForAgencyResource
5657
route: resources.RouteResource
5758
arrival_and_departure: resources.ArrivalAndDepartureResource
5859
trip: resources.TripResource
@@ -123,6 +124,7 @@ def __init__(
123124
self.stops_for_location = resources.StopsForLocationResource(self)
124125
self.stops_for_route = resources.StopsForRouteResource(self)
125126
self.stop = resources.StopResource(self)
127+
self.stop_ids_for_agency = resources.StopIDsForAgencyResource(self)
126128
self.route = resources.RouteResource(self)
127129
self.arrival_and_departure = resources.ArrivalAndDepartureResource(self)
128130
self.trip = resources.TripResource(self)
@@ -253,6 +255,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
253255
stops_for_location: resources.AsyncStopsForLocationResource
254256
stops_for_route: resources.AsyncStopsForRouteResource
255257
stop: resources.AsyncStopResource
258+
stop_ids_for_agency: resources.AsyncStopIDsForAgencyResource
256259
route: resources.AsyncRouteResource
257260
arrival_and_departure: resources.AsyncArrivalAndDepartureResource
258261
trip: resources.AsyncTripResource
@@ -323,6 +326,7 @@ def __init__(
323326
self.stops_for_location = resources.AsyncStopsForLocationResource(self)
324327
self.stops_for_route = resources.AsyncStopsForRouteResource(self)
325328
self.stop = resources.AsyncStopResource(self)
329+
self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResource(self)
326330
self.route = resources.AsyncRouteResource(self)
327331
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self)
328332
self.trip = resources.AsyncTripResource(self)
@@ -456,6 +460,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
456460
self.stops_for_location = resources.StopsForLocationResourceWithRawResponse(client.stops_for_location)
457461
self.stops_for_route = resources.StopsForRouteResourceWithRawResponse(client.stops_for_route)
458462
self.stop = resources.StopResourceWithRawResponse(client.stop)
463+
self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency)
459464
self.route = resources.RouteResourceWithRawResponse(client.route)
460465
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure)
461466
self.trip = resources.TripResourceWithRawResponse(client.trip)
@@ -475,6 +480,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
475480
self.stops_for_location = resources.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location)
476481
self.stops_for_route = resources.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route)
477482
self.stop = resources.AsyncStopResourceWithRawResponse(client.stop)
483+
self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency)
478484
self.route = resources.AsyncRouteResourceWithRawResponse(client.route)
479485
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse(
480486
client.arrival_and_departure
@@ -496,6 +502,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
496502
self.stops_for_location = resources.StopsForLocationResourceWithStreamingResponse(client.stops_for_location)
497503
self.stops_for_route = resources.StopsForRouteResourceWithStreamingResponse(client.stops_for_route)
498504
self.stop = resources.StopResourceWithStreamingResponse(client.stop)
505+
self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency)
499506
self.route = resources.RouteResourceWithStreamingResponse(client.route)
500507
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse(
501508
client.arrival_and_departure
@@ -519,6 +526,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
519526
)
520527
self.stops_for_route = resources.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route)
521528
self.stop = resources.AsyncStopResourceWithStreamingResponse(client.stop)
529+
self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithStreamingResponse(
530+
client.stop_ids_for_agency
531+
)
522532
self.route = resources.AsyncRouteResourceWithStreamingResponse(client.route)
523533
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithStreamingResponse(
524534
client.arrival_and_departure

src/onebusaway/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@
8888
TripsForLocationResourceWithStreamingResponse,
8989
AsyncTripsForLocationResourceWithStreamingResponse,
9090
)
91+
from .stop_ids_for_agency import (
92+
StopIDsForAgencyResource,
93+
AsyncStopIDsForAgencyResource,
94+
StopIDsForAgencyResourceWithRawResponse,
95+
AsyncStopIDsForAgencyResourceWithRawResponse,
96+
StopIDsForAgencyResourceWithStreamingResponse,
97+
AsyncStopIDsForAgencyResourceWithStreamingResponse,
98+
)
9199
from .arrival_and_departure import (
92100
ArrivalAndDepartureResource,
93101
AsyncArrivalAndDepartureResource,
@@ -148,6 +156,12 @@
148156
"AsyncStopResourceWithRawResponse",
149157
"StopResourceWithStreamingResponse",
150158
"AsyncStopResourceWithStreamingResponse",
159+
"StopIDsForAgencyResource",
160+
"AsyncStopIDsForAgencyResource",
161+
"StopIDsForAgencyResourceWithRawResponse",
162+
"AsyncStopIDsForAgencyResourceWithRawResponse",
163+
"StopIDsForAgencyResourceWithStreamingResponse",
164+
"AsyncStopIDsForAgencyResourceWithStreamingResponse",
151165
"RouteResource",
152166
"AsyncRouteResource",
153167
"RouteResourceWithRawResponse",
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_ids_for_agency_list_response import StopIDsForAgencyListResponse
18+
19+
__all__ = ["StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource"]
20+
21+
22+
class StopIDsForAgencyResource(SyncAPIResource):
23+
@cached_property
24+
def with_raw_response(self) -> StopIDsForAgencyResourceWithRawResponse:
25+
return StopIDsForAgencyResourceWithRawResponse(self)
26+
27+
@cached_property
28+
def with_streaming_response(self) -> StopIDsForAgencyResourceWithStreamingResponse:
29+
return StopIDsForAgencyResourceWithStreamingResponse(self)
30+
31+
def list(
32+
self,
33+
agency_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+
) -> StopIDsForAgencyListResponse:
42+
"""
43+
Get stop IDs for a specific agency
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 agency_id:
55+
raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}")
56+
return self._get(
57+
f"/api/where/stop-ids-for-agency/agencyID.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=StopIDsForAgencyListResponse,
62+
)
63+
64+
65+
class AsyncStopIDsForAgencyResource(AsyncAPIResource):
66+
@cached_property
67+
def with_raw_response(self) -> AsyncStopIDsForAgencyResourceWithRawResponse:
68+
return AsyncStopIDsForAgencyResourceWithRawResponse(self)
69+
70+
@cached_property
71+
def with_streaming_response(self) -> AsyncStopIDsForAgencyResourceWithStreamingResponse:
72+
return AsyncStopIDsForAgencyResourceWithStreamingResponse(self)
73+
74+
async def list(
75+
self,
76+
agency_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+
) -> StopIDsForAgencyListResponse:
85+
"""
86+
Get stop IDs for a specific agency
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 agency_id:
98+
raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}")
99+
return await self._get(
100+
f"/api/where/stop-ids-for-agency/agencyID.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=StopIDsForAgencyListResponse,
105+
)
106+
107+
108+
class StopIDsForAgencyResourceWithRawResponse:
109+
def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None:
110+
self._stop_ids_for_agency = stop_ids_for_agency
111+
112+
self.list = to_raw_response_wrapper(
113+
stop_ids_for_agency.list,
114+
)
115+
116+
117+
class AsyncStopIDsForAgencyResourceWithRawResponse:
118+
def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None:
119+
self._stop_ids_for_agency = stop_ids_for_agency
120+
121+
self.list = async_to_raw_response_wrapper(
122+
stop_ids_for_agency.list,
123+
)
124+
125+
126+
class StopIDsForAgencyResourceWithStreamingResponse:
127+
def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None:
128+
self._stop_ids_for_agency = stop_ids_for_agency
129+
130+
self.list = to_streamed_response_wrapper(
131+
stop_ids_for_agency.list,
132+
)
133+
134+
135+
class AsyncStopIDsForAgencyResourceWithStreamingResponse:
136+
def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None:
137+
self._stop_ids_for_agency = stop_ids_for_agency
138+
139+
self.list = async_to_streamed_response_wrapper(
140+
stop_ids_for_agency.list,
141+
)

src/onebusaway/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse
1616
from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams
1717
from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams
18+
from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse
1819
from .stops_for_location_retrieve_params import StopsForLocationRetrieveParams as StopsForLocationRetrieveParams
1920
from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse
2021
from .trips_for_location_retrieve_params import TripsForLocationRetrieveParams as TripsForLocationRetrieveParams
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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__ = ["StopIDsForAgencyListResponse", "StopIDsForAgencyListResponseData"]
12+
13+
14+
class StopIDsForAgencyListResponseData(BaseModel):
15+
list: List[str]
16+
17+
references: References
18+
19+
limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None)
20+
21+
22+
class StopIDsForAgencyListResponse(ResponseWrapper):
23+
data: Optional[StopIDsForAgencyListResponseData] = None
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
import os
6+
from typing import Any, cast
7+
8+
import pytest
9+
10+
from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK
11+
from tests.utils import assert_matches_type
12+
from onebusaway.types import StopIDsForAgencyListResponse
13+
14+
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
15+
16+
17+
class TestStopIDsForAgency:
18+
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
19+
20+
@parametrize
21+
def test_method_list(self, client: OnebusawaySDK) -> None:
22+
stop_ids_for_agency = client.stop_ids_for_agency.list(
23+
"agencyID",
24+
)
25+
assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"])
26+
27+
@parametrize
28+
def test_raw_response_list(self, client: OnebusawaySDK) -> None:
29+
response = client.stop_ids_for_agency.with_raw_response.list(
30+
"agencyID",
31+
)
32+
33+
assert response.is_closed is True
34+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
35+
stop_ids_for_agency = response.parse()
36+
assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"])
37+
38+
@parametrize
39+
def test_streaming_response_list(self, client: OnebusawaySDK) -> None:
40+
with client.stop_ids_for_agency.with_streaming_response.list(
41+
"agencyID",
42+
) as response:
43+
assert not response.is_closed
44+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
45+
46+
stop_ids_for_agency = response.parse()
47+
assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"])
48+
49+
assert cast(Any, response.is_closed) is True
50+
51+
@parametrize
52+
def test_path_params_list(self, client: OnebusawaySDK) -> None:
53+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"):
54+
client.stop_ids_for_agency.with_raw_response.list(
55+
"",
56+
)
57+
58+
59+
class TestAsyncStopIDsForAgency:
60+
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
61+
62+
@parametrize
63+
async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None:
64+
stop_ids_for_agency = await async_client.stop_ids_for_agency.list(
65+
"agencyID",
66+
)
67+
assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"])
68+
69+
@parametrize
70+
async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None:
71+
response = await async_client.stop_ids_for_agency.with_raw_response.list(
72+
"agencyID",
73+
)
74+
75+
assert response.is_closed is True
76+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
77+
stop_ids_for_agency = await response.parse()
78+
assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"])
79+
80+
@parametrize
81+
async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None:
82+
async with async_client.stop_ids_for_agency.with_streaming_response.list(
83+
"agencyID",
84+
) as response:
85+
assert not response.is_closed
86+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
87+
88+
stop_ids_for_agency = await response.parse()
89+
assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"])
90+
91+
assert cast(Any, response.is_closed) is True
92+
93+
@parametrize
94+
async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None:
95+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"):
96+
await async_client.stop_ids_for_agency.with_raw_response.list(
97+
"",
98+
)

0 commit comments

Comments
 (0)