Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-ac10a054ead5e711bd033b417891c1769d631135029ca5bd91e6584420403ee2.yml
configured_endpoints: 16
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/open-transit%2Fopen-transit-92606a4bcfb26210a95a7f86b55fb258977f97c375cd3b1f6035ed81a53f2e2c.yml
12 changes: 12 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ Methods:

- <code title="get /api/where/agency/{agencyID}.json">client.agency.<a href="./src/onebusaway/resources/agency.py">retrieve</a>(agency_id) -> <a href="./src/onebusaway/types/agency_retrieve_response.py">AgencyRetrieveResponse</a></code>

# VehiclesForAgency

Types:

```python
from onebusaway.types import VehiclesForAgencyListResponse
```

Methods:

- <code title="get /api/where/vehicles-for-agency/{agencyID}.json">client.vehicles_for_agency.<a href="./src/onebusaway/resources/vehicles_for_agency.py">list</a>(agency_id, \*\*<a href="src/onebusaway/types/vehicles_for_agency_list_params.py">params</a>) -> <a href="./src/onebusaway/types/vehicles_for_agency_list_response.py">VehiclesForAgencyListResponse</a></code>

# Config

Types:
Expand Down
10 changes: 10 additions & 0 deletions src/onebusaway/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
class OnebusawaySDK(SyncAPIClient):
agencies_with_coverage: resources.AgenciesWithCoverageResource
agency: resources.AgencyResource
vehicles_for_agency: resources.VehiclesForAgencyResource
config: resources.ConfigResource
current_time: resources.CurrentTimeResource
stops_for_location: resources.StopsForLocationResource
Expand Down Expand Up @@ -119,6 +120,7 @@ def __init__(

self.agencies_with_coverage = resources.AgenciesWithCoverageResource(self)
self.agency = resources.AgencyResource(self)
self.vehicles_for_agency = resources.VehiclesForAgencyResource(self)
self.config = resources.ConfigResource(self)
self.current_time = resources.CurrentTimeResource(self)
self.stops_for_location = resources.StopsForLocationResource(self)
Expand Down Expand Up @@ -249,6 +251,7 @@ def _make_status_error(
class AsyncOnebusawaySDK(AsyncAPIClient):
agencies_with_coverage: resources.AsyncAgenciesWithCoverageResource
agency: resources.AsyncAgencyResource
vehicles_for_agency: resources.AsyncVehiclesForAgencyResource
config: resources.AsyncConfigResource
current_time: resources.AsyncCurrentTimeResource
stops_for_location: resources.AsyncStopsForLocationResource
Expand Down Expand Up @@ -320,6 +323,7 @@ def __init__(

self.agencies_with_coverage = resources.AsyncAgenciesWithCoverageResource(self)
self.agency = resources.AsyncAgencyResource(self)
self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResource(self)
self.config = resources.AsyncConfigResource(self)
self.current_time = resources.AsyncCurrentTimeResource(self)
self.stops_for_location = resources.AsyncStopsForLocationResource(self)
Expand Down Expand Up @@ -453,6 +457,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
client.agencies_with_coverage
)
self.agency = resources.AgencyResourceWithRawResponse(client.agency)
self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency)
self.config = resources.ConfigResourceWithRawResponse(client.config)
self.current_time = resources.CurrentTimeResourceWithRawResponse(client.current_time)
self.stops_for_location = resources.StopsForLocationResourceWithRawResponse(client.stops_for_location)
Expand All @@ -473,6 +478,7 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
client.agencies_with_coverage
)
self.agency = resources.AsyncAgencyResourceWithRawResponse(client.agency)
self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithRawResponse(client.vehicles_for_agency)
self.config = resources.AsyncConfigResourceWithRawResponse(client.config)
self.current_time = resources.AsyncCurrentTimeResourceWithRawResponse(client.current_time)
self.stops_for_location = resources.AsyncStopsForLocationResourceWithRawResponse(client.stops_for_location)
Expand All @@ -495,6 +501,7 @@ def __init__(self, client: OnebusawaySDK) -> None:
client.agencies_with_coverage
)
self.agency = resources.AgencyResourceWithStreamingResponse(client.agency)
self.vehicles_for_agency = resources.VehiclesForAgencyResourceWithStreamingResponse(client.vehicles_for_agency)
self.config = resources.ConfigResourceWithStreamingResponse(client.config)
self.current_time = resources.CurrentTimeResourceWithStreamingResponse(client.current_time)
self.stops_for_location = resources.StopsForLocationResourceWithStreamingResponse(client.stops_for_location)
Expand All @@ -517,6 +524,9 @@ def __init__(self, client: AsyncOnebusawaySDK) -> None:
client.agencies_with_coverage
)
self.agency = resources.AsyncAgencyResourceWithStreamingResponse(client.agency)
self.vehicles_for_agency = resources.AsyncVehiclesForAgencyResourceWithStreamingResponse(
client.vehicles_for_agency
)
self.config = resources.AsyncConfigResourceWithStreamingResponse(client.config)
self.current_time = resources.AsyncCurrentTimeResourceWithStreamingResponse(client.current_time)
self.stops_for_location = resources.AsyncStopsForLocationResourceWithStreamingResponse(
Expand Down
14 changes: 14 additions & 0 deletions src/onebusaway/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@
StopIDsForAgencyResourceWithStreamingResponse,
AsyncStopIDsForAgencyResourceWithStreamingResponse,
)
from .vehicles_for_agency import (
VehiclesForAgencyResource,
AsyncVehiclesForAgencyResource,
VehiclesForAgencyResourceWithRawResponse,
AsyncVehiclesForAgencyResourceWithRawResponse,
VehiclesForAgencyResourceWithStreamingResponse,
AsyncVehiclesForAgencyResourceWithStreamingResponse,
)
from .arrival_and_departure import (
ArrivalAndDepartureResource,
AsyncArrivalAndDepartureResource,
Expand Down Expand Up @@ -126,6 +134,12 @@
"AsyncAgencyResourceWithRawResponse",
"AgencyResourceWithStreamingResponse",
"AsyncAgencyResourceWithStreamingResponse",
"VehiclesForAgencyResource",
"AsyncVehiclesForAgencyResource",
"VehiclesForAgencyResourceWithRawResponse",
"AsyncVehiclesForAgencyResourceWithRawResponse",
"VehiclesForAgencyResourceWithStreamingResponse",
"AsyncVehiclesForAgencyResourceWithStreamingResponse",
"ConfigResource",
"AsyncConfigResource",
"ConfigResourceWithRawResponse",
Expand Down
162 changes: 162 additions & 0 deletions src/onebusaway/resources/vehicles_for_agency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import httpx

from ..types import vehicles_for_agency_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.vehicles_for_agency_list_response import VehiclesForAgencyListResponse

__all__ = ["VehiclesForAgencyResource", "AsyncVehiclesForAgencyResource"]


class VehiclesForAgencyResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> VehiclesForAgencyResourceWithRawResponse:
return VehiclesForAgencyResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> VehiclesForAgencyResourceWithStreamingResponse:
return VehiclesForAgencyResourceWithStreamingResponse(self)

def list(
self,
agency_id: str,
*,
time: str | 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,
) -> VehiclesForAgencyListResponse:
"""
Get vehicles for a specific agency

Args:
time: Specific time for querying the status (timestamp format)

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not agency_id:
raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}")
return self._get(
f"/api/where/vehicles-for-agency/agencyID.json",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform({"time": time}, vehicles_for_agency_list_params.VehiclesForAgencyListParams),
),
cast_to=VehiclesForAgencyListResponse,
)


class AsyncVehiclesForAgencyResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncVehiclesForAgencyResourceWithRawResponse:
return AsyncVehiclesForAgencyResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> AsyncVehiclesForAgencyResourceWithStreamingResponse:
return AsyncVehiclesForAgencyResourceWithStreamingResponse(self)

async def list(
self,
agency_id: str,
*,
time: str | 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,
) -> VehiclesForAgencyListResponse:
"""
Get vehicles for a specific agency

Args:
time: Specific time for querying the status (timestamp format)

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not agency_id:
raise ValueError(f"Expected a non-empty value for `agency_id` but received {agency_id!r}")
return await self._get(
f"/api/where/vehicles-for-agency/agencyID.json",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
{"time": time}, vehicles_for_agency_list_params.VehiclesForAgencyListParams
),
),
cast_to=VehiclesForAgencyListResponse,
)


