Skip to content

Commit bb39847

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
chore(internal): codegen related update (#83)
1 parent 71f8ac8 commit bb39847

File tree

8 files changed

+274
-1
lines changed

8 files changed

+274
-1
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 27
1+
configured_endpoints: 28
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-11f477dc10198d7715051922bc80ed108d05f5e44fd710ab2bcfd5e6ddf1dabc.yml

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44
from onebusaway.types import References, ResponseWrapper
55
```
66

7+
# AgenciesWithCoverage
8+
9+
Types:
10+
11+
```python
12+
from onebusaway.types import AgenciesWithCoverageListResponse
13+
```
14+
15+
Methods:
16+
17+
- <code title="get /api/where/agencies-with-coverage.json">client.agencies_with_coverage.<a href="./src/onebusaway/resources/agencies_with_coverage.py">list</a>() -> <a href="./src/onebusaway/types/agencies_with_coverage_list_response.py">AgenciesWithCoverageListResponse</a></code>
18+
719
# Agency
820

921
Types:

src/onebusaway/_client.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747

4848
class OnebusawaySDK(SyncAPIClient):
49+
agencies_with_coverage: resources.AgenciesWithCoverageResource
4950
agency: resources.AgencyResource
5051
vehicles_for_agency: resources.VehiclesForAgencyResource
5152
config: resources.ConfigResource
@@ -129,6 +130,7 @@ def __init__(
129130
_strict_response_validation=_strict_response_validation,
130131
)
131132

133+
self.agencies_with_coverage = resources.AgenciesWithCoverageResource(self)
132134
self.agency = resources.AgencyResource(self)
133135
self.vehicles_for_agency = resources.VehiclesForAgencyResource(self)
134136
self.config = resources.ConfigResource(self)
@@ -272,6 +274,7 @@ def _make_status_error(
272274

273275

274276
class AsyncOnebusawaySDK(AsyncAPIClient):
277+
agencies_with_coverage: resources.AsyncAgenciesWithCoverageResource
275278
agency: resources.AsyncAgencyResource
276279
vehicles_for_agency: resources.AsyncVehiclesForAgencyResource
277280
config: resources.AsyncConfigResource
@@ -355,6 +358,7 @@ def __init__(
355358
_strict_response_validation=_strict_response_validation,
356359
)
357360

361+
self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResource(self)
358362
self.agency = resources.AsyncAgencyResource(self)
359363
self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResource(self)
360364
self.config = resources.AsyncConfigResource(self)
@@ -499,6 +503,9 @@ def _make_status_error(
499503

500504
class OnebusawaySDKWithRawResponse:
501505
def __init__(self, client: OnebusawaySDK) -> None:
506+
self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithRawResponse(
507+
client.agencies_with_coverage
508+
)
502509
self.agency = resources.AgencyResourceWithRawResponse(client.agency)
503510
self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency)
504511
self.config = resources.ConfigResourceWithRawResponse(client.config)
@@ -533,6 +540,9 @@ def __init__(self, client: OnebusawaySDK) -> None:
533540

534541
class AsyncOnebusawaySDKWithRawResponse:
535542
def __init__(self, client: AsyncOnebusawaySDK) -> None:
543+
self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithRawResponse(
544+
client.agencies_with_coverage
545+
)
536546
self.agency = resources.AsyncAgencyResourceWithRawResponse(client.agency)
537547
self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency)
538548
self.config = resources.AsyncConfigResourceWithRawResponse(client.config)
@@ -569,6 +579,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
569579

570580
class OnebusawaySDKWithStreamedResponse:
571581
def __init__(self, client: OnebusawaySDK) -> None:
582+
self.agencies_with_coverage = resources.AgenciesWithCoverageResourceWithStreamingResponse(
583+
client.agencies_with_coverage
584+
)
572585
self.agency = resources.AgencyResourceWithStreamingResponse(client.agency)
573586
self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency)
574587
self.config = resources.ConfigResourceWithStreamingResponse(client.config)
@@ -607,6 +620,9 @@ def __init__(self, client: OnebusawaySDK) -> None:
607620

608621
class AsyncOnebusawaySDKWithStreamedResponse:
609622
def __init__(self, client: AsyncOnebusawaySDK) -> None:
623+
self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResourceWithStreamingResponse(
624+
client.agencies_with_coverage
625+
)
610626
self.agency = resources.AsyncAgencyResourceWithStreamingResponse(client.agency)
611627
self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithStreamingResponse(
612628
client.vehicles_for_agency

src/onebusaway/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,14 @@
192192
ArrivalAndDepartureResourceWithStreamingResponse,
193193
AsyncArrivalAndDepartureResourceWithStreamingResponse,
194194
)
195+
from .agencies_with_coverage import (
196+
AgenciesWithCoverageResource,
197+
AsyncAgenciesWithCoverageResource,
198+
AgenciesWithCoverageResourceWithRawResponse,
199+
AsyncAgenciesWithCoverageResourceWithRawResponse,
200+
AgenciesWithCoverageResourceWithStreamingResponse,
201+
AsyncAgenciesWithCoverageResourceWithStreamingResponse,
202+
)
195203
from .report_problem_with_stop import (
196204
ReportProblemWithStopResource,
197205
AsyncReportProblemWithStopResource,
@@ -210,6 +218,12 @@
210218
)
211219

212220
__all__ = [
221+
"AgenciesWithCoverageResource",
222+
"AsyncAgenciesWithCoverageResource",
223+
"AgenciesWithCoverageResourceWithRawResponse",
224+
"AsyncAgenciesWithCoverageResourceWithRawResponse",
225+
"AgenciesWithCoverageResourceWithStreamingResponse",
226+
"AsyncAgenciesWithCoverageResourceWithStreamingResponse",
213227
"AgencyResource",
214228
"AsyncAgencyResource",
215229
"AgencyResourceWithRawResponse",
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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.agencies_with_coverage_list_response import AgenciesWithCoverageListResponse
18+
19+
__all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource"]
20+
21+
22+
class AgenciesWithCoverageResource(SyncAPIResource):
23+
@cached_property
24+
def with_raw_response(self) -> AgenciesWithCoverageResourceWithRawResponse:
25+
return AgenciesWithCoverageResourceWithRawResponse(self)
26+
27+
@cached_property
28+
def with_streaming_response(self) -> AgenciesWithCoverageResourceWithStreamingResponse:
29+
return AgenciesWithCoverageResourceWithStreamingResponse(self)
30+
31+
def list(
32+
self,
33+
*,
34+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
35+
# The extra values given here take precedence over values defined on the client or passed to this method.
36+
extra_headers: Headers | None = None,
37+
extra_query: Query | None = None,
38+
extra_body: Body | None = None,
39+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
40+
) -> AgenciesWithCoverageListResponse:
41+
"""
42+
Returns a list of all transit agencies currently supported by OneBusAway along
43+
with the center of their coverage area.
44+
"""
45+
return self._get(
46+
"/api/where/agencies-with-coverage.json",
47+
options=make_request_options(
48+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
49+
),
50+
cast_to=AgenciesWithCoverageListResponse,
51+
)
52+
53+
54+
class AsyncAgenciesWithCoverageResource(AsyncAPIResource):
55+
@cached_property
56+
def with_raw_response(self) -> AsyncAgenciesWithCoverageResourceWithRawResponse:
57+
return AsyncAgenciesWithCoverageResourceWithRawResponse(self)
58+
59+
@cached_property
60+
def with_streaming_response(self) -> AsyncAgenciesWithCoverageResourceWithStreamingResponse:
61+
return AsyncAgenciesWithCoverageResourceWithStreamingResponse(self)
62+
63+
async def list(
64+
self,
65+
*,
66+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
67+
# The extra values given here take precedence over values defined on the client or passed to this method.
68+
extra_headers: Headers | None = None,
69+
extra_query: Query | None = None,
70+
extra_body: Body | None = None,
71+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
72+
) -> AgenciesWithCoverageListResponse:
73+
"""
74+
Returns a list of all transit agencies currently supported by OneBusAway along
75+
with the center of their coverage area.
76+
"""
77+
return await self._get(
78+
"/api/where/agencies-with-coverage.json",
79+
options=make_request_options(
80+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
81+
),
82+
cast_to=AgenciesWithCoverageListResponse,
83+
)
84+
85+
86+
class AgenciesWithCoverageResourceWithRawResponse:
87+
def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None:
88+
self._agencies_with_coverage = agencies_with_coverage
89+
90+
self.list = to_raw_response_wrapper(
91+
agencies_with_coverage.list,
92+
)
93+
94+
95+
class AsyncAgenciesWithCoverageResourceWithRawResponse:
96+
def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None:
97+
self._agencies_with_coverage = agencies_with_coverage
98+
99+
self.list = async_to_raw_response_wrapper(
100+
agencies_with_coverage.list,
101+
)
102+
103+
104+
class AgenciesWithCoverageResourceWithStreamingResponse:
105+
def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None:
106+
self._agencies_with_coverage = agencies_with_coverage
107+
108+
self.list = to_streamed_response_wrapper(
109+
agencies_with_coverage.list,
110+
)
111+
112+
113+
class AsyncAgenciesWithCoverageResourceWithStreamingResponse:
114+
def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None:
115+
self._agencies_with_coverage = agencies_with_coverage
116+
117+
self.list = async_to_streamed_response_wrapper(
118+
agencies_with_coverage.list,
119+
)

src/onebusaway/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse
3737
from .routes_for_location_retrieve_params import RoutesForLocationRetrieveParams as RoutesForLocationRetrieveParams
3838
from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse
39+
from .agencies_with_coverage_list_response import AgenciesWithCoverageListResponse as AgenciesWithCoverageListResponse
3940
from .schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse as ScheduleForRouteRetrieveResponse
4041
from .stops_for_location_retrieve_response import StopsForLocationRetrieveResponse as StopsForLocationRetrieveResponse
4142
from .trips_for_location_retrieve_response import TripsForLocationRetrieveResponse as TripsForLocationRetrieveResponse
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List
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__ = [
12+
"AgenciesWithCoverageListResponse",
13+
"AgenciesWithCoverageListResponseData",
14+
"AgenciesWithCoverageListResponseDataList",
15+
]
16+
17+
18+
class AgenciesWithCoverageListResponseDataList(BaseModel):
19+
agency_id: str = FieldInfo(alias="agencyId")
20+
21+
lat: float
22+
23+
lat_span: float = FieldInfo(alias="latSpan")
24+
25+
lon: float
26+
27+
lon_span: float = FieldInfo(alias="lonSpan")
28+
29+
30+
class AgenciesWithCoverageListResponseData(BaseModel):
31+
limit_exceeded: bool = FieldInfo(alias="limitExceeded")
32+
33+
list: List[AgenciesWithCoverageListResponseDataList]
34+
35+
references: References
36+
37+
38+
class AgenciesWithCoverageListResponse(ResponseWrapper):
39+
data: AgenciesWithCoverageListResponseData
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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 AgenciesWithCoverageListResponse
13+
14+
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
15+
16+
17+
class TestAgenciesWithCoverage:
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+
agencies_with_coverage = client.agencies_with_coverage.list()
23+
assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"])
24+
25+
@parametrize
26+
def test_raw_response_list(self, client: OnebusawaySDK) -> None:
27+
response = client.agencies_with_coverage.with_raw_response.list()
28+
29+
assert response.is_closed is True
30+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
31+
agencies_with_coverage = response.parse()
32+
assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"])
33+
34+
@parametrize
35+
def test_streaming_response_list(self, client: OnebusawaySDK) -> None:
36+
with client.agencies_with_coverage.with_streaming_response.list() as response:
37+
assert not response.is_closed
38+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
39+
40+
agencies_with_coverage = response.parse()
41+
assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"])
42+
43+
assert cast(Any, response.is_closed) is True
44+
45+
46+
class TestAsyncAgenciesWithCoverage:
47+
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
48+
49+
@parametrize
50+
async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None:
51+
agencies_with_coverage = await async_client.agencies_with_coverage.list()
52+
assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"])
53+
54+
@parametrize
55+
async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None:
56+
response = await async_client.agencies_with_coverage.with_raw_response.list()
57+
58+
assert response.is_closed is True
59+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
60+
agencies_with_coverage = await response.parse()
61+
assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"])
62+
63+
@parametrize
64+
async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None:
65+
async with async_client.agencies_with_coverage.with_streaming_response.list() as response:
66+
assert not response.is_closed
67+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
68+
69+
agencies_with_coverage = await response.parse()
70+
assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"])
71+
72+
assert cast(Any, response.is_closed) is True

0 commit comments

Comments
 (0)