diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml
index 8ed1bc4..908ad72 100644
--- a/.github/workflows/release-doctor.yml
+++ b/.github/workflows/release-doctor.yml
@@ -1,6 +1,8 @@
name: Release Doctor
on:
pull_request:
+ branches:
+ - main
workflow_dispatch:
jobs:
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index ba6c348..f14b480 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-alpha.1"
+ ".": "0.1.0-alpha.2"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index f78fb11..74bfdc8 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 12
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-d7feb31fedeae9f0af2581bf85d95d374eb2eee635e6823975bc4f419bd8e492.yml
+configured_endpoints: 13
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-6c051801071707e025c582891048beeb3c06d10d13c852f8401a71604b81ac5d.yml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4169ead..056514f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
# Changelog
+## 0.1.0-alpha.2 (2024-07-22)
+
+Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)
+
+### Features
+
+* **api:** OpenAPI spec update via Stainless API ([#4](https://github.com/OneBusAway/python-sdk/issues/4)) ([fc1679d](https://github.com/OneBusAway/python-sdk/commit/fc1679d6086747ac91152587e272d6b2b32a97fd))
+* **api:** OpenAPI spec update via Stainless API ([#6](https://github.com/OneBusAway/python-sdk/issues/6)) ([b6a54cf](https://github.com/OneBusAway/python-sdk/commit/b6a54cfdac1ecfb398e20a4efa90294bde711490))
+* **api:** OpenAPI spec update via Stainless API ([#7](https://github.com/OneBusAway/python-sdk/issues/7)) ([448c0e3](https://github.com/OneBusAway/python-sdk/commit/448c0e3847375dcdb86f9cda1e8206f64910e6e9))
+* **api:** OpenAPI spec update via Stainless API ([#8](https://github.com/OneBusAway/python-sdk/issues/8)) ([361ab73](https://github.com/OneBusAway/python-sdk/commit/361ab733efaef27d9553cabde2844ffb95296979))
+* refactor: Remove print statement from main_sync function ([b72a7a1](https://github.com/OneBusAway/python-sdk/commit/b72a7a16aaf67c5d265cb995181e1abea6d7fed2))
+* refactor: Remove print statement from main_sync function ([dcd9e3b](https://github.com/OneBusAway/python-sdk/commit/dcd9e3b609078c5fcbb9682ae4f92849bc7291cf))
+
## 0.1.0-alpha.1 (2024-07-14)
Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/OneBusAway/python-sdk/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
diff --git a/README.md b/README.md
index 7b8dfb1..22f2108 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ It is generated with [Stainless](https://www.stainlessapi.com/).
## Documentation
-The REST API documentation can be found [on developer.onebusaway.org](https://developer.onebusaway.org). The full API of this library can be found in [api.md](api.md).
+The REST API documentation can be found on [developer.onebusaway.org](https://developer.onebusaway.org). The full API of this library can be found in [api.md](api.md).
## Installation
@@ -277,6 +277,12 @@ client = OnebusawaySDK(
)
```
+You can also customize the client on a per-request basis by using `with_options()`:
+
+```python
+client.with_options(http_client=DefaultHttpxClient(...))
+```
+
### Managing HTTP resources
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
diff --git a/api.md b/api.md
index 5ad83b7..29c129c 100644
--- a/api.md
+++ b/api.md
@@ -136,3 +136,15 @@ from onebusaway.types import TripDetailRetrieveResponse
Methods:
- client.trip_details.retrieve(trip_id, \*\*params) -> TripDetailRetrieveResponse
+
+# TripForVehicle
+
+Types:
+
+```python
+from onebusaway.types import TripForVehicleRetrieveResponse
+```
+
+Methods:
+
+- client.trip_for_vehicle.retrieve(vehicle_id, \*\*params) -> TripForVehicleRetrieveResponse
diff --git a/examples/agency.py b/examples/agency.py
index e0d03e0..f1b7976 100644
--- a/examples/agency.py
+++ b/examples/agency.py
@@ -13,5 +13,4 @@ def main_sync() -> None:
print("Agency data or entry is None.")
if __name__ == "__main__":
- print("Running synchronous main function:")
main_sync()
diff --git a/examples/trip.py b/examples/trip.py
new file mode 100644
index 0000000..44c62a2
--- /dev/null
+++ b/examples/trip.py
@@ -0,0 +1,18 @@
+
+
+import onebusaway
+
+
+def main_sync() -> None:
+ client = onebusaway.OnebusawaySDK(api_key="TEST")
+
+ trip_id = '40_608344966'
+ trip = client.trip.retrieve(trip_id)
+
+ if trip.data and trip.data.entry:
+ print(trip.data.entry)
+ else:
+ print("trip data or entry is None.")
+
+if __name__ == "__main__":
+ main_sync()
diff --git a/pyproject.toml b/pyproject.toml
index 78310a4..96ab13a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "onebusaway"
-version = "0.1.0-alpha.1"
+version = "0.1.0-alpha.2"
description = "The official Python library for the onebusaway-sdk API"
dynamic = ["readme"]
license = "Apache-2.0"
diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py
index a1271cb..d17404e 100644
--- a/src/onebusaway/_base_client.py
+++ b/src/onebusaway/_base_client.py
@@ -879,9 +879,9 @@ def __exit__(
def _prepare_options(
self,
options: FinalRequestOptions, # noqa: ARG002
- ) -> None:
+ ) -> FinalRequestOptions:
"""Hook for mutating the given options"""
- return None
+ return options
def _prepare_request(
self,
@@ -961,7 +961,7 @@ def _request(
input_options = model_copy(options)
cast_to = self._maybe_override_cast_to(cast_to, options)
- self._prepare_options(options)
+ options = self._prepare_options(options)
retries = self._remaining_retries(remaining_retries, options)
request = self._build_request(options)
@@ -1442,9 +1442,9 @@ async def __aexit__(
async def _prepare_options(
self,
options: FinalRequestOptions, # noqa: ARG002
- ) -> None:
+ ) -> FinalRequestOptions:
"""Hook for mutating the given options"""
- return None
+ return options
async def _prepare_request(
self,
@@ -1529,7 +1529,7 @@ async def _request(
input_options = model_copy(options)
cast_to = self._maybe_override_cast_to(cast_to, options)
- await self._prepare_options(options)
+ options = await self._prepare_options(options)
retries = self._remaining_retries(remaining_retries, options)
request = self._build_request(options)
diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py
index 9d23a85..58c2060 100644
--- a/src/onebusaway/_client.py
+++ b/src/onebusaway/_client.py
@@ -57,6 +57,7 @@ class OnebusawaySDK(SyncAPIClient):
trip: resources.TripResource
trips_for_location: resources.TripsForLocationResource
trip_details: resources.TripDetailsResource
+ trip_for_vehicle: resources.TripForVehicleResource
with_raw_response: OnebusawaySDKWithRawResponse
with_streaming_response: OnebusawaySDKWithStreamedResponse
@@ -125,6 +126,7 @@ def __init__(
self.trip = resources.TripResource(self)
self.trips_for_location = resources.TripsForLocationResource(self)
self.trip_details = resources.TripDetailsResource(self)
+ self.trip_for_vehicle = resources.TripForVehicleResource(self)
self.with_raw_response = OnebusawaySDKWithRawResponse(self)
self.with_streaming_response = OnebusawaySDKWithStreamedResponse(self)
@@ -253,6 +255,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient):
trip: resources.AsyncTripResource
trips_for_location: resources.AsyncTripsForLocationResource
trip_details: resources.AsyncTripDetailsResource
+ trip_for_vehicle: resources.AsyncTripForVehicleResource
with_raw_response: AsyncOnebusawaySDKWithRawResponse
with_streaming_response: AsyncOnebusawaySDKWithStreamedResponse
@@ -321,6 +324,7 @@ def __init__(
self.trip = resources.AsyncTripResource(self)
self.trips_for_location = resources.AsyncTripsForLocationResource(self)
self.trip_details = resources.AsyncTripDetailsResource(self)
+ self.trip_for_vehicle = resources.AsyncTripForVehicleResource(self)
self.with_raw_response = AsyncOnebusawaySDKWithRawResponse(self)
self.with_streaming_response = AsyncOnebusawaySDKWithStreamedResponse(self)
@@ -452,6 +456,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.trip = resources.TripResourceWithRawResponse(client.trip)
self.trips_for_location = resources.TripsForLocationResourceWithRawResponse(client.trips_for_location)
self.trip_details = resources.TripDetailsResourceWithRawResponse(client.trip_details)
+ self.trip_for_vehicle = resources.TripForVehicleResourceWithRawResponse(client.trip_for_vehicle)
class AsyncOnebusawaySDKWithRawResponse:
@@ -471,6 +476,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
self.trip = resources.AsyncTripResourceWithRawResponse(client.trip)
self.trips_for_location = resources.AsyncTripsForLocationResourceWithRawResponse(client.trips_for_location)
self.trip_details = resources.AsyncTripDetailsResourceWithRawResponse(client.trip_details)
+ self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithRawResponse(client.trip_for_vehicle)
class OnebusawaySDKWithStreamedResponse:
@@ -490,6 +496,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
self.trip = resources.TripResourceWithStreamingResponse(client.trip)
self.trips_for_location = resources.TripsForLocationResourceWithStreamingResponse(client.trips_for_location)
self.trip_details = resources.TripDetailsResourceWithStreamingResponse(client.trip_details)
+ self.trip_for_vehicle = resources.TripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle)
class AsyncOnebusawaySDKWithStreamedResponse:
@@ -513,6 +520,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
client.trips_for_location
)
self.trip_details = resources.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details)
+ self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle)
Client = OnebusawaySDK
diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py
index 74c7639..c919b5a 100644
--- a/src/onebusaway/_compat.py
+++ b/src/onebusaway/_compat.py
@@ -118,10 +118,10 @@ def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]:
return model.__fields__ # type: ignore
-def model_copy(model: _ModelT) -> _ModelT:
+def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT:
if PYDANTIC_V2:
- return model.model_copy()
- return model.copy() # type: ignore
+ return model.model_copy(deep=deep)
+ return model.copy(deep=deep) # type: ignore
def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py
index 4bb7461..ad08670 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.1" # x-release-please-version
+__version__ = "0.1.0-alpha.2" # x-release-please-version
diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py
index 528774f..65b959b 100644
--- a/src/onebusaway/resources/__init__.py
+++ b/src/onebusaway/resources/__init__.py
@@ -56,6 +56,14 @@
StopsForRouteResourceWithStreamingResponse,
AsyncStopsForRouteResourceWithStreamingResponse,
)
+from .trip_for_vehicle import (
+ TripForVehicleResource,
+ AsyncTripForVehicleResource,
+ TripForVehicleResourceWithRawResponse,
+ AsyncTripForVehicleResourceWithRawResponse,
+ TripForVehicleResourceWithStreamingResponse,
+ AsyncTripForVehicleResourceWithStreamingResponse,
+)
from .stops_for_location import (
StopsForLocationResource,
AsyncStopsForLocationResource,
@@ -156,4 +164,10 @@
"AsyncTripDetailsResourceWithRawResponse",
"TripDetailsResourceWithStreamingResponse",
"AsyncTripDetailsResourceWithStreamingResponse",
+ "TripForVehicleResource",
+ "AsyncTripForVehicleResource",
+ "TripForVehicleResourceWithRawResponse",
+ "AsyncTripForVehicleResourceWithRawResponse",
+ "TripForVehicleResourceWithStreamingResponse",
+ "AsyncTripForVehicleResourceWithStreamingResponse",
]
diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py
new file mode 100644
index 0000000..f0091cd
--- /dev/null
+++ b/src/onebusaway/resources/trip_for_vehicle.py
@@ -0,0 +1,200 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import httpx
+
+from ..types import trip_for_vehicle_retrieve_params
+from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+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.trip_for_vehicle_retrieve_response import TripForVehicleRetrieveResponse
+
+__all__ = ["TripForVehicleResource", "AsyncTripForVehicleResource"]
+
+
+class TripForVehicleResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> TripForVehicleResourceWithRawResponse:
+ return TripForVehicleResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> TripForVehicleResourceWithStreamingResponse:
+ return TripForVehicleResourceWithStreamingResponse(self)
+
+ def retrieve(
+ self,
+ vehicle_id: str,
+ *,
+ include_schedule: bool | NotGiven = NOT_GIVEN,
+ include_status: bool | NotGiven = NOT_GIVEN,
+ include_trip: bool | NotGiven = NOT_GIVEN,
+ time: int | NotGiven = NOT_GIVEN,
+ # 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,
+ ) -> TripForVehicleRetrieveResponse:
+ """
+ Retrieve trip for a specific vehicle
+
+ Args:
+ include_schedule: Determines whether full element is included in the
+ section. Defaults to false.
+
+ include_status: Determines whether the full element is included in the
+ section. Defaults to true.
+
+ include_trip: Determines whether full element is included in the
+ section. Defaults to false.
+
+ time: Time parameter to query the system at a specific time (optional).
+
+ 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 vehicle_id:
+ raise ValueError(f"Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}")
+ return self._get(
+ f"/api/where/trip-for-vehicle/vehicleID.json",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "include_schedule": include_schedule,
+ "include_status": include_status,
+ "include_trip": include_trip,
+ "time": time,
+ },
+ trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams,
+ ),
+ ),
+ cast_to=TripForVehicleRetrieveResponse,
+ )
+
+
+class AsyncTripForVehicleResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncTripForVehicleResourceWithRawResponse:
+ return AsyncTripForVehicleResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncTripForVehicleResourceWithStreamingResponse:
+ return AsyncTripForVehicleResourceWithStreamingResponse(self)
+
+ async def retrieve(
+ self,
+ vehicle_id: str,
+ *,
+ include_schedule: bool | NotGiven = NOT_GIVEN,
+ include_status: bool | NotGiven = NOT_GIVEN,
+ include_trip: bool | NotGiven = NOT_GIVEN,
+ time: int | NotGiven = NOT_GIVEN,
+ # 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,
+ ) -> TripForVehicleRetrieveResponse:
+ """
+ Retrieve trip for a specific vehicle
+
+ Args:
+ include_schedule: Determines whether full element is included in the
+ section. Defaults to false.
+
+ include_status: Determines whether the full element is included in the
+ section. Defaults to true.
+
+ include_trip: Determines whether full element is included in the
+ section. Defaults to false.
+
+ time: Time parameter to query the system at a specific time (optional).
+
+ 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 vehicle_id:
+ raise ValueError(f"Expected a non-empty value for `vehicle_id` but received {vehicle_id!r}")
+ return await self._get(
+ f"/api/where/trip-for-vehicle/vehicleID.json",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "include_schedule": include_schedule,
+ "include_status": include_status,
+ "include_trip": include_trip,
+ "time": time,
+ },
+ trip_for_vehicle_retrieve_params.TripForVehicleRetrieveParams,
+ ),
+ ),
+ cast_to=TripForVehicleRetrieveResponse,
+ )
+
+
+class TripForVehicleResourceWithRawResponse:
+ def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None:
+ self._trip_for_vehicle = trip_for_vehicle
+
+ self.retrieve = to_raw_response_wrapper(
+ trip_for_vehicle.retrieve,
+ )
+
+
+class AsyncTripForVehicleResourceWithRawResponse:
+ def __init__(self, trip_for_vehicle: AsyncTripForVehicleResource) -> None:
+ self._trip_for_vehicle = trip_for_vehicle
+
+ self.retrieve = async_to_raw_response_wrapper(
+ trip_for_vehicle.retrieve,
+ )
+
+
+class TripForVehicleResourceWithStreamingResponse:
+ def __init__(self, trip_for_vehicle: TripForVehicleResource) -> None:
+ self._trip_for_vehicle = trip_for_vehicle
+
+ self.retrieve = to_streamed_response_wrapper(
+ trip_for_vehicle.retrieve,
+ )
+
+
+class AsyncTripForVehicleResourceWithStreamingResponse:
+ def __init__(self, trip_for_vehicle: AsyncTripForVehicleResource) -> None:
+ self._trip_for_vehicle = trip_for_vehicle
+
+ self.retrieve = async_to_streamed_response_wrapper(
+ trip_for_vehicle.retrieve,
+ )
diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py
index 1e53f4a..3ea05d3 100644
--- a/src/onebusaway/types/__init__.py
+++ b/src/onebusaway/types/__init__.py
@@ -12,8 +12,10 @@
from .stops_for_route_list_response import StopsForRouteListResponse as StopsForRouteListResponse
from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse
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 .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
from .arrival_and_departure_list_response import ArrivalAndDepartureListResponse as ArrivalAndDepartureListResponse
from .stops_for_location_retrieve_response import StopsForLocationRetrieveResponse as StopsForLocationRetrieveResponse
diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py
new file mode 100644
index 0000000..3e8240c
--- /dev/null
+++ b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py
@@ -0,0 +1,33 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Annotated, TypedDict
+
+from .._utils import PropertyInfo
+
+__all__ = ["TripForVehicleRetrieveParams"]
+
+
+class TripForVehicleRetrieveParams(TypedDict, total=False):
+ include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")]
+ """
+ Determines whether full element is included in the
+ section. Defaults to false.
+ """
+
+ include_status: Annotated[bool, PropertyInfo(alias="includeStatus")]
+ """
+ Determines whether the full element is included in the
+ section. Defaults to true.
+ """
+
+ include_trip: Annotated[bool, PropertyInfo(alias="includeTrip")]
+ """Determines whether full element is included in the
+ section.
+
+ Defaults to false.
+ """
+
+ time: int
+ """Time parameter to query the system at a specific time (optional)."""
diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py
new file mode 100644
index 0000000..fdebda9
--- /dev/null
+++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py
@@ -0,0 +1,188 @@
+# 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__ = [
+ "TripForVehicleRetrieveResponse",
+ "TripForVehicleRetrieveResponseData",
+ "TripForVehicleRetrieveResponseDataEntry",
+ "TripForVehicleRetrieveResponseDataEntrySchedule",
+ "TripForVehicleRetrieveResponseDataEntryScheduleStopTime",
+ "TripForVehicleRetrieveResponseDataEntryStatus",
+ "TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation",
+ "TripForVehicleRetrieveResponseDataEntryStatusPosition",
+]
+
+
+class TripForVehicleRetrieveResponseDataEntryScheduleStopTime(BaseModel):
+ arrival_time: Optional[int] = FieldInfo(alias="arrivalTime", default=None)
+
+ departure_time: Optional[int] = FieldInfo(alias="departureTime", default=None)
+
+ distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None)
+
+ historical_occupancy: Optional[str] = FieldInfo(alias="historicalOccupancy", default=None)
+
+ stop_headsign: Optional[str] = FieldInfo(alias="stopHeadsign", default=None)
+
+ stop_id: Optional[str] = FieldInfo(alias="stopId", default=None)
+
+
+class TripForVehicleRetrieveResponseDataEntrySchedule(BaseModel):
+ frequency: Optional[str] = None
+
+ next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None)
+
+ previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None)
+
+ stop_times: Optional[List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime]] = FieldInfo(
+ alias="stopTimes", default=None
+ )
+
+ time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None)
+
+
+class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel):
+ 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 TripForVehicleRetrieveResponseDataEntryStatusPosition(BaseModel):
+ 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 TripForVehicleRetrieveResponseDataEntryStatus(BaseModel):
+ active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None)
+ """Trip ID of the trip the vehicle is actively serving."""
+
+ block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None)
+ """Index of the active trip into the sequence of trips for the active block."""
+
+ closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None)
+ """ID of the closest stop to the current location of the transit vehicle."""
+
+ 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).
+ """
+
+ distance_along_trip: Optional[float] = FieldInfo(alias="distanceAlongTrip", default=None)
+ """Distance, in meters, the transit vehicle has progressed along the active trip."""
+
+ frequency: Optional[str] = None
+ """Information about frequency-based scheduling, if applicable to the trip."""
+
+ last_known_distance_along_trip: Optional[float] = FieldInfo(alias="lastKnownDistanceAlongTrip", default=None)
+ """
+ Last known distance along the trip received in real-time from the transit
+ vehicle.
+ """
+
+ last_known_location: Optional[TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo(
+ alias="lastKnownLocation", default=None
+ )
+ """Last known location of the transit vehicle."""
+
+ last_known_orientation: Optional[float] = FieldInfo(alias="lastKnownOrientation", default=None)
+ """Last known orientation value received in real-time from the transit vehicle."""
+
+ last_location_update_time: Optional[int] = FieldInfo(alias="lastLocationUpdateTime", default=None)
+ """Timestamp of the last known real-time location update from the transit vehicle."""
+
+ last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None)
+ """Timestamp of the last known real-time update 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).
+ """
+
+ occupancy_capacity: Optional[int] = FieldInfo(alias="occupancyCapacity", default=None)
+ """Capacity of the transit vehicle in terms of occupancy."""
+
+ occupancy_count: Optional[int] = FieldInfo(alias="occupancyCount", default=None)
+ """Current count of occupants in the transit vehicle."""
+
+ occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None)
+ """Current occupancy status of the transit vehicle."""
+
+ orientation: Optional[float] = None
+ """Orientation of the transit vehicle, represented as an angle in degrees."""
+
+ phase: Optional[str] = None
+ """Current journey phase of the trip."""
+
+ position: Optional[TripForVehicleRetrieveResponseDataEntryStatusPosition] = None
+ """Current position of the transit vehicle."""
+
+ predicted: Optional[bool] = None
+ """Indicates if real-time arrival info is available for this trip."""
+
+ 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.
+ """
+
+ schedule_deviation: Optional[int] = FieldInfo(alias="scheduleDeviation", default=None)
+ """Deviation from the schedule in seconds (positive for late, negative for early)."""
+
+ service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None)
+ """
+ Time, in milliseconds since the Unix epoch, of midnight for the start of the
+ service date for the trip.
+ """
+
+ situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None)
+ """References to situation elements (if any) applicable to this trip."""
+
+ status: Optional[str] = None
+ """Current status modifiers for the trip."""
+
+ total_distance_along_trip: Optional[float] = FieldInfo(alias="totalDistanceAlongTrip", default=None)
+ """Total length of the trip, in meters."""
+
+ vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None)
+ """ID of the transit vehicle currently serving the trip."""
+
+
+class TripForVehicleRetrieveResponseDataEntry(BaseModel):
+ frequency: Optional[str] = None
+
+ schedule: Optional[TripForVehicleRetrieveResponseDataEntrySchedule] = None
+
+ service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None)
+
+ situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None)
+
+ status: Optional[TripForVehicleRetrieveResponseDataEntryStatus] = None
+
+ trip_id: Optional[str] = FieldInfo(alias="tripId", default=None)
+
+
+class TripForVehicleRetrieveResponseData(BaseModel):
+ entry: Optional[TripForVehicleRetrieveResponseDataEntry] = None
+
+ references: Optional[References] = None
+
+
+class TripForVehicleRetrieveResponse(ResponseWrapper):
+ data: Optional[TripForVehicleRetrieveResponseData] = None
diff --git a/tests/api_resources/test_trip_for_vehicle.py b/tests/api_resources/test_trip_for_vehicle.py
new file mode 100644
index 0000000..be96fa6
--- /dev/null
+++ b/tests/api_resources/test_trip_for_vehicle.py
@@ -0,0 +1,120 @@
+# 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 TripForVehicleRetrieveResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestTripForVehicle:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_retrieve(self, client: OnebusawaySDK) -> None:
+ trip_for_vehicle = client.trip_for_vehicle.retrieve(
+ vehicle_id="vehicleID",
+ )
+ assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"])
+
+ @parametrize
+ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None:
+ trip_for_vehicle = client.trip_for_vehicle.retrieve(
+ vehicle_id="vehicleID",
+ include_schedule=True,
+ include_status=True,
+ include_trip=True,
+ time=0,
+ )
+ assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"])
+
+ @parametrize
+ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None:
+ response = client.trip_for_vehicle.with_raw_response.retrieve(
+ vehicle_id="vehicleID",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ trip_for_vehicle = response.parse()
+ assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"])
+
+ @parametrize
+ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None:
+ with client.trip_for_vehicle.with_streaming_response.retrieve(
+ vehicle_id="vehicleID",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ trip_for_vehicle = response.parse()
+ assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_retrieve(self, client: OnebusawaySDK) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `vehicle_id` but received ''"):
+ client.trip_for_vehicle.with_raw_response.retrieve(
+ vehicle_id="",
+ )
+
+
+class TestAsyncTripForVehicle:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None:
+ trip_for_vehicle = await async_client.trip_for_vehicle.retrieve(
+ vehicle_id="vehicleID",
+ )
+ assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"])
+
+ @parametrize
+ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None:
+ trip_for_vehicle = await async_client.trip_for_vehicle.retrieve(
+ vehicle_id="vehicleID",
+ include_schedule=True,
+ include_status=True,
+ include_trip=True,
+ time=0,
+ )
+ assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"])
+
+ @parametrize
+ async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None:
+ response = await async_client.trip_for_vehicle.with_raw_response.retrieve(
+ vehicle_id="vehicleID",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ trip_for_vehicle = await response.parse()
+ assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None:
+ async with async_client.trip_for_vehicle.with_streaming_response.retrieve(
+ vehicle_id="vehicleID",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ trip_for_vehicle = await response.parse()
+ assert_matches_type(TripForVehicleRetrieveResponse, trip_for_vehicle, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_retrieve(self, async_client: AsyncOnebusawaySDK) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `vehicle_id` but received ''"):
+ await async_client.trip_for_vehicle.with_raw_response.retrieve(
+ vehicle_id="",
+ )