diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index aaf968a..b56c3d0 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-alpha.3"
+ ".": "0.1.0-alpha.4"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 9a1a83d..441e696 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 14
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-44ff52d3676ae12480b775507fe3af8a229d94d6490297ad319f4e37ffef437d.yml
+configured_endpoints: 15
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-735f145c4ce18bd5a2c869289186f175513bfa496507de7ff0734f9242adf427.yml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 946094b..589f9a5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.1.0-alpha.4 (2024-07-27)
+
+Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)
+
+### Features
+
+* **api:** OpenAPI spec update via Stainless API ([#15](https://github.com/OneBusAway/python-sdk/issues/15)) ([171d1b7](https://github.com/OneBusAway/python-sdk/commit/171d1b79ca2cc120d315566f3f861c96a05d8a3b))
+
## 0.1.0-alpha.3 (2024-07-27)
Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
diff --git a/api.md b/api.md
index 4d50a2d..759705b 100644
--- a/api.md
+++ b/api.md
@@ -88,6 +88,18 @@ Methods:
- client.stop.retrieve(stop_id) -> StopRetrieveResponse
+# StopIDsForAgency
+
+Types:
+
+```python
+from onebusaway.types import StopIDsForAgencyListResponse
+```
+
+Methods:
+
+- client.stop_ids_for_agency.list(agency_id) -> StopIDsForAgencyListResponse
+
# Route
Types:
diff --git a/examples/stop_ids_for_agency.py b/examples/stop_ids_for_agency.py
new file mode 100644
index 0000000..dec4faa
--- /dev/null
+++ b/examples/stop_ids_for_agency.py
@@ -0,0 +1,16 @@
+
+
+import onebusaway
+
+
+def main_sync() -> None:
+ client = onebusaway.OnebusawaySDK(api_key="TEST")
+ agency_id = "40";
+ stop_ids = client.stop_ids_for_agency.list(agency_id)
+ if stop_ids.data:
+ for stop_id in stop_ids.data.list:
+ print(stop_id)
+
+
+if __name__ == "__main__":
+ main_sync()
diff --git a/pyproject.toml b/pyproject.toml
index 6af69cc..e73225d 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "onebusaway"
-version = "0.1.0-alpha.3"
+version = "0.1.0-alpha.4"
description = "The official Python library for the onebusaway-sdk API"
dynamic = ["readme"]
license = "Apache-2.0"
diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py
index b07ca7d..045019a 100644
--- a/src/onebusaway/_client.py
+++ b/src/onebusaway/_client.py
@@ -53,6 +53,7 @@ class OnebusawaySDK(SyncAPIClient):
stops_for_location: resources.StopsForLocationResource
stops_for_route: resources.StopsForRouteResource
stop: resources.StopResource
+ stop_ids_for_agency: resources.StopIDsForAgencyResource
route: resources.RouteResource
arrival_and_departure: resources.ArrivalAndDepartureResource
trip: resources.TripResource
@@ -123,6 +124,7 @@ def __init__(
self.stops_for_location = resources.StopsForLocationResource(self)
self.stops_for_route = resources.StopsForRouteResource(self)
self.stop = resources.StopResource(self)
+ self.stop_ids_for_agency = resources.StopIDsForAgencyResource(self)
self.route = resources.RouteResource(self)
self.arrival_and_departure = resources.ArrivalAndDepartureResource(self)
self.trip = resources.TripResource(self)
@@ -253,6 +255,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
stops_for_location: resources.AsyncStopsForLocationResource
stops_for_route: resources.AsyncStopsForRouteResource
stop: resources.AsyncStopResource
+ stop_ids_for_agency: resources.AsyncStopIDsForAgencyResource
route: resources.AsyncRouteResource
arrival_and_departure: resources.AsyncArrivalAndDepartureResource
trip: resources.AsyncTripResource
@@ -323,6 +326,7 @@ def __init__(
self.stops_for_location = resources.AsyncStopsForLocationResource(self)
self.stops_for_route = resources.AsyncStopsForRouteResource(self)
self.stop = resources.AsyncStopResource(self)
+ self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResource(self)
self.route = resources.AsyncRouteResource(self)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResource(self)
self.trip = resources.AsyncTripResource(self)
@@ -456,6 +460,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.stops_for_location = resources.StopsForLocationResourceWithRawResponse(client.stops_for_location)
self.stops_for_route = resources.StopsForRouteResourceWithRawResponse(client.stops_for_route)
self.stop = resources.StopResourceWithRawResponse(client.stop)
+ self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency)
self.route = resources.RouteResourceWithRawResponse(client.route)
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithRawResponse(client.arrival_and_departure)
self.trip = resources.TripResourceWithRawResponse(client.trip)
@@ -475,6 +480,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
self.stops_for_location = resources.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location)
self.stops_for_route = resources.AsyncStopsForRouteResourceWithRawResponse(client.stops_for_route)
self.stop = resources.AsyncStopResourceWithRawResponse(client.stop)
+ self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithRawResponse(client.stop_ids_for_agency)
self.route = resources.AsyncRouteResourceWithRawResponse(client.route)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithRawResponse(
client.arrival_and_departure
@@ -496,6 +502,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.stops_for_location = resources.StopsForLocationResourceWithStreamingResponse(client.stops_for_location)
self.stops_for_route = resources.StopsForRouteResourceWithStreamingResponse(client.stops_for_route)
self.stop = resources.StopResourceWithStreamingResponse(client.stop)
+ self.stop_ids_for_agency = resources.StopIDsForAgencyResourceWithStreamingResponse(client.stop_ids_for_agency)
self.route = resources.RouteResourceWithStreamingResponse(client.route)
self.arrival_and_departure = resources.ArrivalAndDepartureResourceWithStreamingResponse(
client.arrival_and_departure
@@ -519,6 +526,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
)
self.stops_for_route = resources.AsyncStopsForRouteResourceWithStreamingResponse(client.stops_for_route)
self.stop = resources.AsyncStopResourceWithStreamingResponse(client.stop)
+ self.stop_ids_for_agency = resources.AsyncStopIDsForAgencyResourceWithStreamingResponse(
+ client.stop_ids_for_agency
+ )
self.route = resources.AsyncRouteResourceWithStreamingResponse(client.route)
self.arrival_and_departure = resources.AsyncArrivalAndDepartureResourceWithStreamingResponse(
client.arrival_and_departure
diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py
index 75bdff5..c6c89c3 100644
--- a/src/onebusaway/_version.py
+++ b/src/onebusaway/_version.py
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "onebusaway"
-__version__ = "0.1.0-alpha.3" # x-release-please-version
+__version__ = "0.1.0-alpha.4" # x-release-please-version
diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py
index 9c3ef40..a81c80e 100644
--- a/src/onebusaway/resources/__init__.py
+++ b/src/onebusaway/resources/__init__.py
@@ -88,6 +88,14 @@
TripsForLocationResourceWithStreamingResponse,
AsyncTripsForLocationResourceWithStreamingResponse,
)
+from .stop_ids_for_agency import (
+ StopIDsForAgencyResource,
+ AsyncStopIDsForAgencyResource,
+ StopIDsForAgencyResourceWithRawResponse,
+ AsyncStopIDsForAgencyResourceWithRawResponse,
+ StopIDsForAgencyResourceWithStreamingResponse,
+ AsyncStopIDsForAgencyResourceWithStreamingResponse,
+)
from .arrival_and_departure import (
ArrivalAndDepartureResource,
AsyncArrivalAndDepartureResource,
@@ -148,6 +156,12 @@
"AsyncStopResourceWithRawResponse",
"StopResourceWithStreamingResponse",
"AsyncStopResourceWithStreamingResponse",
+ "StopIDsForAgencyResource",
+ "AsyncStopIDsForAgencyResource",
+ "StopIDsForAgencyResourceWithRawResponse",
+ "AsyncStopIDsForAgencyResourceWithRawResponse",
+ "StopIDsForAgencyResourceWithStreamingResponse",
+ "AsyncStopIDsForAgencyResourceWithStreamingResponse",
"RouteResource",
"AsyncRouteResource",
"RouteResourceWithRawResponse",
diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py
new file mode 100644
index 0000000..a611a6e
--- /dev/null
+++ b/src/onebusaway/resources/stop_ids_for_agency.py
@@ -0,0 +1,141 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import httpx
+
+from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from .._compat import cached_property
+from .._resource import SyncAPIResource, AsyncAPIResource
+from .._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from .._base_client import make_request_options
+from ..types.stop_ids_for_agency_list_response import StopIDsForAgencyListResponse
+
+__all__ = ["StopIDsForAgencyResource", "AsyncStopIDsForAgencyResource"]
+
+
+class StopIDsForAgencyResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> StopIDsForAgencyResourceWithRawResponse:
+ return StopIDsForAgencyResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> StopIDsForAgencyResourceWithStreamingResponse:
+ return StopIDsForAgencyResourceWithStreamingResponse(self)
+
+ def list(
+ self,
+ agency_id: str,
+ *,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> StopIDsForAgencyListResponse:
+ """
+ Get stop IDs for a specific agency
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not agency_id:
+ raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}")
+ return self._get(
+ f"/api/where/stop-ids-for-agency/{agency_id}.json",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=StopIDsForAgencyListResponse,
+ )
+
+
+class AsyncStopIDsForAgencyResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncStopIDsForAgencyResourceWithRawResponse:
+ return AsyncStopIDsForAgencyResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncStopIDsForAgencyResourceWithStreamingResponse:
+ return AsyncStopIDsForAgencyResourceWithStreamingResponse(self)
+
+ async def list(
+ self,
+ agency_id: str,
+ *,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> StopIDsForAgencyListResponse:
+ """
+ Get stop IDs for a specific agency
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not agency_id:
+ raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}")
+ return await self._get(
+ f"/api/where/stop-ids-for-agency/{agency_id}.json",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=StopIDsForAgencyListResponse,
+ )
+
+
+class StopIDsForAgencyResourceWithRawResponse:
+ def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None:
+ self._stop_ids_for_agency = stop_ids_for_agency
+
+ self.list = to_raw_response_wrapper(
+ stop_ids_for_agency.list,
+ )
+
+
+class AsyncStopIDsForAgencyResourceWithRawResponse:
+ def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None:
+ self._stop_ids_for_agency = stop_ids_for_agency
+
+ self.list = async_to_raw_response_wrapper(
+ stop_ids_for_agency.list,
+ )
+
+
+class StopIDsForAgencyResourceWithStreamingResponse:
+ def __init__(self, stop_ids_for_agency: StopIDsForAgencyResource) -> None:
+ self._stop_ids_for_agency = stop_ids_for_agency
+
+ self.list = to_streamed_response_wrapper(
+ stop_ids_for_agency.list,
+ )
+
+
+class AsyncStopIDsForAgencyResourceWithStreamingResponse:
+ def __init__(self, stop_ids_for_agency: AsyncStopIDsForAgencyResource) -> None:
+ self._stop_ids_for_agency = stop_ids_for_agency
+
+ self.list = async_to_streamed_response_wrapper(
+ stop_ids_for_agency.list,
+ )
diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py
index 7a04693..6bedc9c 100644
--- a/src/onebusaway/types/__init__.py
+++ b/src/onebusaway/types/__init__.py
@@ -15,6 +15,7 @@
from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse
from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams
from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams
+from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse
from .stops_for_location_retrieve_params import StopsForLocationRetrieveParams as StopsForLocationRetrieveParams
from .trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse as TripForVehicleRetrieveResponse
from .trips_for_location_retrieve_params import TripsForLocationRetrieveParams as TripsForLocationRetrieveParams
diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py
new file mode 100644
index 0000000..bf3927c
--- /dev/null
+++ b/src/onebusaway/types/stop_ids_for_agency_list_response.py
@@ -0,0 +1,23 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List, Optional
+
+from pydantic import Field as FieldInfo
+
+from .._models import BaseModel
+from .shared.references import References
+from .shared.response_wrapper import ResponseWrapper
+
+__all__ = ["StopIDsForAgencyListResponse", "StopIDsForAgencyListResponseData"]
+
+
+class StopIDsForAgencyListResponseData(BaseModel):
+ list: List[str]
+
+ references: References
+
+ limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None)
+
+
+class StopIDsForAgencyListResponse(ResponseWrapper):
+ data: Optional[StopIDsForAgencyListResponseData] = None
diff --git a/tests/api_resources/test_stop_ids_for_agency.py b/tests/api_resources/test_stop_ids_for_agency.py
new file mode 100644
index 0000000..923a743
--- /dev/null
+++ b/tests/api_resources/test_stop_ids_for_agency.py
@@ -0,0 +1,98 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK
+from tests.utils import assert_matches_type
+from onebusaway.types import StopIDsForAgencyListResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestStopIDsForAgency:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_list(self, client: OnebusawaySDK) -> None:
+ stop_ids_for_agency = client.stop_ids_for_agency.list(
+ "agencyID",
+ )
+ assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"])
+
+ @parametrize
+ def test_raw_response_list(self, client: OnebusawaySDK) -> None:
+ response = client.stop_ids_for_agency.with_raw_response.list(
+ "agencyID",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ stop_ids_for_agency = response.parse()
+ assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list(self, client: OnebusawaySDK) -> None:
+ with client.stop_ids_for_agency.with_streaming_response.list(
+ "agencyID",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ stop_ids_for_agency = response.parse()
+ assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_list(self, client: OnebusawaySDK) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"):
+ client.stop_ids_for_agency.with_raw_response.list(
+ "",
+ )
+
+
+class TestAsyncStopIDsForAgency:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None:
+ stop_ids_for_agency = await async_client.stop_ids_for_agency.list(
+ "agencyID",
+ )
+ assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None:
+ response = await async_client.stop_ids_for_agency.with_raw_response.list(
+ "agencyID",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ stop_ids_for_agency = await response.parse()
+ assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None:
+ async with async_client.stop_ids_for_agency.with_streaming_response.list(
+ "agencyID",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ stop_ids_for_agency = await response.parse()
+ assert_matches_type(StopIDsForAgencyListResponse, stop_ids_for_agency, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_list(self, async_client: AsyncOnebusawaySDK) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `agency_id` but received ''"):
+ await async_client.stop_ids_for_agency.with_raw_response.list(
+ "",
+ )