class VehiclesForAgencyResourceWithRawResponse:
def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None:
self._vehicles_for_agency = vehicles_for_agency

self.list = to_raw_response_wrapper(
vehicles_for_agency.list,
)


class AsyncVehiclesForAgencyResourceWithRawResponse:
def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None:
self._vehicles_for_agency = vehicles_for_agency

self.list = async_to_raw_response_wrapper(
vehicles_for_agency.list,
)


class VehiclesForAgencyResourceWithStreamingResponse:
def __init__(self, vehicles_for_agency: VehiclesForAgencyResource) -> None:
self._vehicles_for_agency = vehicles_for_agency

self.list = to_streamed_response_wrapper(
vehicles_for_agency.list,
)


class AsyncVehiclesForAgencyResourceWithStreamingResponse:
def __init__(self, vehicles_for_agency: AsyncVehiclesForAgencyResource) -> None:
self._vehicles_for_agency = vehicles_for_agency

self.list = async_to_streamed_response_wrapper(
vehicles_for_agency.list,
)
2 changes: 2 additions & 0 deletions src/onebusaway/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
from .stops_for_route_list_response import StopsForRouteListResponse as StopsForRouteListResponse
from .trip_detail_retrieve_response import TripDetailRetrieveResponse as TripDetailRetrieveResponse
from .current_time_retrieve_response import CurrentTimeRetrieveResponse as CurrentTimeRetrieveResponse
from .vehicles_for_agency_list_params import VehiclesForAgencyListParams as VehiclesForAgencyListParams
from .trip_for_vehicle_retrieve_params import TripForVehicleRetrieveParams as TripForVehicleRetrieveParams
from .arrival_and_departure_list_params import ArrivalAndDepartureListParams as ArrivalAndDepartureListParams
from .stop_ids_for_agency_list_response import StopIDsForAgencyListResponse as StopIDsForAgencyListResponse
from .vehicles_for_agency_list_response import VehiclesForAgencyListResponse as VehiclesForAgencyListResponse
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
Expand Down
12 changes: 12 additions & 0 deletions src/onebusaway/types/vehicles_for_agency_list_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import TypedDict

__all__ = ["VehiclesForAgencyListParams"]


class VehiclesForAgencyListParams(TypedDict, total=False):
time: str
"""Specific time for querying the status (timestamp format)"""
Loading