From 349fab1505b040ed2e6fc7dd8d44a8f5cbe90385 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 29 Mar 2026 18:19:43 +0000 Subject: [PATCH 1/2] feat(api): api update --- .stats.yml | 8 +- api.md | 12 + src/onebusaway/_client.py | 65 ++++ src/onebusaway/resources/__init__.py | 14 + .../arrivals_and_departures_for_location.py | 269 +++++++++++++++ src/onebusaway/types/__init__.py | 6 + ...and_departures_for_location_list_params.py | 50 +++ ...d_departures_for_location_list_response.py | 306 ++++++++++++++++++ ...st_arrivals_and_departures_for_location.py | 144 +++++++++ 9 files changed, 870 insertions(+), 4 deletions(-) create mode 100644 src/onebusaway/resources/arrivals_and_departures_for_location.py create mode 100644 src/onebusaway/types/arrivals_and_departures_for_location_list_params.py create mode 100644 src/onebusaway/types/arrivals_and_departures_for_location_list_response.py create mode 100644 tests/api_resources/test_arrivals_and_departures_for_location.py diff --git a/.stats.yml b/.stats.yml index 1266cd82..fa222e3a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-30baad9d29b0909d180aae300750a0cd8425b52d7a60ba365b6aa4e5f8da6fab.yml -openapi_spec_hash: 218466af34966d9b08728f107cb3b3b0 -config_hash: 3871f5d21bb38ddd334ec04721dea64d +configured_endpoints: 30 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-a30b0967ffed17b866dc65b5528148a06a42cce7c3c6d8f740ae2f6079963e7d.yml +openapi_spec_hash: 9bf1e5bf00ef9936a9181ebd0956d5b8 +config_hash: c28ddf5b7754155603d9fd1c5fcaeeff diff --git a/api.md b/api.md index 7a627caf..99bf45d7 100644 --- a/api.md +++ b/api.md @@ -196,6 +196,18 @@ Methods: - client.schedule_for_route.retrieve(route_id, \*\*params) -> ScheduleForRouteRetrieveResponse +# ArrivalsAndDeparturesForLocation + +Types: + +```python +from onebusaway.types import ArrivalsAndDeparturesForLocationListResponse +``` + +Methods: + +- client.arrivals_and_departures_for_location.list(\*\*params) -> ArrivalsAndDeparturesForLocationListResponse + # ArrivalAndDeparture Types: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py index 5923bba3..43f6c0bb 100644 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -60,6 +60,7 @@ agencies_with_coverage, report_problem_with_stop, report_problem_with_trip, + arrivals_and_departures_for_location, ) from .resources.stop import StopResource, AsyncStopResource from .resources.trip import TripResource, AsyncTripResource @@ -89,6 +90,10 @@ from .resources.agencies_with_coverage import AgenciesWithCoverageResource, AsyncAgenciesWithCoverageResource from .resources.report_problem_with_stop import ReportProblemWithStopResource, AsyncReportProblemWithStopResource from .resources.report_problem_with_trip import ReportProblemWithTripResource, AsyncReportProblemWithTripResource + from .resources.arrivals_and_departures_for_location import ( + ArrivalsAndDeparturesForLocationResource, + AsyncArrivalsAndDeparturesForLocationResource, + ) __all__ = [ "Timeout", @@ -253,6 +258,12 @@ def schedule_for_route(self) -> ScheduleForRouteResource: return ScheduleForRouteResource(self) + @cached_property + def arrivals_and_departures_for_location(self) -> ArrivalsAndDeparturesForLocationResource: + from .resources.arrivals_and_departures_for_location import ArrivalsAndDeparturesForLocationResource + + return ArrivalsAndDeparturesForLocationResource(self) + @cached_property def arrival_and_departure(self) -> ArrivalAndDepartureResource: from .resources.arrival_and_departure import ArrivalAndDepartureResource @@ -600,6 +611,12 @@ def schedule_for_route(self) -> AsyncScheduleForRouteResource: return AsyncScheduleForRouteResource(self) + @cached_property + def arrivals_and_departures_for_location(self) -> AsyncArrivalsAndDeparturesForLocationResource: + from .resources.arrivals_and_departures_for_location import AsyncArrivalsAndDeparturesForLocationResource + + return AsyncArrivalsAndDeparturesForLocationResource(self) + @cached_property def arrival_and_departure(self) -> AsyncArrivalAndDepartureResource: from .resources.arrival_and_departure import AsyncArrivalAndDepartureResource @@ -898,6 +915,18 @@ def schedule_for_route(self) -> schedule_for_route.ScheduleForRouteResourceWithR return ScheduleForRouteResourceWithRawResponse(self._client.schedule_for_route) + @cached_property + def arrivals_and_departures_for_location( + self, + ) -> arrivals_and_departures_for_location.ArrivalsAndDeparturesForLocationResourceWithRawResponse: + from .resources.arrivals_and_departures_for_location import ( + ArrivalsAndDeparturesForLocationResourceWithRawResponse, + ) + + return ArrivalsAndDeparturesForLocationResourceWithRawResponse( + self._client.arrivals_and_departures_for_location + ) + @cached_property def arrival_and_departure(self) -> arrival_and_departure.ArrivalAndDepartureResourceWithRawResponse: from .resources.arrival_and_departure import ArrivalAndDepartureResourceWithRawResponse @@ -1073,6 +1102,18 @@ def schedule_for_route(self) -> schedule_for_route.AsyncScheduleForRouteResource return AsyncScheduleForRouteResourceWithRawResponse(self._client.schedule_for_route) + @cached_property + def arrivals_and_departures_for_location( + self, + ) -> arrivals_and_departures_for_location.AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse: + from .resources.arrivals_and_departures_for_location import ( + AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse, + ) + + return AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse( + self._client.arrivals_and_departures_for_location + ) + @cached_property def arrival_and_departure(self) -> arrival_and_departure.AsyncArrivalAndDepartureResourceWithRawResponse: from .resources.arrival_and_departure import AsyncArrivalAndDepartureResourceWithRawResponse @@ -1248,6 +1289,18 @@ def schedule_for_route(self) -> schedule_for_route.ScheduleForRouteResourceWithS return ScheduleForRouteResourceWithStreamingResponse(self._client.schedule_for_route) + @cached_property + def arrivals_and_departures_for_location( + self, + ) -> arrivals_and_departures_for_location.ArrivalsAndDeparturesForLocationResourceWithStreamingResponse: + from .resources.arrivals_and_departures_for_location import ( + ArrivalsAndDeparturesForLocationResourceWithStreamingResponse, + ) + + return ArrivalsAndDeparturesForLocationResourceWithStreamingResponse( + self._client.arrivals_and_departures_for_location + ) + @cached_property def arrival_and_departure(self) -> arrival_and_departure.ArrivalAndDepartureResourceWithStreamingResponse: from .resources.arrival_and_departure import ArrivalAndDepartureResourceWithStreamingResponse @@ -1423,6 +1476,18 @@ def schedule_for_route(self) -> schedule_for_route.AsyncScheduleForRouteResource return AsyncScheduleForRouteResourceWithStreamingResponse(self._client.schedule_for_route) + @cached_property + def arrivals_and_departures_for_location( + self, + ) -> arrivals_and_departures_for_location.AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse: + from .resources.arrivals_and_departures_for_location import ( + AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse, + ) + + return AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse( + self._client.arrivals_and_departures_for_location + ) + @cached_property def arrival_and_departure(self) -> arrival_and_departure.AsyncArrivalAndDepartureResourceWithStreamingResponse: from .resources.arrival_and_departure import AsyncArrivalAndDepartureResourceWithStreamingResponse diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py index 0a958d2a..99cd9396 100644 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -224,6 +224,14 @@ ReportProblemWithTripResourceWithStreamingResponse, AsyncReportProblemWithTripResourceWithStreamingResponse, ) +from .arrivals_and_departures_for_location import ( + ArrivalsAndDeparturesForLocationResource, + AsyncArrivalsAndDeparturesForLocationResource, + ArrivalsAndDeparturesForLocationResourceWithRawResponse, + AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse, + ArrivalsAndDeparturesForLocationResourceWithStreamingResponse, + AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse, +) __all__ = [ "AgenciesWithCoverageResource", @@ -322,6 +330,12 @@ "AsyncScheduleForRouteResourceWithRawResponse", "ScheduleForRouteResourceWithStreamingResponse", "AsyncScheduleForRouteResourceWithStreamingResponse", + "ArrivalsAndDeparturesForLocationResource", + "AsyncArrivalsAndDeparturesForLocationResource", + "ArrivalsAndDeparturesForLocationResourceWithRawResponse", + "AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse", + "ArrivalsAndDeparturesForLocationResourceWithStreamingResponse", + "AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse", "ArrivalAndDepartureResource", "AsyncArrivalAndDepartureResource", "ArrivalAndDepartureResourceWithRawResponse", diff --git a/src/onebusaway/resources/arrivals_and_departures_for_location.py b/src/onebusaway/resources/arrivals_and_departures_for_location.py new file mode 100644 index 00000000..adf45b71 --- /dev/null +++ b/src/onebusaway/resources/arrivals_and_departures_for_location.py @@ -0,0 +1,269 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import arrivals_and_departures_for_location_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import maybe_transform, async_maybe_transform +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.arrivals_and_departures_for_location_list_response import ArrivalsAndDeparturesForLocationListResponse + +__all__ = ["ArrivalsAndDeparturesForLocationResource", "AsyncArrivalsAndDeparturesForLocationResource"] + + +class ArrivalsAndDeparturesForLocationResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ArrivalsAndDeparturesForLocationResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ + return ArrivalsAndDeparturesForLocationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ArrivalsAndDeparturesForLocationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ + return ArrivalsAndDeparturesForLocationResourceWithStreamingResponse(self) + + def list( + self, + *, + lat: float, + lon: float, + empty_returns_not_found: bool | Omit = omit, + lat_span: float | Omit = omit, + lon_span: float | Omit = omit, + max_count: int | Omit = omit, + minutes_after: int | Omit = omit, + minutes_before: int | Omit = omit, + radius: float | Omit = omit, + route_type: str | Omit = omit, + time: int | Omit = omit, + # 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, + ) -> ArrivalsAndDeparturesForLocationListResponse: + """ + Returns real-time arrival and departure data for stops within a bounding box or + radius centered on a specific location. + + Args: + lat: The latitude coordinate of the search center. + + lon: The longitude coordinate of the search center. + + empty_returns_not_found: If true, returns a 404 Not Found error instead of an empty result. + + lat_span: Sets the latitude limits of the search bounding box. + + lon_span: Sets the longitude limits of the search bounding box. + + max_count: The max size of the list of nearby stops and arrivals to return. Defaults to + 250, max 1000. + + minutes_after: Include arrivals and departures this many minutes after the query time. + + minutes_before: Include arrivals and departures this many minutes before the query time. + + radius: The search radius in meters. + + route_type: Optional list of GTFS routeTypes to filter by (comma delimited) e.g. "1,2,3". + + time: By default, returns the status right now. Can be queried at a specific time + (milliseconds since epoch) for testing. + + 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 + """ + return self._get( + "/api/where/arrivals-and-departures-for-location.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "lat": lat, + "lon": lon, + "empty_returns_not_found": empty_returns_not_found, + "lat_span": lat_span, + "lon_span": lon_span, + "max_count": max_count, + "minutes_after": minutes_after, + "minutes_before": minutes_before, + "radius": radius, + "route_type": route_type, + "time": time, + }, + arrivals_and_departures_for_location_list_params.ArrivalsAndDeparturesForLocationListParams, + ), + ), + cast_to=ArrivalsAndDeparturesForLocationListResponse, + ) + + +class AsyncArrivalsAndDeparturesForLocationResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/OneBusAway/python-sdk#accessing-raw-response-data-eg-headers + """ + return AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/OneBusAway/python-sdk#with_streaming_response + """ + return AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse(self) + + async def list( + self, + *, + lat: float, + lon: float, + empty_returns_not_found: bool | Omit = omit, + lat_span: float | Omit = omit, + lon_span: float | Omit = omit, + max_count: int | Omit = omit, + minutes_after: int | Omit = omit, + minutes_before: int | Omit = omit, + radius: float | Omit = omit, + route_type: str | Omit = omit, + time: int | Omit = omit, + # 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, + ) -> ArrivalsAndDeparturesForLocationListResponse: + """ + Returns real-time arrival and departure data for stops within a bounding box or + radius centered on a specific location. + + Args: + lat: The latitude coordinate of the search center. + + lon: The longitude coordinate of the search center. + + empty_returns_not_found: If true, returns a 404 Not Found error instead of an empty result. + + lat_span: Sets the latitude limits of the search bounding box. + + lon_span: Sets the longitude limits of the search bounding box. + + max_count: The max size of the list of nearby stops and arrivals to return. Defaults to + 250, max 1000. + + minutes_after: Include arrivals and departures this many minutes after the query time. + + minutes_before: Include arrivals and departures this many minutes before the query time. + + radius: The search radius in meters. + + route_type: Optional list of GTFS routeTypes to filter by (comma delimited) e.g. "1,2,3". + + time: By default, returns the status right now. Can be queried at a specific time + (milliseconds since epoch) for testing. + + 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 + """ + return await self._get( + "/api/where/arrivals-and-departures-for-location.json", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "lat": lat, + "lon": lon, + "empty_returns_not_found": empty_returns_not_found, + "lat_span": lat_span, + "lon_span": lon_span, + "max_count": max_count, + "minutes_after": minutes_after, + "minutes_before": minutes_before, + "radius": radius, + "route_type": route_type, + "time": time, + }, + arrivals_and_departures_for_location_list_params.ArrivalsAndDeparturesForLocationListParams, + ), + ), + cast_to=ArrivalsAndDeparturesForLocationListResponse, + ) + + +class ArrivalsAndDeparturesForLocationResourceWithRawResponse: + def __init__(self, arrivals_and_departures_for_location: ArrivalsAndDeparturesForLocationResource) -> None: + self._arrivals_and_departures_for_location = arrivals_and_departures_for_location + + self.list = to_raw_response_wrapper( + arrivals_and_departures_for_location.list, + ) + + +class AsyncArrivalsAndDeparturesForLocationResourceWithRawResponse: + def __init__(self, arrivals_and_departures_for_location: AsyncArrivalsAndDeparturesForLocationResource) -> None: + self._arrivals_and_departures_for_location = arrivals_and_departures_for_location + + self.list = async_to_raw_response_wrapper( + arrivals_and_departures_for_location.list, + ) + + +class ArrivalsAndDeparturesForLocationResourceWithStreamingResponse: + def __init__(self, arrivals_and_departures_for_location: ArrivalsAndDeparturesForLocationResource) -> None: + self._arrivals_and_departures_for_location = arrivals_and_departures_for_location + + self.list = to_streamed_response_wrapper( + arrivals_and_departures_for_location.list, + ) + + +class AsyncArrivalsAndDeparturesForLocationResourceWithStreamingResponse: + def __init__(self, arrivals_and_departures_for_location: AsyncArrivalsAndDeparturesForLocationResource) -> None: + self._arrivals_and_departures_for_location = arrivals_and_departures_for_location + + self.list = async_to_streamed_response_wrapper( + arrivals_and_departures_for_location.list, + ) diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py index a4bb9969..bfd556db 100644 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -54,3 +54,9 @@ from .report_problem_with_trip_retrieve_params import ( ReportProblemWithTripRetrieveParams as ReportProblemWithTripRetrieveParams, ) +from .arrivals_and_departures_for_location_list_params import ( + ArrivalsAndDeparturesForLocationListParams as ArrivalsAndDeparturesForLocationListParams, +) +from .arrivals_and_departures_for_location_list_response import ( + ArrivalsAndDeparturesForLocationListResponse as ArrivalsAndDeparturesForLocationListResponse, +) diff --git a/src/onebusaway/types/arrivals_and_departures_for_location_list_params.py b/src/onebusaway/types/arrivals_and_departures_for_location_list_params.py new file mode 100644 index 00000000..e1ed0f3b --- /dev/null +++ b/src/onebusaway/types/arrivals_and_departures_for_location_list_params.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["ArrivalsAndDeparturesForLocationListParams"] + + +class ArrivalsAndDeparturesForLocationListParams(TypedDict, total=False): + lat: Required[float] + """The latitude coordinate of the search center.""" + + lon: Required[float] + """The longitude coordinate of the search center.""" + + empty_returns_not_found: Annotated[bool, PropertyInfo(alias="emptyReturnsNotFound")] + """If true, returns a 404 Not Found error instead of an empty result.""" + + lat_span: Annotated[float, PropertyInfo(alias="latSpan")] + """Sets the latitude limits of the search bounding box.""" + + lon_span: Annotated[float, PropertyInfo(alias="lonSpan")] + """Sets the longitude limits of the search bounding box.""" + + max_count: Annotated[int, PropertyInfo(alias="maxCount")] + """The max size of the list of nearby stops and arrivals to return. + + Defaults to 250, max 1000. + """ + + minutes_after: Annotated[int, PropertyInfo(alias="minutesAfter")] + """Include arrivals and departures this many minutes after the query time.""" + + minutes_before: Annotated[int, PropertyInfo(alias="minutesBefore")] + """Include arrivals and departures this many minutes before the query time.""" + + radius: float + """The search radius in meters.""" + + route_type: Annotated[str, PropertyInfo(alias="routeType")] + """Optional list of GTFS routeTypes to filter by (comma delimited) e.g. "1,2,3".""" + + time: int + """By default, returns the status right now. + + Can be queried at a specific time (milliseconds since epoch) for testing. + """ diff --git a/src/onebusaway/types/arrivals_and_departures_for_location_list_response.py b/src/onebusaway/types/arrivals_and_departures_for_location_list_response.py new file mode 100644 index 00000000..a04ff1a3 --- /dev/null +++ b/src/onebusaway/types/arrivals_and_departures_for_location_list_response.py @@ -0,0 +1,306 @@ +# 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__ = [ + "ArrivalsAndDeparturesForLocationListResponse", + "ArrivalsAndDeparturesForLocationListResponseData", + "ArrivalsAndDeparturesForLocationListResponseDataEntry", + "ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDeparture", + "ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatus", + "ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation", + "ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatusPosition", + "ArrivalsAndDeparturesForLocationListResponseDataEntryNearbyStopID", +] + + +class ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation(BaseModel): + """Last known location of the transit vehicle (optional).""" + + lat: Optional[float] = None + """Latitude of the last known location of the transit vehicle.""" + + lon: Optional[float] = None + """Longitude of the last known location of the transit vehicle.""" + + +class ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatusPosition(BaseModel): + """Current position of the transit vehicle.""" + + lat: Optional[float] = None + """Latitude of the current position of the transit vehicle.""" + + lon: Optional[float] = None + """Longitude of the current position of the transit vehicle.""" + + +class ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatus(BaseModel): + """Trip-specific status for the arriving transit vehicle.""" + + active_trip_id: str = FieldInfo(alias="activeTripId") + """Trip ID of the trip the vehicle is actively serving.""" + + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + """Index of the active trip into the sequence of trips for the active block.""" + + closest_stop: str = FieldInfo(alias="closestStop") + """ID of the closest stop to the current location of the transit vehicle.""" + + distance_along_trip: float = FieldInfo(alias="distanceAlongTrip") + """Distance, in meters, the transit vehicle has progressed along the active trip.""" + + last_known_distance_along_trip: float = FieldInfo(alias="lastKnownDistanceAlongTrip") + """ + Last known distance along the trip received in real-time from the transit + vehicle. + """ + + last_location_update_time: int = FieldInfo(alias="lastLocationUpdateTime") + """Timestamp of the last known real-time location update from the transit vehicle.""" + + last_update_time: int = FieldInfo(alias="lastUpdateTime") + """Timestamp of the last known real-time update from the transit vehicle.""" + + occupancy_capacity: int = FieldInfo(alias="occupancyCapacity") + """Capacity of the transit vehicle in terms of occupancy.""" + + occupancy_count: int = FieldInfo(alias="occupancyCount") + """Current count of occupants in the transit vehicle.""" + + occupancy_status: str = FieldInfo(alias="occupancyStatus") + """Current occupancy status of the transit vehicle.""" + + phase: str + """Current journey phase of the trip.""" + + predicted: bool + """Indicates if real-time arrival info is available for this trip.""" + + schedule_deviation: int = FieldInfo(alias="scheduleDeviation") + """Deviation from the schedule in seconds (positive for late, negative for early).""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + status: str + """Current status modifiers for the trip.""" + + total_distance_along_trip: float = FieldInfo(alias="totalDistanceAlongTrip") + """Total length of the trip, in meters.""" + + closest_stop_time_offset: Optional[int] = FieldInfo(alias="closestStopTimeOffset", default=None) + """ + Time offset from the closest stop to the current position of the transit vehicle + (in seconds). + """ + + frequency: Optional[str] = None + """Information about frequency-based scheduling, if applicable to the trip.""" + + last_known_location: Optional[ + ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation + ] = FieldInfo(alias="lastKnownLocation", default=None) + """Last known location of the transit vehicle (optional).""" + + last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None) + """Last known orientation value received in real-time from the transit vehicle.""" + + next_stop: Optional[str] = FieldInfo(alias="nextStop", default=None) + """ID of the next stop the transit vehicle is scheduled to arrive at.""" + + next_stop_time_offset: Optional[int] = FieldInfo(alias="nextStopTimeOffset", default=None) + """ + Time offset from the next stop to the current position of the transit vehicle + (in seconds). + """ + + orientation: Optional[float] = None + """Orientation of the transit vehicle, represented as an angle in degrees.""" + + position: Optional[ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatusPosition] = ( + None + ) + """Current position of the transit vehicle.""" + + scheduled_distance_along_trip: Optional[float] = FieldInfo(alias="scheduledDistanceAlongTrip", default=None) + """ + Distance, in meters, the transit vehicle is scheduled to have progressed along + the active trip. + """ + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + """References to situation elements (if any) applicable to this trip.""" + + vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) + """ID of the transit vehicle currently serving the trip.""" + + +class ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDeparture(BaseModel): + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") + """Indicates if riders can arrive on this transit vehicle.""" + + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") + """Index of this arrival’s trip into the sequence of trips for the active block.""" + + departure_enabled: bool = FieldInfo(alias="departureEnabled") + """Indicates if riders can depart from this transit vehicle.""" + + number_of_stops_away: int = FieldInfo(alias="numberOfStopsAway") + """ + Number of stops between the arriving transit vehicle and the current stop + (excluding the current stop). + """ + + predicted_arrival_time: int = FieldInfo(alias="predictedArrivalTime") + """ + Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time + available). + """ + + predicted_departure_time: int = FieldInfo(alias="predictedDepartureTime") + """ + Predicted departure time, in milliseconds since Unix epoch (zero if no real-time + available). + """ + + route_id: str = FieldInfo(alias="routeId") + """The ID of the route for the arriving vehicle.""" + + scheduled_arrival_time: int = FieldInfo(alias="scheduledArrivalTime") + """Scheduled arrival time, in milliseconds since Unix epoch.""" + + scheduled_departure_time: int = FieldInfo(alias="scheduledDepartureTime") + """Scheduled departure time, in milliseconds since Unix epoch.""" + + service_date: int = FieldInfo(alias="serviceDate") + """ + Time, in milliseconds since the Unix epoch, of midnight for the start of the + service date for the trip. + """ + + stop_id: str = FieldInfo(alias="stopId") + """The ID of the stop the vehicle is arriving at.""" + + stop_sequence: int = FieldInfo(alias="stopSequence") + """ + Index of the stop into the sequence of stops that make up the trip for this + arrival. + """ + + total_stops_in_trip: int = FieldInfo(alias="totalStopsInTrip") + """Total number of stops visited on the trip for this arrival.""" + + trip_headsign: str = FieldInfo(alias="tripHeadsign") + """ + Optional trip headsign that potentially overrides the trip headsign in the + referenced trip element. + """ + + trip_id: str = FieldInfo(alias="tripId") + """The ID of the trip for the arriving vehicle.""" + + vehicle_id: str = FieldInfo(alias="vehicleId") + """ID of the transit vehicle serving this trip.""" + + actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) + """The actual track information of the arriving transit vehicle.""" + + distance_from_stop: Optional[float] = FieldInfo(alias="distanceFromStop", default=None) + """Distance of the arriving transit vehicle from the stop, in meters.""" + + frequency: Optional[str] = None + """Information about frequency-based scheduling, if applicable to the trip.""" + + historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None) + """Historical occupancy information of the transit vehicle.""" + + last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) + """Timestamp of the last update time for this arrival.""" + + occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) + """Current occupancy status of the transit vehicle.""" + + predicted: Optional[bool] = None + """Indicates if real-time arrival info is available for this trip.""" + + predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) + """Interval for predicted arrival time, if available.""" + + predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) + """Interval for predicted departure time, if available.""" + + predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) + """Predicted occupancy status of the transit vehicle.""" + + route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) + """ + Optional route long name that potentially overrides the route long name in the + referenced route element. + """ + + route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) + """ + Optional route short name that potentially overrides the route short name in the + referenced route element. + """ + + scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) + """Interval for scheduled arrival time.""" + + scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) + """Interval for scheduled departure time.""" + + scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) + """Scheduled track information of the arriving transit vehicle.""" + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + """References to situation elements (if any) applicable to this arrival.""" + + status: Optional[str] = None + """Current status of the arrival.""" + + trip_status: Optional[ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDepartureTripStatus] = ( + FieldInfo(alias="tripStatus", default=None) + ) + """Trip-specific status for the arriving transit vehicle.""" + + +class ArrivalsAndDeparturesForLocationListResponseDataEntryNearbyStopID(BaseModel): + distance_from_query: Optional[float] = FieldInfo(alias="distanceFromQuery", default=None) + + stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) + + +class ArrivalsAndDeparturesForLocationListResponseDataEntry(BaseModel): + arrivals_and_departures: List[ArrivalsAndDeparturesForLocationListResponseDataEntryArrivalsAndDeparture] = ( + FieldInfo(alias="arrivalsAndDepartures") + ) + + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + nearby_stop_ids: List[ArrivalsAndDeparturesForLocationListResponseDataEntryNearbyStopID] = FieldInfo( + alias="nearbyStopIds" + ) + + stop_ids: List[str] = FieldInfo(alias="stopIds") + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + + +class ArrivalsAndDeparturesForLocationListResponseData(BaseModel): + entry: ArrivalsAndDeparturesForLocationListResponseDataEntry + + references: References + + +class ArrivalsAndDeparturesForLocationListResponse(ResponseWrapper): + data: ArrivalsAndDeparturesForLocationListResponseData diff --git a/tests/api_resources/test_arrivals_and_departures_for_location.py b/tests/api_resources/test_arrivals_and_departures_for_location.py new file mode 100644 index 00000000..d08dae6c --- /dev/null +++ b/tests/api_resources/test_arrivals_and_departures_for_location.py @@ -0,0 +1,144 @@ +# 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 ( + ArrivalsAndDeparturesForLocationListResponse, +) + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestArrivalsAndDeparturesForLocation: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: OnebusawaySDK) -> None: + arrivals_and_departures_for_location = client.arrivals_and_departures_for_location.list( + lat=0, + lon=0, + ) + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + @parametrize + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + arrivals_and_departures_for_location = client.arrivals_and_departures_for_location.list( + lat=0, + lon=0, + empty_returns_not_found=True, + lat_span=0, + lon_span=0, + max_count=1000, + minutes_after=0, + minutes_before=0, + radius=0, + route_type="routeType", + time=0, + ) + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + @parametrize + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.arrivals_and_departures_for_location.with_raw_response.list( + lat=0, + lon=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + arrivals_and_departures_for_location = response.parse() + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + @parametrize + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.arrivals_and_departures_for_location.with_streaming_response.list( + lat=0, + lon=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + arrivals_and_departures_for_location = response.parse() + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncArrivalsAndDeparturesForLocation: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + arrivals_and_departures_for_location = await async_client.arrivals_and_departures_for_location.list( + lat=0, + lon=0, + ) + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + arrivals_and_departures_for_location = await async_client.arrivals_and_departures_for_location.list( + lat=0, + lon=0, + empty_returns_not_found=True, + lat_span=0, + lon_span=0, + max_count=1000, + minutes_after=0, + minutes_before=0, + radius=0, + route_type="routeType", + time=0, + ) + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.arrivals_and_departures_for_location.with_raw_response.list( + lat=0, + lon=0, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + arrivals_and_departures_for_location = await response.parse() + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.arrivals_and_departures_for_location.with_streaming_response.list( + lat=0, + lon=0, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + arrivals_and_departures_for_location = await response.parse() + assert_matches_type( + ArrivalsAndDeparturesForLocationListResponse, arrivals_and_departures_for_location, path=["response"] + ) + + assert cast(Any, response.is_closed) is True From 7782fff303fa90a90d141f0b78b49e1511446bfe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 29 Mar 2026 18:20:02 +0000 Subject: [PATCH 2/2] release: 1.24.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/onebusaway/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cdcf20eb..bfaab56f 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.23.0" + ".": "1.24.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d43b05ed..0dbdfcc5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.24.0 (2026-03-29) + +Full Changelog: [v1.23.0...v1.24.0](https://github.com/OneBusAway/python-sdk/compare/v1.23.0...v1.24.0) + +### Features + +* **api:** api update ([349fab1](https://github.com/OneBusAway/python-sdk/commit/349fab1505b040ed2e6fc7dd8d44a8f5cbe90385)) + ## 1.23.0 (2026-03-27) Full Changelog: [v1.22.2...v1.23.0](https://github.com/OneBusAway/python-sdk/compare/v1.22.2...v1.23.0) diff --git a/pyproject.toml b/pyproject.toml index 27beb696..ba3113df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "1.23.0" +version = "1.24.0" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py index fb204a99..ae2ec797 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__ = "1.23.0" # x-release-please-version +__version__ = "1.24.0" # x-release-please-version