diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile old mode 100644 new mode 100755 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json old mode 100644 new mode 100755 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.python-version b/.python-version old mode 100644 new mode 100755 diff --git a/.release-please-manifest.json b/.release-please-manifest.json old mode 100644 new mode 100755 index e2f2c07..3cf71e6 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.17" + ".": "0.1.0-alpha.18" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml old mode 100644 new mode 100755 index c040587..e8d181d --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 27 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-e4779565160778ba4193bbe8b27556a49f0f8c31ef15ac72c9ee1eb791f92d33.yml +configured_endpoints: 28 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-b2ed1f0adc6090a8bea561c2a33d10e568a72db450c59858ea8e41cf3127c398.yml diff --git a/Brewfile b/Brewfile old mode 100644 new mode 100755 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e5ed6e..7f403d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,38 @@ # Changelog +## 0.1.0-alpha.18 (2024-08-20) + +Full Changelog: [v0.1.0-alpha.17...v0.1.0-alpha.18](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.17...v0.1.0-alpha.18) + +### Features + +- **api:** OpenAPI spec update via Stainless API ([#81](https://github.com/OneBusAway/python-sdk/issues/81)) ([71f8ac8](https://github.com/OneBusAway/python-sdk/commit/71f8ac8808bc984dc772435e3dd25fb851a27156)) +- **api:** OpenAPI spec update via Stainless API ([#85](https://github.com/OneBusAway/python-sdk/issues/85)) ([87a9f3f](https://github.com/OneBusAway/python-sdk/commit/87a9f3fe8cecfc7c527ab99cd98fcd93d5a62084)) +- **api:** OpenAPI spec update via Stainless API ([#86](https://github.com/OneBusAway/python-sdk/issues/86)) ([d63524a](https://github.com/OneBusAway/python-sdk/commit/d63524a8e1e7a3ab863e964f2f81069fdd4e5761)) +- **api:** OpenAPI spec update via Stainless API ([#87](https://github.com/OneBusAway/python-sdk/issues/87)) ([d4f2ca0](https://github.com/OneBusAway/python-sdk/commit/d4f2ca03ce7778c127e70a6f7db86e0fb667e157)) +- **api:** OpenAPI spec update via Stainless API ([#88](https://github.com/OneBusAway/python-sdk/issues/88)) ([3543b38](https://github.com/OneBusAway/python-sdk/commit/3543b38cf9e4b8a4762c41f494c8f54a6451d091)) +- **api:** OpenAPI spec update via Stainless API ([#89](https://github.com/OneBusAway/python-sdk/issues/89)) ([b56865a](https://github.com/OneBusAway/python-sdk/commit/b56865a9f16ef4117ac278dec6174a3507b4b1dc)) +- **api:** OpenAPI spec update via Stainless API ([#93](https://github.com/OneBusAway/python-sdk/issues/93)) ([be44ac5](https://github.com/OneBusAway/python-sdk/commit/be44ac517f04b963fc27b68d07f94b7da9fb7380)) +- **api:** OpenAPI spec update via Stainless API ([#94](https://github.com/OneBusAway/python-sdk/issues/94)) ([2ebd77c](https://github.com/OneBusAway/python-sdk/commit/2ebd77c7d359fd48b7ed8104223db7abc0157de1)) +- **api:** OpenAPI spec update via Stainless API ([#95](https://github.com/OneBusAway/python-sdk/issues/95)) ([54d58cf](https://github.com/OneBusAway/python-sdk/commit/54d58cf81718aee18e852dda9ad260dfa9392404)) +- **api:** OpenAPI spec update via Stainless API ([#96](https://github.com/OneBusAway/python-sdk/issues/96)) ([7cc92e8](https://github.com/OneBusAway/python-sdk/commit/7cc92e8d051f011599844cd9d3851521a94cc49b)) +- **api:** OpenAPI spec update via Stainless API ([#97](https://github.com/OneBusAway/python-sdk/issues/97)) ([c3ca610](https://github.com/OneBusAway/python-sdk/commit/c3ca610df71affbe1381fcfa5a85f22614098beb)) + +### Chores + +- **ci:** also run pydantic v1 tests ([#92](https://github.com/OneBusAway/python-sdk/issues/92)) ([19a0334](https://github.com/OneBusAway/python-sdk/commit/19a03345944154c4db06c96304e2e9b5bb2cbc57)) +- **client:** fix parsing union responses when non-json is returned ([#91](https://github.com/OneBusAway/python-sdk/issues/91)) ([38860c1](https://github.com/OneBusAway/python-sdk/commit/38860c19de2e79ab7ca5054c2ec9357a1fd3690b)) +- **internal:** codegen related update ([#83](https://github.com/OneBusAway/python-sdk/issues/83)) ([bb39847](https://github.com/OneBusAway/python-sdk/commit/bb398472831ec5623b587568acfd99ecd44be886)) +- **internal:** use different 32bit detection method ([#84](https://github.com/OneBusAway/python-sdk/issues/84)) ([8dbeb49](https://github.com/OneBusAway/python-sdk/commit/8dbeb49a6f799aaef5214d77cfa46ae0d45fd635)) + ## 0.1.0-alpha.17 (2024-08-12) Full Changelog: [v0.1.0-alpha.16...v0.1.0-alpha.17](https://github.com/OneBusAway/python-sdk/compare/v0.1.0-alpha.16...v0.1.0-alpha.17) ### Features -* **api:** OpenAPI spec update via Stainless API ([#77](https://github.com/OneBusAway/python-sdk/issues/77)) ([70ce97c](https://github.com/OneBusAway/python-sdk/commit/70ce97c2c90dcfa6635fd36f83a7fb71a321ca69)) -* **api:** update via SDK Studio ([#79](https://github.com/OneBusAway/python-sdk/issues/79)) ([b31341a](https://github.com/OneBusAway/python-sdk/commit/b31341a157b8b9aa554ad161afcbc581a041c3fb)) +- **api:** OpenAPI spec update via Stainless API ([#77](https://github.com/OneBusAway/python-sdk/issues/77)) ([70ce97c](https://github.com/OneBusAway/python-sdk/commit/70ce97c2c90dcfa6635fd36f83a7fb71a321ca69)) +- **api:** update via SDK Studio ([#79](https://github.com/OneBusAway/python-sdk/issues/79)) ([b31341a](https://github.com/OneBusAway/python-sdk/commit/b31341a157b8b9aa554ad161afcbc581a041c3fb)) ## 0.1.0-alpha.16 (2024-08-10) @@ -15,14 +40,13 @@ Full Changelog: [v0.1.0-alpha.15...v0.1.0-alpha.16](https://github.com/OneBusAwa ### Features -* **api:** OpenAPI spec update via Stainless API ([#71](https://github.com/OneBusAway/python-sdk/issues/71)) ([876b77c](https://github.com/OneBusAway/python-sdk/commit/876b77c3addf2460c3116738f7b4bc784f67350d)) -* **api:** OpenAPI spec update via Stainless API ([#75](https://github.com/OneBusAway/python-sdk/issues/75)) ([6af5d8a](https://github.com/OneBusAway/python-sdk/commit/6af5d8a93d7f516c9bb7a20e20d063944d0435e9)) - +- **api:** OpenAPI spec update via Stainless API ([#71](https://github.com/OneBusAway/python-sdk/issues/71)) ([876b77c](https://github.com/OneBusAway/python-sdk/commit/876b77c3addf2460c3116738f7b4bc784f67350d)) +- **api:** OpenAPI spec update via Stainless API ([#75](https://github.com/OneBusAway/python-sdk/issues/75)) ([6af5d8a](https://github.com/OneBusAway/python-sdk/commit/6af5d8a93d7f516c9bb7a20e20d063944d0435e9)) ### Chores -* **ci:** bump prism mock server version ([#73](https://github.com/OneBusAway/python-sdk/issues/73)) ([e303bb6](https://github.com/OneBusAway/python-sdk/commit/e303bb64a39d45801d72141e13e00bac40771f71)) -* **internal:** ensure package is importable in lint cmd ([#74](https://github.com/OneBusAway/python-sdk/issues/74)) ([b4db5b9](https://github.com/OneBusAway/python-sdk/commit/b4db5b955b4880c1eea3bba00749bb9f4a78416b)) +- **ci:** bump prism mock server version ([#73](https://github.com/OneBusAway/python-sdk/issues/73)) ([e303bb6](https://github.com/OneBusAway/python-sdk/commit/e303bb64a39d45801d72141e13e00bac40771f71)) +- **internal:** ensure package is importable in lint cmd ([#74](https://github.com/OneBusAway/python-sdk/issues/74)) ([b4db5b9](https://github.com/OneBusAway/python-sdk/commit/b4db5b955b4880c1eea3bba00749bb9f4a78416b)) ## 0.1.0-alpha.15 (2024-08-08) @@ -30,7 +54,7 @@ Full Changelog: [v0.1.0-alpha.14...v0.1.0-alpha.15](https://github.com/OneBusAwa ### Features -* **api:** OpenAPI spec update via Stainless API ([#68](https://github.com/OneBusAway/python-sdk/issues/68)) ([6367613](https://github.com/OneBusAway/python-sdk/commit/63676136b6d0b0f01738cfc778763b6a79775d09)) +- **api:** OpenAPI spec update via Stainless API ([#68](https://github.com/OneBusAway/python-sdk/issues/68)) ([6367613](https://github.com/OneBusAway/python-sdk/commit/63676136b6d0b0f01738cfc778763b6a79775d09)) ## 0.1.0-alpha.14 (2024-08-08) @@ -38,7 +62,7 @@ Full Changelog: [v0.1.0-alpha.13...v0.1.0-alpha.14](https://github.com/OneBusAwa ### Features -* **api:** OpenAPI spec update via Stainless API ([#65](https://github.com/OneBusAway/python-sdk/issues/65)) ([d93e82a](https://github.com/OneBusAway/python-sdk/commit/d93e82a4b6410768f1d5f9cd08ee83157eb405ce)) +- **api:** OpenAPI spec update via Stainless API ([#65](https://github.com/OneBusAway/python-sdk/issues/65)) ([d93e82a](https://github.com/OneBusAway/python-sdk/commit/d93e82a4b6410768f1d5f9cd08ee83157eb405ce)) ## 0.1.0-alpha.13 (2024-08-08) @@ -46,7 +70,7 @@ Full Changelog: [v0.1.0-alpha.12...v0.1.0-alpha.13](https://github.com/OneBusAwa ### Chores -* **internal:** version bump ([#61](https://github.com/OneBusAway/python-sdk/issues/61)) ([5d7fe06](https://github.com/OneBusAway/python-sdk/commit/5d7fe060b6158f719e388feba0bc9f7dcb0fe288)) +- **internal:** version bump ([#61](https://github.com/OneBusAway/python-sdk/issues/61)) ([5d7fe06](https://github.com/OneBusAway/python-sdk/commit/5d7fe060b6158f719e388feba0bc9f7dcb0fe288)) ## 0.1.0-alpha.12 (2024-08-08) @@ -54,21 +78,20 @@ Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/OneBusAwa ### Features -* **api:** OpenAPI spec update via Stainless API ([#48](https://github.com/OneBusAway/python-sdk/issues/48)) ([a5c305c](https://github.com/OneBusAway/python-sdk/commit/a5c305c7a5614588dd3fb14607dd2489aab8b3c6)) -* **api:** OpenAPI spec update via Stainless API ([#55](https://github.com/OneBusAway/python-sdk/issues/55)) ([9adae4d](https://github.com/OneBusAway/python-sdk/commit/9adae4de96b8ea11ff8e2d7c251183580f86cf8a)) -* **api:** OpenAPI spec update via Stainless API ([#56](https://github.com/OneBusAway/python-sdk/issues/56)) ([1882cdc](https://github.com/OneBusAway/python-sdk/commit/1882cdc8a4da9705c853ed6f5d5e8d73a4b9276c)) -* **api:** OpenAPI spec update via Stainless API ([#57](https://github.com/OneBusAway/python-sdk/issues/57)) ([5c8a7ee](https://github.com/OneBusAway/python-sdk/commit/5c8a7ee00dcd4ab6a3a9b6800fe10f7447d79c61)) -* **api:** OpenAPI spec update via Stainless API ([#58](https://github.com/OneBusAway/python-sdk/issues/58)) ([29edb45](https://github.com/OneBusAway/python-sdk/commit/29edb45798ad111a1a4f6ce5bbbbadfe3e9099d8)) -* **client:** add `retry_count` to raw response class ([#51](https://github.com/OneBusAway/python-sdk/issues/51)) ([97156e5](https://github.com/OneBusAway/python-sdk/commit/97156e5dff5d743d04ecc0dbe73ec7c690dfb4fe)) - +- **api:** OpenAPI spec update via Stainless API ([#48](https://github.com/OneBusAway/python-sdk/issues/48)) ([a5c305c](https://github.com/OneBusAway/python-sdk/commit/a5c305c7a5614588dd3fb14607dd2489aab8b3c6)) +- **api:** OpenAPI spec update via Stainless API ([#55](https://github.com/OneBusAway/python-sdk/issues/55)) ([9adae4d](https://github.com/OneBusAway/python-sdk/commit/9adae4de96b8ea11ff8e2d7c251183580f86cf8a)) +- **api:** OpenAPI spec update via Stainless API ([#56](https://github.com/OneBusAway/python-sdk/issues/56)) ([1882cdc](https://github.com/OneBusAway/python-sdk/commit/1882cdc8a4da9705c853ed6f5d5e8d73a4b9276c)) +- **api:** OpenAPI spec update via Stainless API ([#57](https://github.com/OneBusAway/python-sdk/issues/57)) ([5c8a7ee](https://github.com/OneBusAway/python-sdk/commit/5c8a7ee00dcd4ab6a3a9b6800fe10f7447d79c61)) +- **api:** OpenAPI spec update via Stainless API ([#58](https://github.com/OneBusAway/python-sdk/issues/58)) ([29edb45](https://github.com/OneBusAway/python-sdk/commit/29edb45798ad111a1a4f6ce5bbbbadfe3e9099d8)) +- **client:** add `retry_count` to raw response class ([#51](https://github.com/OneBusAway/python-sdk/issues/51)) ([97156e5](https://github.com/OneBusAway/python-sdk/commit/97156e5dff5d743d04ecc0dbe73ec7c690dfb4fe)) ### Chores -* **internal:** bump pyright ([#50](https://github.com/OneBusAway/python-sdk/issues/50)) ([6d1fdf7](https://github.com/OneBusAway/python-sdk/commit/6d1fdf78cf6d63079bf037b88ac0540e619f9ae7)) -* **internal:** bump ruff version ([#53](https://github.com/OneBusAway/python-sdk/issues/53)) ([c8cbc6a](https://github.com/OneBusAway/python-sdk/commit/c8cbc6a1e48e42b15e42ebf40cdfd2f8fc0bc7ab)) -* **internal:** remove deprecated ruff config ([#59](https://github.com/OneBusAway/python-sdk/issues/59)) ([a6413af](https://github.com/OneBusAway/python-sdk/commit/a6413af808c1ea04d05a46fa0a5d54ec888999bf)) -* **internal:** test updates ([#52](https://github.com/OneBusAway/python-sdk/issues/52)) ([f3b7cb0](https://github.com/OneBusAway/python-sdk/commit/f3b7cb00c4302b0ac1b8497835f2db0d3f9e7949)) -* **internal:** update pydantic compat helper function ([#54](https://github.com/OneBusAway/python-sdk/issues/54)) ([1f501f0](https://github.com/OneBusAway/python-sdk/commit/1f501f0592c92e86c4c027f652a49ff11a068715)) +- **internal:** bump pyright ([#50](https://github.com/OneBusAway/python-sdk/issues/50)) ([6d1fdf7](https://github.com/OneBusAway/python-sdk/commit/6d1fdf78cf6d63079bf037b88ac0540e619f9ae7)) +- **internal:** bump ruff version ([#53](https://github.com/OneBusAway/python-sdk/issues/53)) ([c8cbc6a](https://github.com/OneBusAway/python-sdk/commit/c8cbc6a1e48e42b15e42ebf40cdfd2f8fc0bc7ab)) +- **internal:** remove deprecated ruff config ([#59](https://github.com/OneBusAway/python-sdk/issues/59)) ([a6413af](https://github.com/OneBusAway/python-sdk/commit/a6413af808c1ea04d05a46fa0a5d54ec888999bf)) +- **internal:** test updates ([#52](https://github.com/OneBusAway/python-sdk/issues/52)) ([f3b7cb0](https://github.com/OneBusAway/python-sdk/commit/f3b7cb00c4302b0ac1b8497835f2db0d3f9e7949)) +- **internal:** update pydantic compat helper function ([#54](https://github.com/OneBusAway/python-sdk/issues/54)) ([1f501f0](https://github.com/OneBusAway/python-sdk/commit/1f501f0592c92e86c4c027f652a49ff11a068715)) ## 0.1.0-alpha.11 (2024-08-01) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/SECURITY.md b/SECURITY.md old mode 100644 new mode 100755 diff --git a/api.md b/api.md old mode 100644 new mode 100755 index a0341c8..408a5c9 --- a/api.md +++ b/api.md @@ -9,12 +9,12 @@ from onebusaway.types import References, ResponseWrapper Types: ```python -from onebusaway.types import AgenciesWithCoverageRetrieveResponse +from onebusaway.types import AgenciesWithCoverageListResponse ``` Methods: -- client.agencies_with_coverage.retrieve() -> AgenciesWithCoverageRetrieveResponse +- client.agencies_with_coverage.list() -> AgenciesWithCoverageListResponse # Agency @@ -69,12 +69,12 @@ Methods: Types: ```python -from onebusaway.types import StopsForLocationRetrieveResponse +from onebusaway.types import StopsForLocationListResponse ``` Methods: -- client.stops_for_location.retrieve(\*\*params) -> StopsForLocationRetrieveResponse +- client.stops_for_location.list(\*\*params) -> StopsForLocationListResponse # StopsForRoute @@ -153,12 +153,12 @@ Methods: Types: ```python -from onebusaway.types import RoutesForLocationRetrieveResponse +from onebusaway.types import RoutesForLocationListResponse ``` Methods: -- client.routes_for_location.retrieve(\*\*params) -> RoutesForLocationRetrieveResponse +- client.routes_for_location.list(\*\*params) -> RoutesForLocationListResponse # RoutesForAgency @@ -214,12 +214,12 @@ Methods: Types: ```python -from onebusaway.types import TripsForLocationRetrieveResponse +from onebusaway.types import TripsForLocationListResponse ``` Methods: -- client.trips_for_location.retrieve(\*\*params) -> TripsForLocationRetrieveResponse +- client.trips_for_location.list(\*\*params) -> TripsForLocationListResponse # TripDetails @@ -245,6 +245,18 @@ Methods: - client.trip_for_vehicle.retrieve(vehicle_id, \*\*params) -> TripForVehicleRetrieveResponse +# TripsForRoute + +Types: + +```python +from onebusaway.types import TripsForRouteListResponse +``` + +Methods: + +- client.trips_for_route.list(route_id, \*\*params) -> TripsForRouteListResponse + # ReportProblemWithStop Methods: diff --git a/bin/check-release-environment b/bin/check-release-environment old mode 100644 new mode 100755 diff --git a/bin/publish-pypi b/bin/publish-pypi old mode 100644 new mode 100755 diff --git a/examples/.keep b/examples/.keep old mode 100644 new mode 100755 diff --git a/examples/agencies_with_coverage.py b/examples/agencies_with_coverage.py index 0e239ed..87a5fb3 100644 --- a/examples/agencies_with_coverage.py +++ b/examples/agencies_with_coverage.py @@ -17,5 +17,5 @@ # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -response = oba.agencies_with_coverage.retrieve() +response = oba.agencies_with_coverage.list() pprint(response.data) diff --git a/examples/block.py b/examples/block.py index 3388a5e..1d819bd 100644 --- a/examples/block.py +++ b/examples/block.py @@ -15,7 +15,7 @@ # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -block_id = '1_7310845' +block_id = "1_7310845" response = oba.block.retrieve(block_id) if response and response.data: print(response.data.entry) diff --git a/examples/shape.py b/examples/shape.py index df3ee0a..6a12f22 100644 --- a/examples/shape.py +++ b/examples/shape.py @@ -15,7 +15,7 @@ # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -shape_id = '1_10002005' +shape_id = "1_10002005" response = oba.shape.retrieve(shape_id) if response and response.data: print(response.data.entry) diff --git a/examples/stops_for_location.py b/examples/stops_for_location.py index ea9b153..118d8f7 100644 --- a/examples/stops_for_location.py +++ b/examples/stops_for_location.py @@ -17,7 +17,7 @@ # Create a new instance of the OneBusAway SDK with the settings we loaded. oba = OnebusawaySDK(**settings) -space_needle_stops = oba.stops_for_location.retrieve( +space_needle_stops = oba.stops_for_location.list( lat=47.6205, lon=-122.3493, ) diff --git a/mypy.ini b/mypy.ini old mode 100644 new mode 100755 diff --git a/noxfile.py b/noxfile.py old mode 100644 new mode 100755 diff --git a/pyproject.toml b/pyproject.toml old mode 100644 new mode 100755 index 12eaef3..6482a9b --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "onebusaway" -version = "0.1.0-alpha.17" +version = "0.1.0-alpha.18" description = "The official Python library for the onebusaway-sdk API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/release-please-config.json b/release-please-config.json old mode 100644 new mode 100755 diff --git a/requirements-dev.lock b/requirements-dev.lock old mode 100644 new mode 100755 diff --git a/requirements.lock b/requirements.lock old mode 100644 new mode 100755 diff --git a/scripts/test b/scripts/test index b3ace90..4fa5698 100755 --- a/scripts/test +++ b/scripts/test @@ -54,3 +54,6 @@ fi echo "==> Running tests" rye run pytest "$@" + +echo "==> Running Pydantic v1 tests" +rye run nox -s test-pydantic-v1 -- "$@" diff --git a/scripts/utils/ruffen-docs.py b/scripts/utils/ruffen-docs.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/__init__.py b/src/onebusaway/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_base_client.py b/src/onebusaway/_base_client.py old mode 100644 new mode 100755 index 28c4797..30f5672 --- a/src/onebusaway/_base_client.py +++ b/src/onebusaway/_base_client.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys import json import time import uuid @@ -1982,7 +1983,6 @@ def get_python_version() -> str: def get_architecture() -> Arch: try: - python_bitness, _ = platform.architecture() machine = platform.machine().lower() except Exception: return "unknown" @@ -1998,7 +1998,7 @@ def get_architecture() -> Arch: return "x64" # TODO: untested - if python_bitness == "32bit": + if sys.maxsize <= 2**32: return "x32" if machine: diff --git a/src/onebusaway/_client.py b/src/onebusaway/_client.py old mode 100644 new mode 100755 index e981b14..9907b34 --- a/src/onebusaway/_client.py +++ b/src/onebusaway/_client.py @@ -66,6 +66,7 @@ class OnebusawaySDK(SyncAPIClient): trips_for_location: resources.TripsForLocationResource trip_details: resources.TripDetailsResource trip_for_vehicle: resources.TripForVehicleResource + trips_for_route: resources.TripsForRouteResource report_problem_with_stop: resources.ReportProblemWithStopResource report_problem_with_trip: resources.ReportProblemWithTripResource search_for_stop: resources.SearchForStopResource @@ -149,6 +150,7 @@ def __init__( self.trips_for_location = resources.TripsForLocationResource(self) self.trip_details = resources.TripDetailsResource(self) self.trip_for_vehicle = resources.TripForVehicleResource(self) + self.trips_for_route = resources.TripsForRouteResource(self) self.report_problem_with_stop = resources.ReportProblemWithStopResource(self) self.report_problem_with_trip = resources.ReportProblemWithTripResource(self) self.search_for_stop = resources.SearchForStopResource(self) @@ -292,6 +294,7 @@ class AsyncOnebusawaySDK(AsyncAPIClient): trips_for_location: resources.AsyncTripsForLocationResource trip_details: resources.AsyncTripDetailsResource trip_for_vehicle: resources.AsyncTripForVehicleResource + trips_for_route: resources.AsyncTripsForRouteResource report_problem_with_stop: resources.AsyncReportProblemWithStopResource report_problem_with_trip: resources.AsyncReportProblemWithTripResource search_for_stop: resources.AsyncSearchForStopResource @@ -375,6 +378,7 @@ def __init__( self.trips_for_location = resources.AsyncTripsForLocationResource(self) self.trip_details = resources.AsyncTripDetailsResource(self) self.trip_for_vehicle = resources.AsyncTripForVehicleResource(self) + self.trips_for_route = resources.AsyncTripsForRouteResource(self) self.report_problem_with_stop = resources.AsyncReportProblemWithStopResource(self) self.report_problem_with_trip = resources.AsyncReportProblemWithTripResource(self) self.search_for_stop = resources.AsyncSearchForStopResource(self) @@ -521,6 +525,7 @@ def __init__(self, client: OnebusawaySDK) -> None: 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) + self.trips_for_route = resources.TripsForRouteResourceWithRawResponse(client.trips_for_route) self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithRawResponse( client.report_problem_with_stop ) @@ -559,6 +564,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: 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) + self.trips_for_route = resources.AsyncTripsForRouteResourceWithRawResponse(client.trips_for_route) self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithRawResponse( client.report_problem_with_stop ) @@ -599,6 +605,7 @@ def __init__(self, client: OnebusawaySDK) -> None: 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) + self.trips_for_route = resources.TripsForRouteResourceWithStreamingResponse(client.trips_for_route) self.report_problem_with_stop = resources.ReportProblemWithStopResourceWithStreamingResponse( client.report_problem_with_stop ) @@ -651,6 +658,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None: ) self.trip_details = resources.AsyncTripDetailsResourceWithStreamingResponse(client.trip_details) self.trip_for_vehicle = resources.AsyncTripForVehicleResourceWithStreamingResponse(client.trip_for_vehicle) + self.trips_for_route = resources.AsyncTripsForRouteResourceWithStreamingResponse(client.trips_for_route) self.report_problem_with_stop = resources.AsyncReportProblemWithStopResourceWithStreamingResponse( client.report_problem_with_stop ) diff --git a/src/onebusaway/_compat.py b/src/onebusaway/_compat.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_constants.py b/src/onebusaway/_constants.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_exceptions.py b/src/onebusaway/_exceptions.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_files.py b/src/onebusaway/_files.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_models.py b/src/onebusaway/_models.py old mode 100644 new mode 100755 index 5148d5a..d386eaa --- a/src/onebusaway/_models.py +++ b/src/onebusaway/_models.py @@ -380,6 +380,8 @@ def is_basemodel(type_: type) -> bool: def is_basemodel_type(type_: type) -> TypeGuard[type[BaseModel] | type[GenericModel]]: origin = get_origin(type_) or type_ + if not inspect.isclass(origin): + return False return issubclass(origin, BaseModel) or issubclass(origin, GenericModel) diff --git a/src/onebusaway/_qs.py b/src/onebusaway/_qs.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_resource.py b/src/onebusaway/_resource.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_response.py b/src/onebusaway/_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_streaming.py b/src/onebusaway/_streaming.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_types.py b/src/onebusaway/_types.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/__init__.py b/src/onebusaway/_utils/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_logs.py b/src/onebusaway/_utils/_logs.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_proxy.py b/src/onebusaway/_utils/_proxy.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_reflection.py b/src/onebusaway/_utils/_reflection.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_streams.py b/src/onebusaway/_utils/_streams.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_sync.py b/src/onebusaway/_utils/_sync.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_transform.py b/src/onebusaway/_utils/_transform.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_typing.py b/src/onebusaway/_utils/_typing.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_utils/_utils.py b/src/onebusaway/_utils/_utils.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/_version.py b/src/onebusaway/_version.py old mode 100644 new mode 100755 index f3b8c3d..64d65a3 --- 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.17" # x-release-please-version +__version__ = "0.1.0-alpha.18" # x-release-please-version diff --git a/src/onebusaway/lib/.keep b/src/onebusaway/lib/.keep old mode 100644 new mode 100755 diff --git a/src/onebusaway/py.typed b/src/onebusaway/py.typed old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/__init__.py b/src/onebusaway/resources/__init__.py old mode 100644 new mode 100755 index ddb6e30..d72f3d6 --- a/src/onebusaway/resources/__init__.py +++ b/src/onebusaway/resources/__init__.py @@ -88,6 +88,14 @@ StopsForRouteResourceWithStreamingResponse, AsyncStopsForRouteResourceWithStreamingResponse, ) +from .trips_for_route import ( + TripsForRouteResource, + AsyncTripsForRouteResource, + TripsForRouteResourceWithRawResponse, + AsyncTripsForRouteResourceWithRawResponse, + TripsForRouteResourceWithStreamingResponse, + AsyncTripsForRouteResourceWithStreamingResponse, +) from .search_for_route import ( SearchForRouteResource, AsyncSearchForRouteResource, @@ -330,6 +338,12 @@ "AsyncTripForVehicleResourceWithRawResponse", "TripForVehicleResourceWithStreamingResponse", "AsyncTripForVehicleResourceWithStreamingResponse", + "TripsForRouteResource", + "AsyncTripsForRouteResource", + "TripsForRouteResourceWithRawResponse", + "AsyncTripsForRouteResourceWithRawResponse", + "TripsForRouteResourceWithStreamingResponse", + "AsyncTripsForRouteResourceWithStreamingResponse", "ReportProblemWithStopResource", "AsyncReportProblemWithStopResource", "ReportProblemWithStopResourceWithRawResponse", diff --git a/src/onebusaway/resources/agencies_with_coverage.py b/src/onebusaway/resources/agencies_with_coverage.py old mode 100644 new mode 100755 index 60fa85e..edab37b --- a/src/onebusaway/resources/agencies_with_coverage.py +++ b/src/onebusaway/resources/agencies_with_coverage.py @@ -14,7 +14,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.agencies_with_coverage_retrieve_response import AgenciesWithCoverageRetrieveResponse +from ..types.agencies_with_coverage_list_response import AgenciesWithCoverageListResponse __all__ = ["AgenciesWithCoverageResource", "AsyncAgenciesWithCoverageResource"] @@ -28,7 +28,7 @@ def with_raw_response(self) -> AgenciesWithCoverageResourceWithRawResponse: def with_streaming_response(self) -> AgenciesWithCoverageResourceWithStreamingResponse: return AgenciesWithCoverageResourceWithStreamingResponse(self) - def retrieve( + def list( self, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -37,14 +37,17 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgenciesWithCoverageRetrieveResponse: - """Retrieve Agencies with Coverage""" + ) -> AgenciesWithCoverageListResponse: + """ + Returns a list of all transit agencies currently supported by OneBusAway along + with the center of their coverage area. + """ return self._get( "/api/where/agencies-with-coverage.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AgenciesWithCoverageRetrieveResponse, + cast_to=AgenciesWithCoverageListResponse, ) @@ -57,7 +60,7 @@ def with_raw_response(self) -> AsyncAgenciesWithCoverageResourceWithRawResponse: def with_streaming_response(self) -> AsyncAgenciesWithCoverageResourceWithStreamingResponse: return AsyncAgenciesWithCoverageResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -66,14 +69,17 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgenciesWithCoverageRetrieveResponse: - """Retrieve Agencies with Coverage""" + ) -> AgenciesWithCoverageListResponse: + """ + Returns a list of all transit agencies currently supported by OneBusAway along + with the center of their coverage area. + """ return await self._get( "/api/where/agencies-with-coverage.json", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AgenciesWithCoverageRetrieveResponse, + cast_to=AgenciesWithCoverageListResponse, ) @@ -81,8 +87,8 @@ class AgenciesWithCoverageResourceWithRawResponse: def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage - self.retrieve = to_raw_response_wrapper( - agencies_with_coverage.retrieve, + self.list = to_raw_response_wrapper( + agencies_with_coverage.list, ) @@ -90,8 +96,8 @@ class AsyncAgenciesWithCoverageResourceWithRawResponse: def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage - self.retrieve = async_to_raw_response_wrapper( - agencies_with_coverage.retrieve, + self.list = async_to_raw_response_wrapper( + agencies_with_coverage.list, ) @@ -99,8 +105,8 @@ class AgenciesWithCoverageResourceWithStreamingResponse: def __init__(self, agencies_with_coverage: AgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage - self.retrieve = to_streamed_response_wrapper( - agencies_with_coverage.retrieve, + self.list = to_streamed_response_wrapper( + agencies_with_coverage.list, ) @@ -108,6 +114,6 @@ class AsyncAgenciesWithCoverageResourceWithStreamingResponse: def __init__(self, agencies_with_coverage: AsyncAgenciesWithCoverageResource) -> None: self._agencies_with_coverage = agencies_with_coverage - self.retrieve = async_to_streamed_response_wrapper( - agencies_with_coverage.retrieve, + self.list = async_to_streamed_response_wrapper( + agencies_with_coverage.list, ) diff --git a/src/onebusaway/resources/agency.py b/src/onebusaway/resources/agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/arrival_and_departure.py b/src/onebusaway/resources/arrival_and_departure.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/block.py b/src/onebusaway/resources/block.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/config.py b/src/onebusaway/resources/config.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/current_time.py b/src/onebusaway/resources/current_time.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/report_problem_with_stop.py b/src/onebusaway/resources/report_problem_with_stop.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/report_problem_with_trip.py b/src/onebusaway/resources/report_problem_with_trip.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/route.py b/src/onebusaway/resources/route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/route_ids_for_agency.py b/src/onebusaway/resources/route_ids_for_agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/routes_for_agency.py b/src/onebusaway/resources/routes_for_agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/routes_for_location.py b/src/onebusaway/resources/routes_for_location.py old mode 100644 new mode 100755 index 2c4d4e9..ee3bd19 --- a/src/onebusaway/resources/routes_for_location.py +++ b/src/onebusaway/resources/routes_for_location.py @@ -4,7 +4,7 @@ import httpx -from ..types import routes_for_location_retrieve_params +from ..types import routes_for_location_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -19,7 +19,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.routes_for_location_retrieve_response import RoutesForLocationRetrieveResponse +from ..types.routes_for_location_list_response import RoutesForLocationListResponse __all__ = ["RoutesForLocationResource", "AsyncRoutesForLocationResource"] @@ -33,7 +33,7 @@ def with_raw_response(self) -> RoutesForLocationResourceWithRawResponse: def with_streaming_response(self) -> RoutesForLocationResourceWithStreamingResponse: return RoutesForLocationResourceWithStreamingResponse(self) - def retrieve( + def list( self, *, lat: float, @@ -48,7 +48,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForLocationRetrieveResponse: + ) -> RoutesForLocationListResponse: """ routes-for-location @@ -77,10 +77,10 @@ def retrieve( "query": query, "radius": radius, }, - routes_for_location_retrieve_params.RoutesForLocationRetrieveParams, + routes_for_location_list_params.RoutesForLocationListParams, ), ), - cast_to=RoutesForLocationRetrieveResponse, + cast_to=RoutesForLocationListResponse, ) @@ -93,7 +93,7 @@ def with_raw_response(self) -> AsyncRoutesForLocationResourceWithRawResponse: def with_streaming_response(self) -> AsyncRoutesForLocationResourceWithStreamingResponse: return AsyncRoutesForLocationResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, *, lat: float, @@ -108,7 +108,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RoutesForLocationRetrieveResponse: + ) -> RoutesForLocationListResponse: """ routes-for-location @@ -137,10 +137,10 @@ async def retrieve( "query": query, "radius": radius, }, - routes_for_location_retrieve_params.RoutesForLocationRetrieveParams, + routes_for_location_list_params.RoutesForLocationListParams, ), ), - cast_to=RoutesForLocationRetrieveResponse, + cast_to=RoutesForLocationListResponse, ) @@ -148,8 +148,8 @@ class RoutesForLocationResourceWithRawResponse: def __init__(self, routes_for_location: RoutesForLocationResource) -> None: self._routes_for_location = routes_for_location - self.retrieve = to_raw_response_wrapper( - routes_for_location.retrieve, + self.list = to_raw_response_wrapper( + routes_for_location.list, ) @@ -157,8 +157,8 @@ class AsyncRoutesForLocationResourceWithRawResponse: def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: self._routes_for_location = routes_for_location - self.retrieve = async_to_raw_response_wrapper( - routes_for_location.retrieve, + self.list = async_to_raw_response_wrapper( + routes_for_location.list, ) @@ -166,8 +166,8 @@ class RoutesForLocationResourceWithStreamingResponse: def __init__(self, routes_for_location: RoutesForLocationResource) -> None: self._routes_for_location = routes_for_location - self.retrieve = to_streamed_response_wrapper( - routes_for_location.retrieve, + self.list = to_streamed_response_wrapper( + routes_for_location.list, ) @@ -175,6 +175,6 @@ class AsyncRoutesForLocationResourceWithStreamingResponse: def __init__(self, routes_for_location: AsyncRoutesForLocationResource) -> None: self._routes_for_location = routes_for_location - self.retrieve = async_to_streamed_response_wrapper( - routes_for_location.retrieve, + self.list = async_to_streamed_response_wrapper( + routes_for_location.list, ) diff --git a/src/onebusaway/resources/schedule_for_route.py b/src/onebusaway/resources/schedule_for_route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/schedule_for_stop.py b/src/onebusaway/resources/schedule_for_stop.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/search_for_route.py b/src/onebusaway/resources/search_for_route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/search_for_stop.py b/src/onebusaway/resources/search_for_stop.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/shape.py b/src/onebusaway/resources/shape.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/stop.py b/src/onebusaway/resources/stop.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/stop_ids_for_agency.py b/src/onebusaway/resources/stop_ids_for_agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/stops_for_location.py b/src/onebusaway/resources/stops_for_location.py old mode 100644 new mode 100755 index dd64b27..43bdbcf --- a/src/onebusaway/resources/stops_for_location.py +++ b/src/onebusaway/resources/stops_for_location.py @@ -4,7 +4,7 @@ import httpx -from ..types import stops_for_location_retrieve_params +from ..types import stops_for_location_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -19,7 +19,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.stops_for_location_retrieve_response import StopsForLocationRetrieveResponse +from ..types.stops_for_location_list_response import StopsForLocationListResponse __all__ = ["StopsForLocationResource", "AsyncStopsForLocationResource"] @@ -33,22 +33,34 @@ def with_raw_response(self) -> StopsForLocationResourceWithRawResponse: def with_streaming_response(self) -> StopsForLocationResourceWithStreamingResponse: return StopsForLocationResourceWithStreamingResponse(self) - def retrieve( + def list( self, *, - lat: float | NotGiven = NOT_GIVEN, - lon: float | NotGiven = NOT_GIVEN, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | 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, - ) -> StopsForLocationRetrieveResponse: + ) -> StopsForLocationListResponse: """ stops-for-location Args: + lat_span: An alternative to radius to set the search bounding box (optional) + + lon_span: An alternative to radius to set the search bounding box (optional) + + query: A search query string to filter the results + + radius: The radius in meters to search within + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -68,11 +80,15 @@ def retrieve( { "lat": lat, "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, }, - stops_for_location_retrieve_params.StopsForLocationRetrieveParams, + stops_for_location_list_params.StopsForLocationListParams, ), ), - cast_to=StopsForLocationRetrieveResponse, + cast_to=StopsForLocationListResponse, ) @@ -85,22 +101,34 @@ def with_raw_response(self) -> AsyncStopsForLocationResourceWithRawResponse: def with_streaming_response(self) -> AsyncStopsForLocationResourceWithStreamingResponse: return AsyncStopsForLocationResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, *, - lat: float | NotGiven = NOT_GIVEN, - lon: float | NotGiven = NOT_GIVEN, + lat: float, + lon: float, + lat_span: float | NotGiven = NOT_GIVEN, + lon_span: float | NotGiven = NOT_GIVEN, + query: str | NotGiven = NOT_GIVEN, + radius: float | 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, - ) -> StopsForLocationRetrieveResponse: + ) -> StopsForLocationListResponse: """ stops-for-location Args: + lat_span: An alternative to radius to set the search bounding box (optional) + + lon_span: An alternative to radius to set the search bounding box (optional) + + query: A search query string to filter the results + + radius: The radius in meters to search within + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -120,11 +148,15 @@ async def retrieve( { "lat": lat, "lon": lon, + "lat_span": lat_span, + "lon_span": lon_span, + "query": query, + "radius": radius, }, - stops_for_location_retrieve_params.StopsForLocationRetrieveParams, + stops_for_location_list_params.StopsForLocationListParams, ), ), - cast_to=StopsForLocationRetrieveResponse, + cast_to=StopsForLocationListResponse, ) @@ -132,8 +164,8 @@ class StopsForLocationResourceWithRawResponse: def __init__(self, stops_for_location: StopsForLocationResource) -> None: self._stops_for_location = stops_for_location - self.retrieve = to_raw_response_wrapper( - stops_for_location.retrieve, + self.list = to_raw_response_wrapper( + stops_for_location.list, ) @@ -141,8 +173,8 @@ class AsyncStopsForLocationResourceWithRawResponse: def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: self._stops_for_location = stops_for_location - self.retrieve = async_to_raw_response_wrapper( - stops_for_location.retrieve, + self.list = async_to_raw_response_wrapper( + stops_for_location.list, ) @@ -150,8 +182,8 @@ class StopsForLocationResourceWithStreamingResponse: def __init__(self, stops_for_location: StopsForLocationResource) -> None: self._stops_for_location = stops_for_location - self.retrieve = to_streamed_response_wrapper( - stops_for_location.retrieve, + self.list = to_streamed_response_wrapper( + stops_for_location.list, ) @@ -159,6 +191,6 @@ class AsyncStopsForLocationResourceWithStreamingResponse: def __init__(self, stops_for_location: AsyncStopsForLocationResource) -> None: self._stops_for_location = stops_for_location - self.retrieve = async_to_streamed_response_wrapper( - stops_for_location.retrieve, + self.list = async_to_streamed_response_wrapper( + stops_for_location.list, ) diff --git a/src/onebusaway/resources/stops_for_route.py b/src/onebusaway/resources/stops_for_route.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trip.py b/src/onebusaway/resources/trip.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trip_details.py b/src/onebusaway/resources/trip_details.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trip_for_vehicle.py b/src/onebusaway/resources/trip_for_vehicle.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/resources/trips_for_location.py b/src/onebusaway/resources/trips_for_location.py old mode 100644 new mode 100755 index 947283d..31acdc0 --- a/src/onebusaway/resources/trips_for_location.py +++ b/src/onebusaway/resources/trips_for_location.py @@ -4,7 +4,7 @@ import httpx -from ..types import trips_for_location_retrieve_params +from ..types import trips_for_location_list_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -19,7 +19,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options -from ..types.trips_for_location_retrieve_response import TripsForLocationRetrieveResponse +from ..types.trips_for_location_list_response import TripsForLocationListResponse __all__ = ["TripsForLocationResource", "AsyncTripsForLocationResource"] @@ -33,7 +33,7 @@ def with_raw_response(self) -> TripsForLocationResourceWithRawResponse: def with_streaming_response(self) -> TripsForLocationResourceWithStreamingResponse: return TripsForLocationResourceWithStreamingResponse(self) - def retrieve( + def list( self, *, lat: float, @@ -49,7 +49,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForLocationRetrieveResponse: + ) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -95,10 +95,10 @@ def retrieve( "include_trip": include_trip, "time": time, }, - trips_for_location_retrieve_params.TripsForLocationRetrieveParams, + trips_for_location_list_params.TripsForLocationListParams, ), ), - cast_to=TripsForLocationRetrieveResponse, + cast_to=TripsForLocationListResponse, ) @@ -111,7 +111,7 @@ def with_raw_response(self) -> AsyncTripsForLocationResourceWithRawResponse: def with_streaming_response(self) -> AsyncTripsForLocationResourceWithStreamingResponse: return AsyncTripsForLocationResourceWithStreamingResponse(self) - async def retrieve( + async def list( self, *, lat: float, @@ -127,7 +127,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> TripsForLocationRetrieveResponse: + ) -> TripsForLocationListResponse: """ Retrieve trips for a given location @@ -173,10 +173,10 @@ async def retrieve( "include_trip": include_trip, "time": time, }, - trips_for_location_retrieve_params.TripsForLocationRetrieveParams, + trips_for_location_list_params.TripsForLocationListParams, ), ), - cast_to=TripsForLocationRetrieveResponse, + cast_to=TripsForLocationListResponse, ) @@ -184,8 +184,8 @@ class TripsForLocationResourceWithRawResponse: def __init__(self, trips_for_location: TripsForLocationResource) -> None: self._trips_for_location = trips_for_location - self.retrieve = to_raw_response_wrapper( - trips_for_location.retrieve, + self.list = to_raw_response_wrapper( + trips_for_location.list, ) @@ -193,8 +193,8 @@ class AsyncTripsForLocationResourceWithRawResponse: def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: self._trips_for_location = trips_for_location - self.retrieve = async_to_raw_response_wrapper( - trips_for_location.retrieve, + self.list = async_to_raw_response_wrapper( + trips_for_location.list, ) @@ -202,8 +202,8 @@ class TripsForLocationResourceWithStreamingResponse: def __init__(self, trips_for_location: TripsForLocationResource) -> None: self._trips_for_location = trips_for_location - self.retrieve = to_streamed_response_wrapper( - trips_for_location.retrieve, + self.list = to_streamed_response_wrapper( + trips_for_location.list, ) @@ -211,6 +211,6 @@ class AsyncTripsForLocationResourceWithStreamingResponse: def __init__(self, trips_for_location: AsyncTripsForLocationResource) -> None: self._trips_for_location = trips_for_location - self.retrieve = async_to_streamed_response_wrapper( - trips_for_location.retrieve, + self.list = async_to_streamed_response_wrapper( + trips_for_location.list, ) diff --git a/src/onebusaway/resources/trips_for_route.py b/src/onebusaway/resources/trips_for_route.py new file mode 100755 index 0000000..10364f1 --- /dev/null +++ b/src/onebusaway/resources/trips_for_route.py @@ -0,0 +1,188 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import trips_for_route_list_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.trips_for_route_list_response import TripsForRouteListResponse + +__all__ = ["TripsForRouteResource", "AsyncTripsForRouteResource"] + + +class TripsForRouteResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> TripsForRouteResourceWithRawResponse: + return TripsForRouteResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> TripsForRouteResourceWithStreamingResponse: + return TripsForRouteResourceWithStreamingResponse(self) + + def list( + self, + route_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: 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, + ) -> TripsForRouteListResponse: + """ + Search for active trips for a specific route. + + Args: + include_schedule: Determine whether full schedule elements are included. Defaults to false. + + include_status: Determine whether full tripStatus elements with real-time information are + included. Defaults to false. + + time: Query the system at a specific time. Useful 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 + """ + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return self._get( + f"/api/where/trips-for-route/{route_id}.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, + "time": time, + }, + trips_for_route_list_params.TripsForRouteListParams, + ), + ), + cast_to=TripsForRouteListResponse, + ) + + +class AsyncTripsForRouteResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncTripsForRouteResourceWithRawResponse: + return AsyncTripsForRouteResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncTripsForRouteResourceWithStreamingResponse: + return AsyncTripsForRouteResourceWithStreamingResponse(self) + + async def list( + self, + route_id: str, + *, + include_schedule: bool | NotGiven = NOT_GIVEN, + include_status: 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, + ) -> TripsForRouteListResponse: + """ + Search for active trips for a specific route. + + Args: + include_schedule: Determine whether full schedule elements are included. Defaults to false. + + include_status: Determine whether full tripStatus elements with real-time information are + included. Defaults to false. + + time: Query the system at a specific time. Useful 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 + """ + if not route_id: + raise ValueError(f"Expected a non-empty value for `route_id` but received {route_id!r}") + return await self._get( + f"/api/where/trips-for-route/{route_id}.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, + "time": time, + }, + trips_for_route_list_params.TripsForRouteListParams, + ), + ), + cast_to=TripsForRouteListResponse, + ) + + +class TripsForRouteResourceWithRawResponse: + def __init__(self, trips_for_route: TripsForRouteResource) -> None: + self._trips_for_route = trips_for_route + + self.list = to_raw_response_wrapper( + trips_for_route.list, + ) + + +class AsyncTripsForRouteResourceWithRawResponse: + def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: + self._trips_for_route = trips_for_route + + self.list = async_to_raw_response_wrapper( + trips_for_route.list, + ) + + +class TripsForRouteResourceWithStreamingResponse: + def __init__(self, trips_for_route: TripsForRouteResource) -> None: + self._trips_for_route = trips_for_route + + self.list = to_streamed_response_wrapper( + trips_for_route.list, + ) + + +class AsyncTripsForRouteResourceWithStreamingResponse: + def __init__(self, trips_for_route: AsyncTripsForRouteResource) -> None: + self._trips_for_route = trips_for_route + + self.list = async_to_streamed_response_wrapper( + trips_for_route.list, + ) diff --git a/src/onebusaway/resources/vehicles_for_agency.py b/src/onebusaway/resources/vehicles_for_agency.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/__init__.py b/src/onebusaway/types/__init__.py old mode 100644 new mode 100755 index 125bec1..5f9bda3 --- a/src/onebusaway/types/__init__.py +++ b/src/onebusaway/types/__init__.py @@ -12,15 +12,23 @@ from .config_retrieve_response import ConfigRetrieveResponse as ConfigRetrieveResponse from .stops_for_route_list_params import StopsForRouteListParams as StopsForRouteListParams from .trip_detail_retrieve_params import TripDetailRetrieveParams as TripDetailRetrieveParams +from .trips_for_route_list_params import TripsForRouteListParams as TripsForRouteListParams from .stops_for_route_list_response import StopsForRouteListResponse as StopsForRouteListResponse from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse +from .trips_for_route_list_response import TripsForRouteListResponse as TripsForRouteListResponse from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse +from .stops_for_location_list_params import StopsForLocationListParams as StopsForLocationListParams +from .trips_for_location_list_params import TripsForLocationListParams as TripsForLocationListParams from .routes_for_agency_list_response import RoutesForAgencyListResponse as RoutesForAgencyListResponse +from .routes_for_location_list_params import RoutesForLocationListParams as RoutesForLocationListParams from .search_for_stop_retrieve_params import SearchForStopRetrieveParams as SearchForStopRetrieveParams from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams from .search_for_route_retrieve_params import SearchForRouteRetrieveParams as SearchForRouteRetrieveParams +from .stops_for_location_list_response import StopsForLocationListResponse as StopsForLocationListResponse from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams +from .trips_for_location_list_response import TripsForLocationListResponse as TripsForLocationListResponse from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams +from .routes_for_location_list_response import RoutesForLocationListResponse as RoutesForLocationListResponse from .schedule_for_stop_retrieve_params import ScheduleForStopRetrieveParams as ScheduleForStopRetrieveParams from .search_for_stop_retrieve_response import SearchForStopRetrieveResponse as SearchForStopRetrieveResponse from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse @@ -28,27 +36,17 @@ from .route_ids_for_agency_list_response import RouteIDsForAgencyListResponse as RouteIDsForAgencyListResponse from .schedule_for_route_retrieve_params import ScheduleForRouteRetrieveParams as ScheduleForRouteRetrieveParams from .search_for_route_retrieve_response import SearchForRouteRetrieveResponse as SearchForRouteRetrieveResponse -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 .routes_for_location_retrieve_params import RoutesForLocationRetrieveParams as RoutesForLocationRetrieveParams from .schedule_for_stop_retrieve_response import ScheduleForStopRetrieveResponse as ScheduleForStopRetrieveResponse +from .agencies_with_coverage_list_response import AgenciesWithCoverageListResponse as AgenciesWithCoverageListResponse from .schedule_for_route_retrieve_response import ScheduleForRouteRetrieveResponse as ScheduleForRouteRetrieveResponse -from .stops_for_location_retrieve_response import StopsForLocationRetrieveResponse as StopsForLocationRetrieveResponse -from .trips_for_location_retrieve_response import TripsForLocationRetrieveResponse as TripsForLocationRetrieveResponse from .arrival_and_departure_retrieve_params import ( ArrivalAndDepartureRetrieveParams as ArrivalAndDepartureRetrieveParams, ) -from .routes_for_location_retrieve_response import ( - RoutesForLocationRetrieveResponse as RoutesForLocationRetrieveResponse, -) from .arrival_and_departure_retrieve_response import ( ArrivalAndDepartureRetrieveResponse as ArrivalAndDepartureRetrieveResponse, ) -from .agencies_with_coverage_retrieve_response import ( - AgenciesWithCoverageRetrieveResponse as AgenciesWithCoverageRetrieveResponse, -) from .report_problem_with_stop_retrieve_params import ( ReportProblemWithStopRetrieveParams as ReportProblemWithStopRetrieveParams, ) diff --git a/src/onebusaway/types/agencies_with_coverage_list_response.py b/src/onebusaway/types/agencies_with_coverage_list_response.py new file mode 100755 index 0000000..13f182b --- /dev/null +++ b/src/onebusaway/types/agencies_with_coverage_list_response.py @@ -0,0 +1,39 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from pydantic import Field as FieldInfo + +from .._models import BaseModel +from .shared.references import References +from .shared.response_wrapper import ResponseWrapper + +__all__ = [ + "AgenciesWithCoverageListResponse", + "AgenciesWithCoverageListResponseData", + "AgenciesWithCoverageListResponseDataList", +] + + +class AgenciesWithCoverageListResponseDataList(BaseModel): + agency_id: str = FieldInfo(alias="agencyId") + + lat: float + + lat_span: float = FieldInfo(alias="latSpan") + + lon: float + + lon_span: float = FieldInfo(alias="lonSpan") + + +class AgenciesWithCoverageListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[AgenciesWithCoverageListResponseDataList] + + references: References + + +class AgenciesWithCoverageListResponse(ResponseWrapper): + data: AgenciesWithCoverageListResponseData diff --git a/src/onebusaway/types/agencies_with_coverage_retrieve_response.py b/src/onebusaway/types/agencies_with_coverage_retrieve_response.py deleted file mode 100644 index d4db507..0000000 --- a/src/onebusaway/types/agencies_with_coverage_retrieve_response.py +++ /dev/null @@ -1,39 +0,0 @@ -# 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__ = [ - "AgenciesWithCoverageRetrieveResponse", - "AgenciesWithCoverageRetrieveResponseData", - "AgenciesWithCoverageRetrieveResponseDataList", -] - - -class AgenciesWithCoverageRetrieveResponseDataList(BaseModel): - agency_id: str = FieldInfo(alias="agencyId") - - lat: float - - lat_span: float = FieldInfo(alias="latSpan") - - lon: float - - lon_span: float = FieldInfo(alias="lonSpan") - - -class AgenciesWithCoverageRetrieveResponseData(BaseModel): - list: List[AgenciesWithCoverageRetrieveResponseDataList] - - references: References - - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - - -class AgenciesWithCoverageRetrieveResponse(ResponseWrapper): - data: AgenciesWithCoverageRetrieveResponseData diff --git a/src/onebusaway/types/agency_retrieve_response.py b/src/onebusaway/types/agency_retrieve_response.py old mode 100644 new mode 100755 index 06000e6..61d8e79 --- a/src/onebusaway/types/agency_retrieve_response.py +++ b/src/onebusaway/types/agency_retrieve_response.py @@ -36,9 +36,9 @@ class AgencyRetrieveResponseDataEntry(BaseModel): class AgencyRetrieveResponseData(BaseModel): entry: AgencyRetrieveResponseDataEntry - references: References + limit_exceeded: bool = FieldInfo(alias="limitExceeded") - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) + references: References class AgencyRetrieveResponse(ResponseWrapper): diff --git a/src/onebusaway/types/arrival_and_departure_list_params.py b/src/onebusaway/types/arrival_and_departure_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/arrival_and_departure_list_response.py b/src/onebusaway/types/arrival_and_departure_list_response.py old mode 100644 new mode 100755 index 362df0d..cbabf18 --- a/src/onebusaway/types/arrival_and_departure_list_response.py +++ b/src/onebusaway/types/arrival_and_departure_list_response.py @@ -36,33 +36,69 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosi class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + 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). """ - 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[ ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusLastKnownLocation ] = FieldInfo(alias="lastKnownLocation", default=None) @@ -71,12 +107,6 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas 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.""" @@ -86,68 +116,95 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus(Bas (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[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatusPosition] = 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 ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): - actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) - """The actual track information of the arriving transit vehicle.""" - - arrival_enabled: Optional[bool] = FieldInfo(alias="arrivalEnabled", default=None) + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") """Indicates if riders can arrive on this transit vehicle.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of this arrival’s trip into the sequence of trips for the active block.""" - departure_enabled: Optional[bool] = FieldInfo(alias="departureEnabled", default=None) + 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.""" @@ -160,12 +217,6 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) """Timestamp of the last update time for this arrival.""" - number_of_stops_away: Optional[int] = FieldInfo(alias="numberOfStopsAway", default=None) - """ - Number of stops between the arriving transit vehicle and the current stop - (excluding the current stop). - """ - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) """Current occupancy status of the transit vehicle.""" @@ -175,27 +226,12 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) """Interval for predicted arrival time, if available.""" - predicted_arrival_time: Optional[int] = FieldInfo(alias="predictedArrivalTime", default=None) - """ - Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time - available). - """ - predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) """Interval for predicted departure time, if available.""" - predicted_departure_time: Optional[int] = FieldInfo(alias="predictedDepartureTime", default=None) - """ - Predicted departure time, in milliseconds since Unix epoch (zero if no real-time - available). - """ - predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) """Predicted occupancy status of the transit vehicle.""" - route_id: Optional[str] = FieldInfo(alias="routeId", default=None) - """The ID of the route for the arriving vehicle.""" - route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) """ Optional route long name that potentially overrides the route long name in the @@ -211,59 +247,23 @@ class ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture(BaseModel): scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) """Interval for scheduled arrival time.""" - scheduled_arrival_time: Optional[int] = FieldInfo(alias="scheduledArrivalTime", default=None) - """Scheduled arrival time, in milliseconds since Unix epoch.""" - scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) """Interval for scheduled departure time.""" - scheduled_departure_time: Optional[int] = FieldInfo(alias="scheduledDepartureTime", default=None) - """Scheduled departure time, in milliseconds since Unix epoch.""" - scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) """Scheduled track information of the arriving transit vehicle.""" - 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 arrival.""" status: Optional[str] = None """Current status of the arrival.""" - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) - """The ID of the stop the vehicle is arriving at.""" - - stop_sequence: Optional[int] = FieldInfo(alias="stopSequence", default=None) - """ - Index of the stop into the sequence of stops that make up the trip for this - arrival. - """ - - total_stops_in_trip: Optional[int] = FieldInfo(alias="totalStopsInTrip", default=None) - """Total number of stops visited on the trip for this arrival.""" - - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) - """ - Optional trip headsign that potentially overrides the trip headsign in the - referenced trip element. - """ - - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - """The ID of the trip for the arriving vehicle.""" - trip_status: Optional[ArrivalAndDepartureListResponseDataEntryArrivalsAndDepartureTripStatus] = FieldInfo( alias="tripStatus", default=None ) """Trip-specific status for the arriving transit vehicle.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) - """ID of the transit vehicle serving this trip.""" - class ArrivalAndDepartureListResponseDataEntry(BaseModel): arrivals_and_departures: List[ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture] = FieldInfo( diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_params.py b/src/onebusaway/types/arrival_and_departure_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/arrival_and_departure_retrieve_response.py b/src/onebusaway/types/arrival_and_departure_retrieve_response.py old mode 100644 new mode 100755 index b9a7507..a0bc771 --- a/src/onebusaway/types/arrival_and_departure_retrieve_response.py +++ b/src/onebusaway/types/arrival_and_departure_retrieve_response.py @@ -35,33 +35,69 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition(BaseModel): class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + 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). """ - 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[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) @@ -70,12 +106,6 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): 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.""" @@ -85,68 +115,95 @@ class ArrivalAndDepartureRetrieveResponseDataEntryTripStatus(BaseModel): (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[ArrivalAndDepartureRetrieveResponseDataEntryTripStatusPosition] = 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 ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): - actual_track: Optional[str] = FieldInfo(alias="actualTrack", default=None) - """The actual track information of the arriving transit vehicle.""" - - arrival_enabled: Optional[bool] = FieldInfo(alias="arrivalEnabled", default=None) + arrival_enabled: bool = FieldInfo(alias="arrivalEnabled") """Indicates if riders can arrive on this transit vehicle.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of this arrival’s trip into the sequence of trips for the active block.""" - departure_enabled: Optional[bool] = FieldInfo(alias="departureEnabled", default=None) + 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.""" @@ -159,12 +216,6 @@ class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): last_update_time: Optional[int] = FieldInfo(alias="lastUpdateTime", default=None) """Timestamp of the last update time for this arrival.""" - number_of_stops_away: Optional[int] = FieldInfo(alias="numberOfStopsAway", default=None) - """ - Number of stops between the arriving transit vehicle and the current stop - (excluding the current stop). - """ - occupancy_status: Optional[str] = FieldInfo(alias="occupancyStatus", default=None) """Current occupancy status of the transit vehicle.""" @@ -174,27 +225,12 @@ class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): predicted_arrival_interval: Optional[str] = FieldInfo(alias="predictedArrivalInterval", default=None) """Interval for predicted arrival time, if available.""" - predicted_arrival_time: Optional[int] = FieldInfo(alias="predictedArrivalTime", default=None) - """ - Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time - available). - """ - predicted_departure_interval: Optional[str] = FieldInfo(alias="predictedDepartureInterval", default=None) """Interval for predicted departure time, if available.""" - predicted_departure_time: Optional[int] = FieldInfo(alias="predictedDepartureTime", default=None) - """ - Predicted departure time, in milliseconds since Unix epoch (zero if no real-time - available). - """ - predicted_occupancy: Optional[str] = FieldInfo(alias="predictedOccupancy", default=None) """Predicted occupancy status of the transit vehicle.""" - route_id: Optional[str] = FieldInfo(alias="routeId", default=None) - """The ID of the route for the arriving vehicle.""" - route_long_name: Optional[str] = FieldInfo(alias="routeLongName", default=None) """ Optional route long name that potentially overrides the route long name in the @@ -210,59 +246,23 @@ class ArrivalAndDepartureRetrieveResponseDataEntry(BaseModel): scheduled_arrival_interval: Optional[str] = FieldInfo(alias="scheduledArrivalInterval", default=None) """Interval for scheduled arrival time.""" - scheduled_arrival_time: Optional[int] = FieldInfo(alias="scheduledArrivalTime", default=None) - """Scheduled arrival time, in milliseconds since Unix epoch.""" - scheduled_departure_interval: Optional[str] = FieldInfo(alias="scheduledDepartureInterval", default=None) """Interval for scheduled departure time.""" - scheduled_departure_time: Optional[int] = FieldInfo(alias="scheduledDepartureTime", default=None) - """Scheduled departure time, in milliseconds since Unix epoch.""" - scheduled_track: Optional[str] = FieldInfo(alias="scheduledTrack", default=None) """Scheduled track information of the arriving transit vehicle.""" - 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 arrival.""" status: Optional[str] = None """Current status of the arrival.""" - stop_id: Optional[str] = FieldInfo(alias="stopId", default=None) - """The ID of the stop the vehicle is arriving at.""" - - stop_sequence: Optional[int] = FieldInfo(alias="stopSequence", default=None) - """ - Index of the stop into the sequence of stops that make up the trip for this - arrival. - """ - - total_stops_in_trip: Optional[int] = FieldInfo(alias="totalStopsInTrip", default=None) - """Total number of stops visited on the trip for this arrival.""" - - trip_headsign: Optional[str] = FieldInfo(alias="tripHeadsign", default=None) - """ - Optional trip headsign that potentially overrides the trip headsign in the - referenced trip element. - """ - - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - """The ID of the trip for the arriving vehicle.""" - trip_status: Optional[ArrivalAndDepartureRetrieveResponseDataEntryTripStatus] = FieldInfo( alias="tripStatus", default=None ) """Trip-specific status for the arriving transit vehicle.""" - vehicle_id: Optional[str] = FieldInfo(alias="vehicleId", default=None) - """ID of the transit vehicle serving this trip.""" - class ArrivalAndDepartureRetrieveResponseData(BaseModel): entry: ArrivalAndDepartureRetrieveResponseDataEntry diff --git a/src/onebusaway/types/block_retrieve_response.py b/src/onebusaway/types/block_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/config_retrieve_response.py b/src/onebusaway/types/config_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/current_time_retrieve_response.py b/src/onebusaway/types/current_time_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/report_problem_with_stop_retrieve_params.py b/src/onebusaway/types/report_problem_with_stop_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/report_problem_with_trip_retrieve_params.py b/src/onebusaway/types/report_problem_with_trip_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/route_ids_for_agency_list_response.py b/src/onebusaway/types/route_ids_for_agency_list_response.py old mode 100644 new mode 100755 index ffe9c32..193704e --- a/src/onebusaway/types/route_ids_for_agency_list_response.py +++ b/src/onebusaway/types/route_ids_for_agency_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from pydantic import Field as FieldInfo @@ -12,12 +12,12 @@ class RouteIDsForAgencyListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + list: List[str] references: References - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - class RouteIDsForAgencyListResponse(ResponseWrapper): data: RouteIDsForAgencyListResponseData diff --git a/src/onebusaway/types/route_retrieve_response.py b/src/onebusaway/types/route_retrieve_response.py old mode 100644 new mode 100755 index 7a153e8..a0dfa1e --- a/src/onebusaway/types/route_retrieve_response.py +++ b/src/onebusaway/types/route_retrieve_response.py @@ -12,9 +12,11 @@ class RouteRetrieveResponseDataEntry(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -22,12 +24,12 @@ class RouteRetrieveResponseDataEntry(BaseModel): long_name: Optional[str] = FieldInfo(alias="longName", default=None) + null_safe_short_name: Optional[str] = FieldInfo(alias="nullSafeShortName", default=None) + short_name: Optional[str] = FieldInfo(alias="shortName", default=None) text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None diff --git a/src/onebusaway/types/routes_for_agency_list_response.py b/src/onebusaway/types/routes_for_agency_list_response.py old mode 100644 new mode 100755 index 5ff3242..672141d --- a/src/onebusaway/types/routes_for_agency_list_response.py +++ b/src/onebusaway/types/routes_for_agency_list_response.py @@ -12,9 +12,11 @@ class RoutesForAgencyListResponseDataList(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -28,8 +30,6 @@ class RoutesForAgencyListResponseDataList(BaseModel): text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None diff --git a/src/onebusaway/types/routes_for_location_retrieve_params.py b/src/onebusaway/types/routes_for_location_list_params.py old mode 100644 new mode 100755 similarity index 79% rename from src/onebusaway/types/routes_for_location_retrieve_params.py rename to src/onebusaway/types/routes_for_location_list_params.py index 9acd9ce..033ec2a --- a/src/onebusaway/types/routes_for_location_retrieve_params.py +++ b/src/onebusaway/types/routes_for_location_list_params.py @@ -6,10 +6,10 @@ from .._utils import PropertyInfo -__all__ = ["RoutesForLocationRetrieveParams"] +__all__ = ["RoutesForLocationListParams"] -class RoutesForLocationRetrieveParams(TypedDict, total=False): +class RoutesForLocationListParams(TypedDict, total=False): lat: Required[float] lon: Required[float] diff --git a/src/onebusaway/types/routes_for_location_retrieve_response.py b/src/onebusaway/types/routes_for_location_list_response.py old mode 100644 new mode 100755 similarity index 61% rename from src/onebusaway/types/routes_for_location_retrieve_response.py rename to src/onebusaway/types/routes_for_location_list_response.py index a01a271..0393f01 --- a/src/onebusaway/types/routes_for_location_retrieve_response.py +++ b/src/onebusaway/types/routes_for_location_list_response.py @@ -9,16 +9,18 @@ from .shared.response_wrapper import ResponseWrapper __all__ = [ - "RoutesForLocationRetrieveResponse", - "RoutesForLocationRetrieveResponseData", - "RoutesForLocationRetrieveResponseDataList", + "RoutesForLocationListResponse", + "RoutesForLocationListResponseData", + "RoutesForLocationListResponseDataList", ] -class RoutesForLocationRetrieveResponseDataList(BaseModel): - id: Optional[str] = None +class RoutesForLocationListResponseDataList(BaseModel): + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -32,20 +34,18 @@ class RoutesForLocationRetrieveResponseDataList(BaseModel): text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None -class RoutesForLocationRetrieveResponseData(BaseModel): +class RoutesForLocationListResponseData(BaseModel): limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[RoutesForLocationRetrieveResponseDataList] + list: List[RoutesForLocationListResponseDataList] out_of_range: bool = FieldInfo(alias="outOfRange") references: References -class RoutesForLocationRetrieveResponse(ResponseWrapper): - data: RoutesForLocationRetrieveResponseData +class RoutesForLocationListResponse(ResponseWrapper): + data: RoutesForLocationListResponseData diff --git a/src/onebusaway/types/schedule_for_route_retrieve_params.py b/src/onebusaway/types/schedule_for_route_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/schedule_for_route_retrieve_response.py b/src/onebusaway/types/schedule_for_route_retrieve_response.py old mode 100644 new mode 100755 index 1c68056..17f04e0 --- a/src/onebusaway/types/schedule_for_route_retrieve_response.py +++ b/src/onebusaway/types/schedule_for_route_retrieve_response.py @@ -88,6 +88,8 @@ class ScheduleForRouteRetrieveResponseDataEntryTrip(BaseModel): route_id: str = FieldInfo(alias="routeId") + service_id: str = FieldInfo(alias="serviceId") + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) @@ -96,8 +98,6 @@ class ScheduleForRouteRetrieveResponseDataEntryTrip(BaseModel): route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_params.py b/src/onebusaway/types/schedule_for_stop_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/schedule_for_stop_retrieve_response.py b/src/onebusaway/types/schedule_for_stop_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/search_for_route_retrieve_params.py b/src/onebusaway/types/search_for_route_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/search_for_route_retrieve_response.py b/src/onebusaway/types/search_for_route_retrieve_response.py old mode 100644 new mode 100755 index 8eaa0d1..0ed8dc3 --- a/src/onebusaway/types/search_for_route_retrieve_response.py +++ b/src/onebusaway/types/search_for_route_retrieve_response.py @@ -16,9 +16,11 @@ class SearchForRouteRetrieveResponseDataList(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -32,8 +34,6 @@ class SearchForRouteRetrieveResponseDataList(BaseModel): text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None diff --git a/src/onebusaway/types/search_for_stop_retrieve_params.py b/src/onebusaway/types/search_for_stop_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/search_for_stop_retrieve_response.py b/src/onebusaway/types/search_for_stop_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/shape_retrieve_response.py b/src/onebusaway/types/shape_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/shared/__init__.py b/src/onebusaway/types/shared/__init__.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/shared/references.py b/src/onebusaway/types/shared/references.py old mode 100644 new mode 100755 index cb39a86..98e9026 --- a/src/onebusaway/types/shared/references.py +++ b/src/onebusaway/types/shared/references.py @@ -50,9 +50,11 @@ class Agency(BaseModel): class Route(BaseModel): - id: Optional[str] = None + id: str - agency_id: Optional[str] = FieldInfo(alias="agencyId", default=None) + agency_id: str = FieldInfo(alias="agencyId") + + type: int color: Optional[str] = None @@ -66,8 +68,6 @@ class Route(BaseModel): text_color: Optional[str] = FieldInfo(alias="textColor", default=None) - type: Optional[int] = None - url: Optional[str] = None @@ -237,6 +237,8 @@ class Trip(BaseModel): route_id: str = FieldInfo(alias="routeId") + service_id: str = FieldInfo(alias="serviceId") + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) @@ -245,8 +247,6 @@ class Trip(BaseModel): route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) diff --git a/src/onebusaway/types/shared/response_wrapper.py b/src/onebusaway/types/shared/response_wrapper.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stop_ids_for_agency_list_response.py b/src/onebusaway/types/stop_ids_for_agency_list_response.py old mode 100644 new mode 100755 index f36b63f..3ae9947 --- a/src/onebusaway/types/stop_ids_for_agency_list_response.py +++ b/src/onebusaway/types/stop_ids_for_agency_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import List from pydantic import Field as FieldInfo @@ -12,12 +12,12 @@ class StopIDsForAgencyListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + list: List[str] references: References - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - class StopIDsForAgencyListResponse(ResponseWrapper): data: StopIDsForAgencyListResponseData diff --git a/src/onebusaway/types/stop_retrieve_response.py b/src/onebusaway/types/stop_retrieve_response.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stops_for_location_list_params.py b/src/onebusaway/types/stops_for_location_list_params.py new file mode 100755 index 0000000..3174257 --- /dev/null +++ b/src/onebusaway/types/stops_for_location_list_params.py @@ -0,0 +1,27 @@ +# 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__ = ["StopsForLocationListParams"] + + +class StopsForLocationListParams(TypedDict, total=False): + lat: Required[float] + + lon: Required[float] + + lat_span: Annotated[float, PropertyInfo(alias="latSpan")] + """An alternative to radius to set the search bounding box (optional)""" + + lon_span: Annotated[float, PropertyInfo(alias="lonSpan")] + """An alternative to radius to set the search bounding box (optional)""" + + query: str + """A search query string to filter the results""" + + radius: float + """The radius in meters to search within""" diff --git a/src/onebusaway/types/stops_for_location_retrieve_response.py b/src/onebusaway/types/stops_for_location_list_response.py old mode 100644 new mode 100755 similarity index 66% rename from src/onebusaway/types/stops_for_location_retrieve_response.py rename to src/onebusaway/types/stops_for_location_list_response.py index 628b246..a74aea4 --- a/src/onebusaway/types/stops_for_location_retrieve_response.py +++ b/src/onebusaway/types/stops_for_location_list_response.py @@ -8,14 +8,10 @@ from .shared.references import References from .shared.response_wrapper import ResponseWrapper -__all__ = [ - "StopsForLocationRetrieveResponse", - "StopsForLocationRetrieveResponseData", - "StopsForLocationRetrieveResponseDataList", -] +__all__ = ["StopsForLocationListResponse", "StopsForLocationListResponseData", "StopsForLocationListResponseDataList"] -class StopsForLocationRetrieveResponseDataList(BaseModel): +class StopsForLocationListResponseDataList(BaseModel): id: str lat: float @@ -39,13 +35,13 @@ class StopsForLocationRetrieveResponseDataList(BaseModel): wheelchair_boarding: Optional[str] = FieldInfo(alias="wheelchairBoarding", default=None) -class StopsForLocationRetrieveResponseData(BaseModel): +class StopsForLocationListResponseData(BaseModel): limit_exceeded: bool = FieldInfo(alias="limitExceeded") - list: List[StopsForLocationRetrieveResponseDataList] + list: List[StopsForLocationListResponseDataList] references: References -class StopsForLocationRetrieveResponse(ResponseWrapper): - data: StopsForLocationRetrieveResponseData +class StopsForLocationListResponse(ResponseWrapper): + data: StopsForLocationListResponseData diff --git a/src/onebusaway/types/stops_for_location_retrieve_params.py b/src/onebusaway/types/stops_for_location_retrieve_params.py deleted file mode 100644 index b5c1ba6..0000000 --- a/src/onebusaway/types/stops_for_location_retrieve_params.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["StopsForLocationRetrieveParams"] - - -class StopsForLocationRetrieveParams(TypedDict, total=False): - lat: float - - lon: float diff --git a/src/onebusaway/types/stops_for_route_list_params.py b/src/onebusaway/types/stops_for_route_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/stops_for_route_list_response.py b/src/onebusaway/types/stops_for_route_list_response.py old mode 100644 new mode 100755 index 2aa1644..53cff4e --- a/src/onebusaway/types/stops_for_route_list_response.py +++ b/src/onebusaway/types/stops_for_route_list_response.py @@ -66,9 +66,9 @@ class StopsForRouteListResponseDataEntry(BaseModel): class StopsForRouteListResponseData(BaseModel): - entry: Optional[StopsForRouteListResponseDataEntry] = None + entry: StopsForRouteListResponseDataEntry - references: Optional[References] = None + references: References class StopsForRouteListResponse(ResponseWrapper): diff --git a/src/onebusaway/types/trip_detail_retrieve_params.py b/src/onebusaway/types/trip_detail_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trip_detail_retrieve_response.py b/src/onebusaway/types/trip_detail_retrieve_response.py old mode 100644 new mode 100755 index d750fe0..4b76689 --- a/src/onebusaway/types/trip_detail_retrieve_response.py +++ b/src/onebusaway/types/trip_detail_retrieve_response.py @@ -35,17 +35,15 @@ class TripDetailRetrieveResponseDataEntryScheduleStopTime(BaseModel): class TripDetailRetrieveResponseDataEntrySchedule(BaseModel): - frequency: Optional[str] = None + next_trip_id: str = FieldInfo(alias="nextTripId") - next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + previous_trip_id: str = FieldInfo(alias="previousTripId") - previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + stop_times: List[TripDetailRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias="stopTimes") - stop_times: Optional[List[TripDetailRetrieveResponseDataEntryScheduleStopTime]] = FieldInfo( - alias="stopTimes", default=None - ) + time_zone: str = FieldInfo(alias="timeZone") - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + frequency: Optional[str] = None class TripDetailRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): @@ -65,33 +63,69 @@ class TripDetailRetrieveResponseDataEntryStatusPosition(BaseModel): class TripDetailRetrieveResponseDataEntryStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + 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). """ - 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[TripDetailRetrieveResponseDataEntryStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) @@ -100,12 +134,6 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): 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.""" @@ -115,56 +143,28 @@ class TripDetailRetrieveResponseDataEntryStatus(BaseModel): (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[TripDetailRetrieveResponseDataEntryStatusPosition] = 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 TripDetailRetrieveResponseDataEntry(BaseModel): + trip_id: str = FieldInfo(alias="tripId") + frequency: Optional[str] = None schedule: Optional[TripDetailRetrieveResponseDataEntrySchedule] = None @@ -175,8 +175,6 @@ class TripDetailRetrieveResponseDataEntry(BaseModel): status: Optional[TripDetailRetrieveResponseDataEntryStatus] = None - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - class TripDetailRetrieveResponseData(BaseModel): entry: TripDetailRetrieveResponseDataEntry diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_params.py b/src/onebusaway/types/trip_for_vehicle_retrieve_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py old mode 100644 new mode 100755 index 42fa05e..136b96c --- a/src/onebusaway/types/trip_for_vehicle_retrieve_response.py +++ b/src/onebusaway/types/trip_for_vehicle_retrieve_response.py @@ -35,17 +35,15 @@ class TripForVehicleRetrieveResponseDataEntryScheduleStopTime(BaseModel): class TripForVehicleRetrieveResponseDataEntrySchedule(BaseModel): - frequency: Optional[str] = None + next_trip_id: str = FieldInfo(alias="nextTripId") - next_trip_id: Optional[str] = FieldInfo(alias="nextTripId", default=None) + previous_trip_id: str = FieldInfo(alias="previousTripId") - previous_trip_id: Optional[str] = FieldInfo(alias="previousTripId", default=None) + stop_times: List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime] = FieldInfo(alias="stopTimes") - stop_times: Optional[List[TripForVehicleRetrieveResponseDataEntryScheduleStopTime]] = FieldInfo( - alias="stopTimes", default=None - ) + time_zone: str = FieldInfo(alias="timeZone") - time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) + frequency: Optional[str] = None class TripForVehicleRetrieveResponseDataEntryStatusLastKnownLocation(BaseModel): @@ -65,33 +63,69 @@ class TripForVehicleRetrieveResponseDataEntryStatusPosition(BaseModel): class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + 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). """ - 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 ) @@ -100,12 +134,6 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): 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.""" @@ -115,56 +143,28 @@ class TripForVehicleRetrieveResponseDataEntryStatus(BaseModel): (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): + trip_id: str = FieldInfo(alias="tripId") + frequency: Optional[str] = None schedule: Optional[TripForVehicleRetrieveResponseDataEntrySchedule] = None @@ -175,8 +175,6 @@ class TripForVehicleRetrieveResponseDataEntry(BaseModel): status: Optional[TripForVehicleRetrieveResponseDataEntryStatus] = None - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - class TripForVehicleRetrieveResponseData(BaseModel): entry: TripForVehicleRetrieveResponseDataEntry diff --git a/src/onebusaway/types/trip_retrieve_response.py b/src/onebusaway/types/trip_retrieve_response.py old mode 100644 new mode 100755 index e939f2f..152bfa2 --- a/src/onebusaway/types/trip_retrieve_response.py +++ b/src/onebusaway/types/trip_retrieve_response.py @@ -16,6 +16,8 @@ class TripRetrieveResponseDataEntry(BaseModel): route_id: str = FieldInfo(alias="routeId") + service_id: str = FieldInfo(alias="serviceId") + block_id: Optional[str] = FieldInfo(alias="blockId", default=None) direction_id: Optional[str] = FieldInfo(alias="directionId", default=None) @@ -24,8 +26,6 @@ class TripRetrieveResponseDataEntry(BaseModel): route_short_name: Optional[str] = FieldInfo(alias="routeShortName", default=None) - service_id: Optional[str] = FieldInfo(alias="serviceId", default=None) - shape_id: Optional[str] = FieldInfo(alias="shapeId", default=None) time_zone: Optional[str] = FieldInfo(alias="timeZone", default=None) diff --git a/src/onebusaway/types/trips_for_location_retrieve_params.py b/src/onebusaway/types/trips_for_location_list_params.py old mode 100644 new mode 100755 similarity index 90% rename from src/onebusaway/types/trips_for_location_retrieve_params.py rename to src/onebusaway/types/trips_for_location_list_params.py index 341a0fd..69a9186 --- a/src/onebusaway/types/trips_for_location_retrieve_params.py +++ b/src/onebusaway/types/trips_for_location_list_params.py @@ -6,10 +6,10 @@ from .._utils import PropertyInfo -__all__ = ["TripsForLocationRetrieveParams"] +__all__ = ["TripsForLocationListParams"] -class TripsForLocationRetrieveParams(TypedDict, total=False): +class TripsForLocationListParams(TypedDict, total=False): lat: Required[float] """The latitude coordinate of the search center""" diff --git a/src/onebusaway/types/trips_for_location_list_response.py b/src/onebusaway/types/trips_for_location_list_response.py new file mode 100755 index 0000000..68ae881 --- /dev/null +++ b/src/onebusaway/types/trips_for_location_list_response.py @@ -0,0 +1,192 @@ +# 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__ = [ + "TripsForLocationListResponse", + "TripsForLocationListResponseData", + "TripsForLocationListResponseDataList", + "TripsForLocationListResponseDataListSchedule", + "TripsForLocationListResponseDataListScheduleStopTime", + "TripsForLocationListResponseDataListStatus", + "TripsForLocationListResponseDataListStatusLastKnownLocation", + "TripsForLocationListResponseDataListStatusPosition", +] + + +class TripsForLocationListResponseDataListScheduleStopTime(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 TripsForLocationListResponseDataListSchedule(BaseModel): + next_trip_id: str = FieldInfo(alias="nextTripId") + + previous_trip_id: str = FieldInfo(alias="previousTripId") + + stop_times: List[TripsForLocationListResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") + + time_zone: str = FieldInfo(alias="timeZone") + + frequency: Optional[str] = None + + +class TripsForLocationListResponseDataListStatusLastKnownLocation(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 TripsForLocationListResponseDataListStatusPosition(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 TripsForLocationListResponseDataListStatus(BaseModel): + 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[TripsForLocationListResponseDataListStatusLastKnownLocation] = 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.""" + + 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[TripsForLocationListResponseDataListStatusPosition] = 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 TripsForLocationListResponseDataList(BaseModel): + schedule: TripsForLocationListResponseDataListSchedule + + status: TripsForLocationListResponseDataListStatus + + trip_id: str = FieldInfo(alias="tripId") + + frequency: Optional[str] = None + + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + + +class TripsForLocationListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + """Indicates if the limit of trips has been exceeded""" + + list: List[TripsForLocationListResponseDataList] + + references: References + + out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) + """Indicates if the search location is out of range""" + + +class TripsForLocationListResponse(ResponseWrapper): + data: TripsForLocationListResponseData diff --git a/src/onebusaway/types/trips_for_location_retrieve_response.py b/src/onebusaway/types/trips_for_location_retrieve_response.py deleted file mode 100644 index 0864e6d..0000000 --- a/src/onebusaway/types/trips_for_location_retrieve_response.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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__ = [ - "TripsForLocationRetrieveResponse", - "TripsForLocationRetrieveResponseData", - "TripsForLocationRetrieveResponseDataList", -] - - -class TripsForLocationRetrieveResponseDataList(BaseModel): - frequency: Optional[str] = None - - service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) - - situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) - - trip_id: Optional[str] = FieldInfo(alias="tripId", default=None) - - -class TripsForLocationRetrieveResponseData(BaseModel): - list: List[TripsForLocationRetrieveResponseDataList] - - references: References - - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - """Indicates if the limit of trips has been exceeded""" - - out_of_range: Optional[bool] = FieldInfo(alias="outOfRange", default=None) - """Indicates if the search location is out of range""" - - -class TripsForLocationRetrieveResponse(ResponseWrapper): - data: TripsForLocationRetrieveResponseData diff --git a/src/onebusaway/types/trips_for_route_list_params.py b/src/onebusaway/types/trips_for_route_list_params.py new file mode 100755 index 0000000..c2f7ec0 --- /dev/null +++ b/src/onebusaway/types/trips_for_route_list_params.py @@ -0,0 +1,23 @@ +# 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__ = ["TripsForRouteListParams"] + + +class TripsForRouteListParams(TypedDict, total=False): + include_schedule: Annotated[bool, PropertyInfo(alias="includeSchedule")] + """Determine whether full schedule elements are included. Defaults to false.""" + + include_status: Annotated[bool, PropertyInfo(alias="includeStatus")] + """ + Determine whether full tripStatus elements with real-time information are + included. Defaults to false. + """ + + time: int + """Query the system at a specific time. Useful for testing.""" diff --git a/src/onebusaway/types/trips_for_route_list_response.py b/src/onebusaway/types/trips_for_route_list_response.py new file mode 100755 index 0000000..f9bc2d8 --- /dev/null +++ b/src/onebusaway/types/trips_for_route_list_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__ = [ + "TripsForRouteListResponse", + "TripsForRouteListResponseData", + "TripsForRouteListResponseDataList", + "TripsForRouteListResponseDataListSchedule", + "TripsForRouteListResponseDataListScheduleStopTime", + "TripsForRouteListResponseDataListStatus", + "TripsForRouteListResponseDataListStatusLastKnownLocation", + "TripsForRouteListResponseDataListStatusPosition", +] + + +class TripsForRouteListResponseDataListScheduleStopTime(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 TripsForRouteListResponseDataListSchedule(BaseModel): + next_trip_id: str = FieldInfo(alias="nextTripId") + + previous_trip_id: str = FieldInfo(alias="previousTripId") + + stop_times: List[TripsForRouteListResponseDataListScheduleStopTime] = FieldInfo(alias="stopTimes") + + time_zone: str = FieldInfo(alias="timeZone") + + frequency: Optional[str] = None + + +class TripsForRouteListResponseDataListStatusLastKnownLocation(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 TripsForRouteListResponseDataListStatusPosition(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 TripsForRouteListResponseDataListStatus(BaseModel): + 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[TripsForRouteListResponseDataListStatusLastKnownLocation] = 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.""" + + 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[TripsForRouteListResponseDataListStatusPosition] = 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 TripsForRouteListResponseDataList(BaseModel): + schedule: TripsForRouteListResponseDataListSchedule + + status: TripsForRouteListResponseDataListStatus + + trip_id: str = FieldInfo(alias="tripId") + + frequency: Optional[str] = None + + service_date: Optional[int] = FieldInfo(alias="serviceDate", default=None) + + situation_ids: Optional[List[str]] = FieldInfo(alias="situationIds", default=None) + + +class TripsForRouteListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + + list: List[TripsForRouteListResponseDataList] + + references: References + + +class TripsForRouteListResponse(ResponseWrapper): + data: TripsForRouteListResponseData diff --git a/src/onebusaway/types/vehicles_for_agency_list_params.py b/src/onebusaway/types/vehicles_for_agency_list_params.py old mode 100644 new mode 100755 diff --git a/src/onebusaway/types/vehicles_for_agency_list_response.py b/src/onebusaway/types/vehicles_for_agency_list_response.py old mode 100644 new mode 100755 index 8675eda..34601dd --- a/src/onebusaway/types/vehicles_for_agency_list_response.py +++ b/src/onebusaway/types/vehicles_for_agency_list_response.py @@ -42,33 +42,69 @@ class VehiclesForAgencyListResponseDataListTripStatusPosition(BaseModel): class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): - active_trip_id: Optional[str] = FieldInfo(alias="activeTripId", default=None) + active_trip_id: str = FieldInfo(alias="activeTripId") """Trip ID of the trip the vehicle is actively serving.""" - block_trip_sequence: Optional[int] = FieldInfo(alias="blockTripSequence", default=None) + block_trip_sequence: int = FieldInfo(alias="blockTripSequence") """Index of the active trip into the sequence of trips for the active block.""" - closest_stop: Optional[str] = FieldInfo(alias="closestStop", default=None) + 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). """ - 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[VehiclesForAgencyListResponseDataListTripStatusLastKnownLocation] = FieldInfo( alias="lastKnownLocation", default=None ) @@ -77,12 +113,6 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): 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.""" @@ -92,51 +122,21 @@ class VehiclesForAgencyListResponseDataListTripStatus(BaseModel): (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[VehiclesForAgencyListResponseDataListTripStatusPosition] = 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.""" @@ -166,12 +166,12 @@ class VehiclesForAgencyListResponseDataList(BaseModel): class VehiclesForAgencyListResponseData(BaseModel): + limit_exceeded: bool = FieldInfo(alias="limitExceeded") + list: List[VehiclesForAgencyListResponseDataList] references: References - limit_exceeded: Optional[bool] = FieldInfo(alias="limitExceeded", default=None) - class VehiclesForAgencyListResponse(ResponseWrapper): data: VehiclesForAgencyListResponseData diff --git a/src/open_transit/lib/.keep b/src/open_transit/lib/.keep old mode 100644 new mode 100755 diff --git a/tests/__init__.py b/tests/__init__.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/__init__.py b/tests/api_resources/__init__.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_agencies_with_coverage.py b/tests/api_resources/test_agencies_with_coverage.py old mode 100644 new mode 100755 index fd96982..fad1087 --- a/tests/api_resources/test_agencies_with_coverage.py +++ b/tests/api_resources/test_agencies_with_coverage.py @@ -9,7 +9,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import AgenciesWithCoverageRetrieveResponse +from onebusaway.types import AgenciesWithCoverageListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,27 +18,27 @@ class TestAgenciesWithCoverage: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - agencies_with_coverage = client.agencies_with_coverage.retrieve() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) + def test_method_list(self, client: OnebusawaySDK) -> None: + agencies_with_coverage = client.agencies_with_coverage.list() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.agencies_with_coverage.with_raw_response.retrieve() + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.agencies_with_coverage.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" agencies_with_coverage = response.parse() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.agencies_with_coverage.with_streaming_response.retrieve() as response: + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.agencies_with_coverage.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" agencies_with_coverage = response.parse() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) assert cast(Any, response.is_closed) is True @@ -47,26 +47,26 @@ class TestAsyncAgenciesWithCoverage: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - agencies_with_coverage = await async_client.agencies_with_coverage.retrieve() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + agencies_with_coverage = await async_client.agencies_with_coverage.list() + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.agencies_with_coverage.with_raw_response.retrieve() + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.agencies_with_coverage.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" agencies_with_coverage = await response.parse() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.agencies_with_coverage.with_streaming_response.retrieve() as response: + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.agencies_with_coverage.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" agencies_with_coverage = await response.parse() - assert_matches_type(AgenciesWithCoverageRetrieveResponse, agencies_with_coverage, path=["response"]) + assert_matches_type(AgenciesWithCoverageListResponse, agencies_with_coverage, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_agency.py b/tests/api_resources/test_agency.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_arrival_and_departure.py b/tests/api_resources/test_arrival_and_departure.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_block.py b/tests/api_resources/test_block.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_config.py b/tests/api_resources/test_config.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_current_time.py b/tests/api_resources/test_current_time.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_report_problem_with_stop.py b/tests/api_resources/test_report_problem_with_stop.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_report_problem_with_trip.py b/tests/api_resources/test_report_problem_with_trip.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_route.py b/tests/api_resources/test_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_route_ids_for_agency.py b/tests/api_resources/test_route_ids_for_agency.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_routes_for_agency.py b/tests/api_resources/test_routes_for_agency.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_routes_for_location.py b/tests/api_resources/test_routes_for_location.py old mode 100644 new mode 100755 index 2e091e6..55fbc31 --- a/tests/api_resources/test_routes_for_location.py +++ b/tests/api_resources/test_routes_for_location.py @@ -9,7 +9,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import RoutesForLocationRetrieveResponse +from onebusaway.types import RoutesForLocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,16 +18,16 @@ class TestRoutesForLocation: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - routes_for_location = client.routes_for_location.retrieve( + def test_method_list(self, client: OnebusawaySDK) -> None: + routes_for_location = client.routes_for_location.list( lat=0, lon=0, ) - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: - routes_for_location = client.routes_for_location.retrieve( + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + routes_for_location = client.routes_for_location.list( lat=0, lon=0, lat_span=0, @@ -35,11 +35,11 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: query="query", radius=0, ) - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.routes_for_location.with_raw_response.retrieve( + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.routes_for_location.with_raw_response.list( lat=0, lon=0, ) @@ -47,11 +47,11 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = response.parse() - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.routes_for_location.with_streaming_response.retrieve( + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.routes_for_location.with_streaming_response.list( lat=0, lon=0, ) as response: @@ -59,7 +59,7 @@ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = response.parse() - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -68,16 +68,16 @@ class TestAsyncRoutesForLocation: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - routes_for_location = await async_client.routes_for_location.retrieve( + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + routes_for_location = await async_client.routes_for_location.list( lat=0, lon=0, ) - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: - routes_for_location = await async_client.routes_for_location.retrieve( + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + routes_for_location = await async_client.routes_for_location.list( lat=0, lon=0, lat_span=0, @@ -85,11 +85,11 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw query="query", radius=0, ) - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.routes_for_location.with_raw_response.retrieve( + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.routes_for_location.with_raw_response.list( lat=0, lon=0, ) @@ -97,11 +97,11 @@ async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = await response.parse() - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.routes_for_location.with_streaming_response.retrieve( + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.routes_for_location.with_streaming_response.list( lat=0, lon=0, ) as response: @@ -109,6 +109,6 @@ async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySD assert response.http_request.headers.get("X-Stainless-Lang") == "python" routes_for_location = await response.parse() - assert_matches_type(RoutesForLocationRetrieveResponse, routes_for_location, path=["response"]) + assert_matches_type(RoutesForLocationListResponse, routes_for_location, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_schedule_for_route.py b/tests/api_resources/test_schedule_for_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_schedule_for_stop.py b/tests/api_resources/test_schedule_for_stop.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_search_for_route.py b/tests/api_resources/test_search_for_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_search_for_stop.py b/tests/api_resources/test_search_for_stop.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_shape.py b/tests/api_resources/test_shape.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_stop.py b/tests/api_resources/test_stop.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_stop_ids_for_agency.py b/tests/api_resources/test_stop_ids_for_agency.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_stops_for_location.py b/tests/api_resources/test_stops_for_location.py old mode 100644 new mode 100755 index d1abaeb..fcb2f07 --- a/tests/api_resources/test_stops_for_location.py +++ b/tests/api_resources/test_stops_for_location.py @@ -9,7 +9,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import StopsForLocationRetrieveResponse +from onebusaway.types import StopsForLocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,35 +18,48 @@ class TestStopsForLocation: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - stops_for_location = client.stops_for_location.retrieve() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + def test_method_list(self, client: OnebusawaySDK) -> None: + stops_for_location = client.stops_for_location.list( + lat=0, + lon=0, + ) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: - stops_for_location = client.stops_for_location.retrieve( + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + stops_for_location = client.stops_for_location.list( lat=0, lon=0, + lat_span=0, + lon_span=0, + query="query", + radius=0, ) - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.stops_for_location.with_raw_response.retrieve() + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.stops_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" stops_for_location = response.parse() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.stops_for_location.with_streaming_response.retrieve() as response: + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.stops_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" stops_for_location = response.parse() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -55,34 +68,47 @@ class TestAsyncStopsForLocation: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - stops_for_location = await async_client.stops_for_location.retrieve() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + stops_for_location = await async_client.stops_for_location.list( + lat=0, + lon=0, + ) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: - stops_for_location = await async_client.stops_for_location.retrieve( + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + stops_for_location = await async_client.stops_for_location.list( lat=0, lon=0, + lat_span=0, + lon_span=0, + query="query", + radius=0, ) - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.stops_for_location.with_raw_response.retrieve() + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.stops_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" stops_for_location = await response.parse() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.stops_for_location.with_streaming_response.retrieve() as response: + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.stops_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" stops_for_location = await response.parse() - assert_matches_type(StopsForLocationRetrieveResponse, stops_for_location, path=["response"]) + assert_matches_type(StopsForLocationListResponse, stops_for_location, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_stops_for_route.py b/tests/api_resources/test_stops_for_route.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trip.py b/tests/api_resources/test_trip.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trip_details.py b/tests/api_resources/test_trip_details.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trip_for_vehicle.py b/tests/api_resources/test_trip_for_vehicle.py old mode 100644 new mode 100755 diff --git a/tests/api_resources/test_trips_for_location.py b/tests/api_resources/test_trips_for_location.py old mode 100644 new mode 100755 index 439faca..050d552 --- a/tests/api_resources/test_trips_for_location.py +++ b/tests/api_resources/test_trips_for_location.py @@ -9,7 +9,7 @@ from onebusaway import OnebusawaySDK, AsyncOnebusawaySDK from tests.utils import assert_matches_type -from onebusaway.types import TripsForLocationRetrieveResponse +from onebusaway.types import TripsForLocationListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,18 +18,18 @@ class TestTripsForLocation: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve(self, client: OnebusawaySDK) -> None: - trips_for_location = client.trips_for_location.retrieve( + def test_method_list(self, client: OnebusawaySDK) -> None: + trips_for_location = client.trips_for_location.list( lat=0, lat_span=0, lon=0, lon_span=0, ) - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: - trips_for_location = client.trips_for_location.retrieve( + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + trips_for_location = client.trips_for_location.list( lat=0, lat_span=0, lon=0, @@ -38,11 +38,11 @@ def test_method_retrieve_with_all_params(self, client: OnebusawaySDK) -> None: include_trip=True, time=0, ) - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: - response = client.trips_for_location.with_raw_response.retrieve( + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.trips_for_location.with_raw_response.list( lat=0, lat_span=0, lon=0, @@ -52,11 +52,11 @@ def test_raw_response_retrieve(self, client: OnebusawaySDK) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = response.parse() - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: - with client.trips_for_location.with_streaming_response.retrieve( + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.trips_for_location.with_streaming_response.list( lat=0, lat_span=0, lon=0, @@ -66,7 +66,7 @@ def test_streaming_response_retrieve(self, client: OnebusawaySDK) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = response.parse() - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,18 +75,18 @@ class TestAsyncTripsForLocation: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - async def test_method_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - trips_for_location = await async_client.trips_for_location.retrieve( + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + trips_for_location = await async_client.trips_for_location.list( lat=0, lat_span=0, lon=0, lon_span=0, ) - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: - trips_for_location = await async_client.trips_for_location.retrieve( + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + trips_for_location = await async_client.trips_for_location.list( lat=0, lat_span=0, lon=0, @@ -95,11 +95,11 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncOnebusaw include_trip=True, time=0, ) - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - response = await async_client.trips_for_location.with_raw_response.retrieve( + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trips_for_location.with_raw_response.list( lat=0, lat_span=0, lon=0, @@ -109,11 +109,11 @@ async def test_raw_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = await response.parse() - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySDK) -> None: - async with async_client.trips_for_location.with_streaming_response.retrieve( + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.trips_for_location.with_streaming_response.list( lat=0, lat_span=0, lon=0, @@ -123,6 +123,6 @@ async def test_streaming_response_retrieve(self, async_client: AsyncOnebusawaySD assert response.http_request.headers.get("X-Stainless-Lang") == "python" trips_for_location = await response.parse() - assert_matches_type(TripsForLocationRetrieveResponse, trips_for_location, path=["response"]) + assert_matches_type(TripsForLocationListResponse, trips_for_location, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_trips_for_route.py b/tests/api_resources/test_trips_for_route.py new file mode 100755 index 0000000..0ef4092 --- /dev/null +++ b/tests/api_resources/test_trips_for_route.py @@ -0,0 +1,118 @@ +# 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 TripsForRouteListResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestTripsForRoute: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_list(self, client: OnebusawaySDK) -> None: + trips_for_route = client.trips_for_route.list( + route_id="routeID", + ) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: OnebusawaySDK) -> None: + trips_for_route = client.trips_for_route.list( + route_id="routeID", + include_schedule=True, + include_status=True, + time=0, + ) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: OnebusawaySDK) -> None: + response = client.trips_for_route.with_raw_response.list( + route_id="routeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trips_for_route = response.parse() + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: OnebusawaySDK) -> None: + with client.trips_for_route.with_streaming_response.list( + route_id="routeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trips_for_route = response.parse() + assert_matches_type(TripsForRouteListResponse, trips_for_route, 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 `route_id` but received ''"): + client.trips_for_route.with_raw_response.list( + route_id="", + ) + + +class TestAsyncTripsForRoute: + parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + async def test_method_list(self, async_client: AsyncOnebusawaySDK) -> None: + trips_for_route = await async_client.trips_for_route.list( + route_id="routeID", + ) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncOnebusawaySDK) -> None: + trips_for_route = await async_client.trips_for_route.list( + route_id="routeID", + include_schedule=True, + include_status=True, + time=0, + ) + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + response = await async_client.trips_for_route.with_raw_response.list( + route_id="routeID", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + trips_for_route = await response.parse() + assert_matches_type(TripsForRouteListResponse, trips_for_route, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncOnebusawaySDK) -> None: + async with async_client.trips_for_route.with_streaming_response.list( + route_id="routeID", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + trips_for_route = await response.parse() + assert_matches_type(TripsForRouteListResponse, trips_for_route, 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 `route_id` but received ''"): + await async_client.trips_for_route.with_raw_response.list( + route_id="", + ) diff --git a/tests/api_resources/test_vehicles_for_agency.py b/tests/api_resources/test_vehicles_for_agency.py old mode 100644 new mode 100755 diff --git a/tests/conftest.py b/tests/conftest.py old mode 100644 new mode 100755 diff --git a/tests/sample_file.txt b/tests/sample_file.txt old mode 100644 new mode 100755 diff --git a/tests/test_client.py b/tests/test_client.py old mode 100644 new mode 100755 index a68fac1..abc4d37 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -2,13 +2,12 @@ from __future__ import annotations -# import gc +import gc import os import json import asyncio import inspect - -# import tracemalloc +import tracemalloc from typing import Any, Union, cast from unittest import mock @@ -185,67 +184,67 @@ def test_copy_signature(self) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" - # def test_copy_build_request(self) -> None: - # options = FinalRequestOptions(method="get", url="/foo") - - # def build_request(options: FinalRequestOptions) -> None: - # client = self.client.copy() - # client._build_request(options) - - # # ensure that the machinery is warmed up before tracing starts. - # build_request(options) - # gc.collect() - - # tracemalloc.start(1000) - - # snapshot_before = tracemalloc.take_snapshot() - - # ITERATIONS = 10 - # for _ in range(ITERATIONS): - # build_request(options) - - # gc.collect() - # snapshot_after = tracemalloc.take_snapshot() - - # tracemalloc.stop() - - # def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: - # if diff.count == 0: - # # Avoid false positives by considering only leaks (i.e. allocations that persist). - # return - - # if diff.count % ITERATIONS != 0: - # # Avoid false positives by considering only leaks that appear per iteration. - # return - - # for frame in diff.traceback: - # if any( - # frame.filename.endswith(fragment) - # for fragment in [ - # # to_raw_response_wrapper leaks through the @functools.wraps() decorator. - # # - # # removing the decorator fixes the leak for reasons we don't understand. - # "onebusaway/_legacy_response.py", - # "onebusaway/_response.py", - # # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - # "onebusaway/_compat.py", - # # Standard library leaks we don't care about. - # "/logging/__init__.py", - # ] - # ): - # return - - # leaks.append(diff) - - # leaks: list[tracemalloc.StatisticDiff] = [] - # for diff in snapshot_after.compare_to(snapshot_before, "traceback"): - # add_leak(leaks, diff) - # if leaks: - # for leak in leaks: - # print("MEMORY LEAK:", leak) - # for frame in leak.traceback: - # print(frame) - # raise AssertionError() + def test_copy_build_request(self) -> None: + options = FinalRequestOptions(method="get", url="/foo") + + def build_request(options: FinalRequestOptions) -> None: + client = self.client.copy() + client._build_request(options) + + # ensure that the machinery is warmed up before tracing starts. + build_request(options) + gc.collect() + + tracemalloc.start(1000) + + snapshot_before = tracemalloc.take_snapshot() + + ITERATIONS = 10 + for _ in range(ITERATIONS): + build_request(options) + + gc.collect() + snapshot_after = tracemalloc.take_snapshot() + + tracemalloc.stop() + + def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: + if diff.count == 0: + # Avoid false positives by considering only leaks (i.e. allocations that persist). + return + + if diff.count % ITERATIONS != 0: + # Avoid false positives by considering only leaks that appear per iteration. + return + + for frame in diff.traceback: + if any( + frame.filename.endswith(fragment) + for fragment in [ + # to_raw_response_wrapper leaks through the @functools.wraps() decorator. + # + # removing the decorator fixes the leak for reasons we don't understand. + "onebusaway/_legacy_response.py", + "onebusaway/_response.py", + # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. + "onebusaway/_compat.py", + # Standard library leaks we don't care about. + "/logging/__init__.py", + ] + ): + return + + leaks.append(diff) + + leaks: list[tracemalloc.StatisticDiff] = [] + for diff in snapshot_after.compare_to(snapshot_before, "traceback"): + add_leak(leaks, diff) + if leaks: + for leak in leaks: + print("MEMORY LEAK:", leak) + for frame in leak.traceback: + print(frame) + raise AssertionError() def test_request_timeout(self) -> None: request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) @@ -891,67 +890,67 @@ def test_copy_signature(self) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" - # def test_copy_build_request(self) -> None: - # options = FinalRequestOptions(method="get", url="/foo") - - # def build_request(options: FinalRequestOptions) -> None: - # client = self.client.copy() - # client._build_request(options) - - # ensure that the machinery is warmed up before tracing starts. - # build_request(options) - # gc.collect() - - # tracemalloc.start(1000) - - # snapshot_before = tracemalloc.take_snapshot() - - # ITERATIONS = 10 - # for _ in range(ITERATIONS): - # build_request(options) - - # gc.collect() - # snapshot_after = tracemalloc.take_snapshot() - - # tracemalloc.stop() - - # def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: - # if diff.count == 0: - # Avoid false positives by considering only leaks (i.e. allocations that persist). - # return - - # if diff.count % ITERATIONS != 0: - # Avoid false positives by considering only leaks that appear per iteration. - # return - - # for frame in diff.traceback: - # if any( - # frame.filename.endswith(fragment) - # for fragment in [ - # to_raw_response_wrapper leaks through the @functools.wraps() decorator. - - # removing the decorator fixes the leak for reasons we don't understand. - # "onebusaway/_legacy_response.py", - # "onebusaway/_response.py", - # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - # "onebusaway/_compat.py", - # Standard library leaks we don't care about. - # "/logging/__init__.py", - # ] - # ): - # return - - # leaks.append(diff) - - # leaks: list[tracemalloc.StatisticDiff] = [] - # for diff in snapshot_after.compare_to(snapshot_before, "traceback"): - # add_leak(leaks, diff) - # if leaks: - # for leak in leaks: - # print("MEMORY LEAK:", leak) - # for frame in leak.traceback: - # print(frame) - # raise AssertionError() + def test_copy_build_request(self) -> None: + options = FinalRequestOptions(method="get", url="/foo") + + def build_request(options: FinalRequestOptions) -> None: + client = self.client.copy() + client._build_request(options) + + # ensure that the machinery is warmed up before tracing starts. + build_request(options) + gc.collect() + + tracemalloc.start(1000) + + snapshot_before = tracemalloc.take_snapshot() + + ITERATIONS = 10 + for _ in range(ITERATIONS): + build_request(options) + + gc.collect() + snapshot_after = tracemalloc.take_snapshot() + + tracemalloc.stop() + + def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.StatisticDiff) -> None: + if diff.count == 0: + # Avoid false positives by considering only leaks (i.e. allocations that persist). + return + + if diff.count % ITERATIONS != 0: + # Avoid false positives by considering only leaks that appear per iteration. + return + + for frame in diff.traceback: + if any( + frame.filename.endswith(fragment) + for fragment in [ + # to_raw_response_wrapper leaks through the @functools.wraps() decorator. + + # removing the decorator fixes the leak for reasons we don't understand. + "onebusaway/_legacy_response.py", + "onebusaway/_response.py", + # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. + "onebusaway/_compat.py", + # Standard library leaks we don't care about. + "/logging/__init__.py", + ] + ): + return + + leaks.append(diff) + + leaks: list[tracemalloc.StatisticDiff] = [] + for diff in snapshot_after.compare_to(snapshot_before, "traceback"): + add_leak(leaks, diff) + if leaks: + for leak in leaks: + print("MEMORY LEAK:", leak) + for frame in leak.traceback: + print(frame) + raise AssertionError() async def test_request_timeout(self) -> None: request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py old mode 100644 new mode 100755 diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py old mode 100644 new mode 100755 diff --git a/tests/test_files.py b/tests/test_files.py old mode 100644 new mode 100755 diff --git a/tests/test_models.py b/tests/test_models.py old mode 100644 new mode 100755 diff --git a/tests/test_qs.py b/tests/test_qs.py old mode 100644 new mode 100755 diff --git a/tests/test_required_args.py b/tests/test_required_args.py old mode 100644 new mode 100755 diff --git a/tests/test_response.py b/tests/test_response.py old mode 100644 new mode 100755 index df94f16..3d799b5 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -1,5 +1,5 @@ import json -from typing import List, cast +from typing import Any, List, Union, cast from typing_extensions import Annotated import httpx @@ -188,3 +188,40 @@ async def test_async_response_parse_annotated_type(async_client: AsyncOnebusaway ) assert obj.foo == "hello!" assert obj.bar == 2 + + +class OtherModel(BaseModel): + a: str + + +@pytest.mark.parametrize("client", [False], indirect=True) # loose validation +def test_response_parse_expect_model_union_non_json_content(client: OnebusawaySDK) -> None: + response = APIResponse( + raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = response.parse(to=cast(Any, Union[CustomModel, OtherModel])) + assert isinstance(obj, str) + assert obj == "foo" + + +@pytest.mark.asyncio +@pytest.mark.parametrize("async_client", [False], indirect=True) # loose validation +async def test_async_response_parse_expect_model_union_non_json_content(async_client: AsyncOnebusawaySDK) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), + client=async_client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = await response.parse(to=cast(Any, Union[CustomModel, OtherModel])) + assert isinstance(obj, str) + assert obj == "foo" diff --git a/tests/test_streaming.py b/tests/test_streaming.py old mode 100644 new mode 100755 diff --git a/tests/test_transform.py b/tests/test_transform.py old mode 100644 new mode 100755 diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py old mode 100644 new mode 100755 diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py old mode 100644 new mode 100755 diff --git a/tests/utils.py b/tests/utils.py old mode 100644 new mode 100755